microsoft / StoreBroker

A PowerShell module that leverages the Windows Store Submission API to allow easy automation of application submissions to the Windows Store. The master branch is stable and the v2 branch is under active development.
Other
97 stars 40 forks source link

check that your client id/secret are valid #239

Closed GaneshKumarPandithurai closed 6 months ago

GaneshKumarPandithurai commented 8 months ago

I am trying to establish a connection with MS Partner Center using StoreBroker module. Here is my code:

$AzureADtenantId = "xxxxxxxxxxx"
$ClientID = "yyyyyyyyyyyyyyyyyy"
[ValidateNotNullOrEmpty()]$Key = 'zzzzzzzzzzzzzzzzzzzzz'
$Key = ConvertTo-SecureString -String $Key -AsPlainText -Force 

$cred = New-Object System.Management.Automation.PSCredential($ClientID,$Key)
Set-StoreBrokerAuthentication -TenantId $AzureADtenantId -Credential $cred 
Try {  
Get-Applications -GetAll | Where-Object primaryName -like "*AAAAAAAA*" | Format-Application
}  
catch {  
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red  
}

I am using a valid client ID/secret however getting below as output so looking for your help to resolve this:

|  Elapsed: 0 second(s) [Getting access token]/  Elapsed: 0 second(s) [Getting access token]-  Elapsed: 0 second(s) [Getting access token]\  Elapsed: 0 second(s) [Getting access token]|  Elapsed: 0 second(s) [Getting access token]/  Elapsed: 1 second(s) [Getting access token]-  Elapsed: 1 second(s) [Getting access token]\  Elapsed: 1 second(s) [Getting access token]|  Elapsed: 1 second(s) [Getting access token]/  Elapsed: 1 second(s) [Getting access token]DONE (FAILED) - Operation took 1 second(s) [Getting access token]
Write-Log : 2024-01-04 15:39:40 : XXXX : Be sure to check that your client id/secret are valid.
The remote server returned an error: (500) Internal Server Error.
 : 
 At C:\Program Files\WindowsPowerShell\Modules\StoreBroker\1.21.0\StoreBroker\StoreIngestionApi.psm1:556 char:9
          Write-Log -Message $newLineOutput -Level Error
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
      FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Log_

Error: Be sure to check that your client id/secret are valid.
The remote server returned an error: (500) Internal Server Error.
HowardWolosky commented 6 months ago

@GaneshKumarPandithurai - You need to make sure that:

  1. Your client id / secret are valid (it looks like you've done that)
  2. You've given the appropriate permission to that client ID to administer your partner center account.

It seems like if you've done 1, then maybe your issue is 2.