This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Description
Steps to reproduce
$AzureADtenantId = "xxxxxx"
$ClientId = 'xxxxxxx'
[ValidateNotNullOrEmpty()]$Key = 'xxxxxxxxx'
$Key = ConvertTo-SecureString -String $Key -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $appId, $Key
$token = New-PartnerAccessToken -ApplicationId $ClientId -Scopes 'https://api.partnercenter.microsoft.com/user_impersonation' -ServicePrincipal -Credential $credential -Tenant $AzureADtenantId -UseAuthorizationCode
Expected behavior
It is supposed to store valid token into $token variable.
Actual behavior
Showing below in PowerShell console and launching a browser which shows "AADSTS50000: There was an error issuing a token or an issue with our sign-in service.":
WARNING: Attempting to launch a browser for authorization code login.
WARNING: We have launched a browser for you to login. For the old experience with device code flow, please run 'New-PartnerAccessToken -UseDeviceAuthentication'.
Environment
PowerShell version 5.1.22621.2506
OS: Windows 11 23H2