Volkhard Vogeler
Volkhard Vogeler

Reputation: 27

StoreBroker on Windows 2016 doesn´t authenticate

i want to use StoreBroker in a TFS Build-Pipeline fow publishing a app into the windows store. for this i use following script:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$clientId="<clientid>"
$clientSecret="<clientsecret>"
$tenantId="<tenant>"

Import-Module StoreBroker
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process


$css = ConvertTo-SecureString -String $ClientSecret -AsPlainText -force -Debug
$cred = New-Object System.Management.Automation.PSCredential $ClientId, $css
Set-StoreBrokerAuthentication -TenantId $TenantId -Credential $cred -Debug
Get-Applications -GetAll | Format-Applications -Verbose
  1. When using this Script on Windows 11 client machine, everything works fine.
  2. When using this Script on Windows Server 2016, i get the following message:
Be sure to check that your client id/secret are valid.
The underlying connection was closed: An unexpected error occurred on a send.
At C:\Program Files\WindowsPowerShell\Modules\StoreBroker\1.21.2\StoreBroker\StoreIngestionApi.psm1:556 char:9
+         Write-Log -Message $newLineOutput -Level Error
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Log
 
Be sure to check that your client id/secret are valid.
The underlying connection was closed: An unexpected error occurred on a send.
At C:\Program Files\WindowsPowerShell\Modules\StoreBroker\1.21.2\StoreBroker\StoreIngestionApi.psm1:557 char:9
+         throw $newLineOutput
+         ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Be sure to chec...rred on a send.:String) [], RuntimeException
    + FullyQualifiedErrorId : Be sure to check that your client id/secret are valid.
The underlying connection was closed: An unexpected error occurred on a send.

Do you have an idea?

best regards

Volkhard

Upvotes: 0

Views: 37

Answers (1)

Miao Tian-MSFT
Miao Tian-MSFT

Reputation: 5642

I can reproduce the same issue when I tried the script on the Windows Server 2016. error

Then I found the error The underlying connection was closed: An unexpected error occurred on a send. is similar with the one in this question and it is found that the older versions of DOTNET framework (i.e. 3.5 and 4.0) do not inherently support the newer versions of TLS like 1.2 and 1.3.

To solve the issue, there is an easy way to check and update the TLS 1.2 compatibility of the .NET Framework.

Here are the steps:

  1. Visit the https://github.com/microsoft/azure-devops-tls12 and download the Azure DevOps TLS 1.2 transition readiness checker.
  2. Run the script: AzureDevOpsTls12Analysis.ps1 It will check the TLS settings on your windows server 2016 and you may find the following result: Analysis of TLS 1.2 compatibility: .NET Framework
  3. Run the generated mitigation script generated: Mitigation-NetFramework.ps1 Mitigation-NetFramework.ps1
  4. Rerun your PowerShell script again. This time, the error The underlying connection was closed: An unexpected error occurred on a send. should not be there anymore.

Upvotes: 0

Related Questions