Problem creating an Azure Subscription with Powershell using Partner cmdlets

Viewed 19

I’m using the PartnerCenter Cmdlets, Connect-PartnerCenter and New-PartnerAzureSubscription from the PartnerCenter module. If I elevate my own account to AdminAgent and run these cmdlets in the Windows Terminal: Connect-PartnerCenter and type in my account, password and use Autheticator app to approve. and New-PartnerAzureSubscription -BillingAccountName fa6d7853-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx -CustomerId 83c7xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -DisplayName 'Create Test Subscription Automatically' Output: SubscriptionLink

/subscriptions/c473e888-xxxx-xxxx-xxxx-xxxxxxxxxxxx So, this works fine.

But We need to do this with an App Registration (SPN). If I use this: $credential = Get-Credential -UserName '0f618fd9-xxxx-xxxx-xxxx-xxxxxxxxxxxx' -Message 'Type password' Where 0f618fd9-xxxx-xxxx-xxxx-xxxxxxxxxxxx is the Application ID (SPN). Type the password. And Run this, Connect-PartnerCenter -Credential $credential -ServicePrincipal -TenantId 16cb613f-xxxx-xxxx-xxxx-xxxxxxxxxxxx Output: Account Environment TenantId 0f618fd9-xxxx-xxxx-xxxx-xxxxxxxxxxxx AzureCloud 16cb613f-xxxx-xxxx-xxxx-xxxxxxxxxxxx So, this SPN is now connected to the Partner Center. When I try to create a Subscription with, New-PartnerAzureSubscription -BillingAccountName fa6d7853-xxxx-xxxx-xxxx-xxxxxxxxxxxx:xxxxxxxx-xxxx-xxxxxxxxxxxx_xxxx-xx-xx -CustomerId 83c7xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -DisplayName 'Create Test Subscription Automatically part 2' I get this error, New-PartnerAzureSubscription : AADSTS1002012: The provided value for scope https://management.azure.com/user_impersonation is not valid. Client credential flows must have a scope value with /.default suffixed to the resource identifier (application ID URI). Trace ID: a561834c-xxxx-xxxx-xxxx-xxxxxxxxxxxx Correlation ID: 65d529b6-xxxx-xxxx-xxxx-xxxxxxxxxxxx Timestamp: 2022-09-21 13:21:41Z At line:1 char:1

  • New-PartnerAzureSubscription -BillingAccountName fa6d7853-xxxx-xxxx-x ...
  •   + CategoryInfo          : CloseError: (:) [New-PartnerAzureSubscription], MsalServiceException
      + FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerAzureSubscription
    
    

And I can’t find any information on this issue. Can You please assist me in troubleshooting this issue.

BR Leif

0 Answers
Related