Azure monitor REST API throwing invalid token error RRS feed

  • Question

  • I created a native APP with Client credentials

     AuthenticationContext authContext = new AuthenticationContext(AUTHORITY, false, service);
                ClientCredential clientCred = new ClientCredential(CLIENT_ID, "myclientsecret");
                //Future<AuthenticationResult> future = authContext.acquireToken("https://graph.microsoft.com", clientCred, null);
                Future<AuthenticationResult> future = authContext.acquireToken("https://graph.microsoft.com", clientCred, null);

    Authority is:


    This worked fine and got a access token. Then I tried to access Azure Management REST API by setting this token as Bearer Token. Getting

    401 Unauthorized

    WWW-Authenticate: Bearer authorization_uri="https://login.windows.net/{tenentid}", error="invalid_token", error_description="Could not find identity for access token."

    Any idea what am I doing wrong?

    Thursday, June 20, 2019 12:32 AM

All replies

  • Hello AzureSight,

    Your code is correct, except that you are trying to acquire a token for Graph API instead of Azure Management API

    Please replace the resource endpoint - https://graph.microsoft.com with https://management.core.windows.net

    Do let us know if you face any issues.


    If the above answer was helpful, please click “Mark as Answer” or “Up-Vote”, which might be beneficial to other community members reading this thread. 

    Thursday, June 20, 2019 4:25 AM