Pavel Seget
Pavel Seget

Reputation: 1

Azure Active Directory B2C - Insufficient privileges to complete the operation

I created Azure AD B2C «MyApplication». When making request to read all users of AD B2C application «MyApplication» we getting following error:

{
  "odata.error": {
    "code": "Authorization_RequestDenied",
    "message": {
      "lang": "en",
      "value": "Insufficient privileges to complete the operation."
    }
  }
}

For authorization, was used a local account with global administrator rights ([email protected]).

I used next URL for HTTP request to Graph API: "https://graph.windows.net/myapplication.onmicrosoft.com/users?api-version=1.6"

The AccessToken was successfully received and added to the request header.

ASP.NET MVC 5 application (4.5.2)

Used libraries:

In the App registrations section (More services -> Security + Identity -> App registrations) there is an embedded application called: b2c-extensions-app. Should I use this app and change it "Required permissions" to access the AD B2C application "«MyApplication»" for CRUD operations with users of AD B2C?

Or is there another most correct solution to this problem?

Upvotes: 0

Views: 672

Answers (1)

spottedmahn
spottedmahn

Reputation: 15991

See this guide: Use the Azure AD Graph API: Get an access token.

You obtain access via a shared secret, not a user.

// The ClientCredential is where you pass in your client_id and client_secret, which are
// provided to Azure AD in order to receive an access_token by using the app's identity.
this.credential = new ClientCredential(clientId, clientSecret);

Upvotes: 1

Related Questions