Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create a application role using Microsoft Graph API

I have created app registration in azure aad. I want to add a app role using Microsoft Graph API programmatic.

like image 262
Koushik mondal Avatar asked Sep 15 '25 00:09

Koushik mondal


1 Answers

It seems that there is no Microsoft Graph API to do that. If Azure AD graph is acceptable, you use the following rest API to do that.

PATCH https://graph.windows.net/{tenantId}/directoryObjects/{objectId}/Microsoft.DirectoryServices.Application?api-version=1.6 

Note: objectId not applicationId, we could get it from Azure portal.

The following is the test body

appRoles": [
    {
      "allowedMemberTypes": [
        "User"
      ],
      "displayName": "SurveyAdmin",
      "id": "c20e145e-5459-4a6c-a074-b942bbd4cfe1",
      "isEnabled": true,
      "description": "Administrators can manage the Surveys in their tenant",
      "value": "SurveyAdmin"
    }
  ]

Test result:

enter image description here

We also could check it in the application manifest from Azure portal.

enter image description here

like image 151
Tom Sun - MSFT Avatar answered Sep 17 '25 21:09

Tom Sun - MSFT