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?
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
Added and granted API permission of Azure Service Management
like below:
Also, I added RBAC role of Reader to Service Principal at Subscription level:
Now, Added Client Secret:
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
Now use this generated access token to fetch the below query:
GET https://management.azure.com/tenants?api-version=2022-12-01
Reference: