I have the following PowerShell script in Azure Automation. It needs to connect to Partner Center.
Connect-AzAccount -Identity
$accessToken = (Get-AzAccessToken -ResourceUrl "https://api.partnercenter.microsoft.com").Token
Connect-PartnerCenter -AccessToken $accessToken
The Azure Automation account is using a system-assigned managed identity.
- Can you use this managed identity to give it Partner Center permissions? If so, how?
- Or do we have to create an Azure AD app registration? What app permissions are required?
- Is there another way?
The script needs to run in Azure Automation not as sign-in user. Is this possible?
The scope of the script will be to:
-
Pull all customers from Partner Center
-
Pull all users from each customer
-
Pull all licenses for each user
The script “authenticates” to the Partner Center; however, running Get-PartnerCustomer
after results in Error: Get-PartnerCustomer : (invalid_grant)
. I am assuming this is because the managed identity does not have any Partner Center permissions.