I am trying to write a script to assign users to an Azure AD application (servicePrincipal) using Graph API. I am testing this in my sandbox, where I have defined the app and assigned users to it. However, when I query the servicePrincipal
, I don't see the users anywhere in the response.
Questions:
Based on the documentation, shouldn't there be
appRoleAssignment
?The documentation says this field is read-only, so how are you supposed to assign users?
You can get the
appRoleAssignments
of a user via the navigation property when querying the Graph API:You can create assignments by making an HTTP POST to:
The object that you need to send looks like this:
If your app does not have any roles, but you still want to assign a user, it seems you can just set the id to all zeros:
So something like: