microsoft / Partner-Center-PowerShell

PowerShell module for managing Partner Center resources.
https://docs.microsoft.com/powershell/partnercenter/
MIT License
130 stars 59 forks source link

AADSTS50000: There was an error issuing a token or an issue with our sign-in service. #420

Open GaneshKumarPandithurai opened 8 months ago

GaneshKumarPandithurai commented 8 months ago

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