update role app users in Azure AD using Microsoft Graph API

799 Views Asked by At

I have different roles of an app called power.

enter image description here

Each user has a role assigned and I want to be able to change a role to a user with graph api using graph explorer and connect it to power apps.

enter image description here

enter image description here

With this request i have the id role of all users but I don't know how to update them

GET https://graph.microsoft.com/v1.0/{id}/users?$expand=appRoleAssignments

If there is another api or connector with which I can do it and connect it with powerapps, it also works for me.

1

There are 1 best solutions below

2
On BEST ANSWER

Yes, you should be sending a request as below (from Grant an appRoleAssignment for a service principal)

Endpoint

https://graph.microsoft.com/v1.0/servicePrincipals/{appObjectId}/appRoleAssignedTo

{appObjectId} should be the Enterprise Application (service principal) object ID

Method

POST

Request headers

Content-type: application/json

Request Body

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

principalId = The user/group object ID

resourceId = The Enterprise Application object ID, which is the same ID used in the endpoint {appObjectId}

appRoleId = The app role ID, which can be found in the App Registration manifest