question

PadKankipati-8757 avatar image
0 Votes"
PadKankipati-8757 asked azure-cxp-api edited

Issue while generting Access Token in Azure

We tried to get Access Token using below code:

https://login.microsoftonline.com/<tenant>/oauth2/authorize?client_id=<ClientId>;
&response_type=code
&redirect_uri=http%3A%2F%2Flocalhost
&response_mode=query
&state=1234
&resource=<Resource>

We are not able to understand Resource Id

Please help us on from where can we get Resource Id in Azure?

azure-active-directoryazure-ad-graph
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

psrsekhar avatar image
0 Votes"
psrsekhar answered psrsekhar commented

The resource is https://graph.microsoft.com if it is for validation

If you are using Azure REST API for resource information from Azure,

The structure of resource id is : "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/<resource-type>/<resource-name>"

For example,
/subscriptions/d3719f3d-a00d-6854-b9fd-adf87cb25c85/resourceGroups/testrg/providers/Microsoft.Web/sites/mywebapp

or you can also find it in the URL of the Azure portal.
Step 1: Go to the resource in the Azure portal

Step 2: Copy the URL from the address bar of the portal which will be as below :
https://portal.azure.com/#@khalidhaihotmail.onmicrosoft.com/resource/subscriptions/d3719f3d-a00d-6854-b9fd-adf87cb25c85/resourceGroups/testrg/providers/Microsoft.Web/sites/mywebapp/appServices

Step 3: Remove the first part of URL till /resource which will become :
/subscriptions/d3719f3d-a00d-6854-b9fd-adf87cb25c85/resourceGroups/testrg/providers/Microsoft.Web/sites/mywebapp/appServices

Step 4: Remove the last part of URL till name of the resource which will become :
/subscriptions/d3719f3d-a00d-6854-b9fd-adf87cb25c85/resourceGroups/testrg/providers/Microsoft.Web/sites/mywebapp





· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.