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

Get-PartnerCustomer : (invalid_grant) When using Service Principal #413

@L-P-G

Description

@L-P-G

We have been using the API via user-based auth without issues, but now we're trying to fully automate our process. In doing so we added an app secret to the AAD Partner Center app we have registered in AAD. After that I tested the authentication using the command below. Connect-PartnerCenter works fine.

image

However, trying to get any information off the portal returns back

Get-PartnerCustomer : (invalid_grant)

According to the documentation linked below. When requesting a token from AAD (using the AppID/Secret/Tenant) a grant_type is sent in the body to login.microsft.com. What I don't know is if the grant_type sent by the module is incorrect or if there is something else messed up with permissions in the app registration in AAD

https://learn.microsoft.com/en-us/partner-center/developer/partner-center-authentication#rest-request

AAD registered app permissions
image

Steps to reproduce

What steps can reproduce the defect?

$appId = "REDACTED"
$secret =  ConvertTo-SecureString "REDACTED" -AsPlainText -Force
$tenantId = 'REDACTED'
$credential = New-Object System.Management.Automation.PSCredential($appId, $secret)
Connect-PartnerCenter -Credential $credential -Tenant $tenantId -ServicePrincipal
$PartnerCustomers = Get-PartnerCustomer
Get-PartnerCustomer : (invalid_grant)

Environment

PartnerCenter Module v3.0.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions