skip to Main Content

I am trying to access the Azure APIs, using postman, for example https://management.azure.com/tenants?api-version=2022-12-01 but completely lost with MS documentation. I went through some threads here and they talk about sending some parameters in the body, such as:

client_id= &client_secret= &grant_type=client_credentials
&resource=

How/Where can I get those details. Is it somewhere in Azure portal?

2

Answers


  1. you would enter your credentials for these:

    client_id= &client_secret= &grant_type=client_credentials &resource=
    

    it depends on what azure services/resources you’re trying to connect to.
    go to that resource in the azure portal, and check out connections or access to that resouce under info or connections and enter them.

    Different azure services have slightly different look, so you’ll have to dig around.

    Login or Signup to reply.
  2. To access this API query
    GET https://management.azure.com/tenants?api-version=2022-12-01

    Initially, I registered Single Tenant Microsoft Entra ID application

    Go to portal –> Microsoft Entra ID –>App registration

    enter image description here

    Added and granted API permission of Azure Service Management like below:

    enter image description here

    Also, I added RBAC role of Reader to Service Principal at Subscription level:

    enter image description here

    Now, Added Client Secret:

    enter image description here

    Now, Generate access token using Postman or ThunderClient(VS Code Extension) with below parameters:

    POST https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token
    
    client_id = <client_id>
    client_secret= <client secret>
    grant_type = client_credentials
    scope = https://management.azure.com/.default
    
    

    enter image description here

    Now use this generated access token to fetch the below query:

    GET https://management.azure.com/tenants?api-version=2022-12-01

    enter image description here

    Reference:

    Tenants-List

    Azure-RBAC Roles

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search