Creating AppRoles With Graph API

Shubham Kumar 20 Reputation points
2023-08-08T07:47:57.73+00:00

Hi everyone,

I am creating a web api that uses microsoft javascript sdk to call the graph api and create new app role using the client credentials flow . Below is the screen shot of my API permission.

User's image

However I am getting the following error

error_azure1

Here is my code

User's image

calling the endpoint like this

User's image

my role object

User's image

Any help would be appreciated.

Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Answer accepted by question author
  1. CarlZhao-MSFT 46,406 Reputation points
    2023-08-08T10:40:13.6266667+00:00

    Hi @Shubham Kumar

    Currently, application roles can only be created by updating the application, and updating the application is actually updating the application manifest.

    2

    Therefore, if your application has created an application role before, when creating a new application role on this basis, you must attach the previously created application role to the request body.

    Then your request body should be:

    {
        "appRoles": [
            {
               The previously created appRole.
            },
            {
               The newly created appRole.
            }
        ]
    }
    

    Do a quick test:

    User's image

    Go to the application manifest and you will be able to see the new application role has been created.

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


0 additional answers

Sort by: Most helpful

Your answer

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