Issue while generting Access Token in Azure

Pad Kankipati 1 Reputation point
2021-05-21T02:30:45.303+00:00

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?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
18,615 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Poluru Sairam Sekhar 26 Reputation points
    2021-05-21T03:30:53.81+00:00

    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