Is there any way to see which Azure directory roles (built-in roles) a user is assigned to?
I need the information we get when we find the user and go to "Assigned Roles".
I’ve tried to find some commands in the Azure documentation however without success.
Thanks in advance
2
Answers
The easiest way to do this is using PowerShell and the Microsoft Graph PowerShell SDK. See the example below.
First, we have graph API to list all the built-in roles. So that we could know it’s a directory object as well.
So we could search in the user methods and find that we have relationship
MemberOf
to give us the diretory objects the user belongs to.Using API like below could give us the properties.
It proved that memberof is what we need to get, and we just need to add a filter to get all the directory roles. So here’s the API I found.