Using Ms Graph Rest API's
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | AppRoleAssignment.ReadWrite.All and Application.Read.All, AppRoleAssignment.ReadWrite.All and Directory.Read.All, Application.ReadWrite.All, Directory.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. |
Application | AppRoleAssignment.ReadWrite.All and Application.Read.All, AppRoleAssignment.ReadWrite.All and Directory.Read.All, Application.ReadWrite.All, Directory.ReadWrite.All |
Create 2 app registrations.
The reader role in approleowner will be added to the approlesubscriber
Setup postman to use the Oauth auth flow to get a token for MS Graph.
ClientId: Application (client) ID for approlesubscriber
Client Secret: secret for approlesubscriber
Scope: https://graph.microsoft.com/.default
Auth URL: https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize
Access Token URL: https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
Assign the delegated permissions so that we can act on behalf of the logged in user.
Add Role Assignment
URL : https://graph.microsoft.com/v1.0/servicePrincipals/{ResourceId}/appRoleAssignedTo
PrincipalId: Approlesubscribers enterprise apps object id (to whom we assign the role)
ResourceId: Approleowners enterprise apps object id (who has the app role)
AppRoleId: Id of the app role (shown in the below image)
Comments
Post a Comment