How to add group or users to Enterprise Apps in Azure using Graph API?

Viewed 1971

Is there a way to add a group or a user to Enterprise Apps in Azure using Graph API ? Was looking for available properties in Beta and 1.0 but couldn't find this option.

2 Answers

To assign user/group to app using Graph API you could use the below endpoint :

POST https://graph.microsoft.com/v1.0/users/{id}/appRoleAssignments
Content-Type: application/json
Content-Length: 110

{
  "principalId": "principalId-value",
  "resourceId": "resourceId-value",
  "appRoleId": "appRoleId-value"
}

Reference : https://docs.microsoft.com/en-us/graph/api/user-post-approleassignments?view=graph-rest-1.0&tabs=http

Parameters

{id}- id/upn of the user of the user

"principalId" - id/upn of the user of the user


resourceId - Id of the app, you can get it from the portal

Azure Active Directory >> App Registrations >> Select All Apps from the dropdown menu >> find your app and click on it.

enter image description here


appRoleId

To get the ApproleID

Azure Active Directory >> App Registrations >> Select All Apps from the dropdown menu >> find your app and click on it >> App Roles | Preview

enter image description here

enter image description here

Or using Graph

https://graph.microsoft.com/v1.0/applications/{id}?$select=displayName, appId,appRoles
Related