Not able to use metered APIs in Microsoft Graph

Radoslaw Szyler 0 Reputation points
2023-08-09T18:15:51.9233333+00:00

I am trying to use assignSensitivityLabel API. This is a metered API and instructions to enable this are here: https://learn.microsoft.com/en-us/graph/metered-api-setup?tabs=azurecloudshell

However, on executing the mentioned command at cloud shell returns an error.

Command:

az resource create --resource-group myRG --name myGraphAppBilling --resource-type Microsoft.GraphServices/accounts --properties "{`"appId`": `"myAppGUID`"}" --location Global --subscription mySubscriptionGUID

Error:
Failed to get token from tokenEndpoint: 'https://login.windows.net/{{tenant_id}}/oauth2/v2.0/token', clientId: 'e3b317b2-ee2c-4eb2-ab20-c166ef7fe246', resource: 'https://graph.microsoft.com//.default', activityId: 'xxx-yyy-zzz'.
On further investigation I found the clientId trying to get token is an Enterprise Application (MicrosoftGraphMeteringServiceRP). I have added the user in both AD and this Enterprise Application but the issue remains. Any idea what could be going on and how to resolve this?

Microsoft Security | Microsoft Graph
Microsoft Security | Microsoft Purview
{count} votes

2 answers

Sort by: Most helpful
  1. soumi-MSFT 11,831 Reputation points Microsoft Employee Moderator
    2023-08-10T18:24:41.9566667+00:00

    Hi, the issue seems to be fixed now.

    1 person found this answer helpful.

  2. Neto 0 Reputation points
    2023-10-07T01:13:27.4433333+00:00

    Hi. I'm getting the same error today. Any fix? Thanks Soumi.

    Code: InternalServerError

    Message: S2S33101: Failed to get token from tokenEndpoint: 'https://login.windows.net/XXXXXXXXXXXXXXXX/oauth2/v2.0/token', clientId: 'XXXXXXXXXXXXXXXXXXX', resource: 'https://graph.microsoft.com//.default', activityId: 'XXXXXXXXXXXXXXXXXXXXX'.

    HttpResponseMessage: '[PII of type 'System.Net.Http.HttpResponseMessage' is hidden]',

    HttpResponseMessage.Content: '[PII of type 'System.String' is hidden]'.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.