Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 48084

microsoft partner center API

$
0
0

Hi,

 

So I'm trying to get usage data from Microsoft Partner Center (via web API). I know that I need an Azure token and a Partner Center token to access the data. Connecting to the sandbox partner center environment is no problem. But for the primary environment I can't even get an Azure token. I have registered the Partner Center web API in the Azure active directory. How can I solve this?

The code below is for the azure token. On the print screen you can see the permissions that I have for the web API. In properties: multi-tenanted = 'no' and I'm not an owner of the api.

 

Thanks in advance

 

afbeelding.png

 

 

let
    Source = (AccountId as text, ApplicationId as text, ApplicationSecret as text, Password as text, Username as text) => let   
    aadRequest = [
        client_id = ApplicationId, 
        client_secret = ApplicationSecret,
        grant_type = "password",
        password = Password,
        resource = "https://api.partnercenter.microsoft.com",        
        scope = "openid",
        username = Username
    ],
    aadContent = Text.ToBinary(Uri.BuildQueryString(aadRequest)),
    aadTokenRequest = Web.Contents("https://login.microsoftonline.com/" & AccountId & "/oauth2/token", 
        [
            Headers = [#"content-type"="application/x-www-form-urlencoded"], 
            Content = aadContent
        ]
    ),
    aadTokenJSON = Json.Document(aadTokenRequest), 
    aadToken = aadTokenJSON[access_token]
in    
    aadToken
in
    Source

 


Viewing all articles
Browse latest Browse all 48084

Trending Articles