Azure AD document all roles and memberships

Joseph Patrick 641 Reputation points
2021-02-22T18:05:01.997+00:00

Good day,

Is there a PowerShell script, module, etc. that will look at all the roles in Azure AD and export the role names and descriptions and list the members while exporting it out to excel or word?

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,911 Reputation points Microsoft Employee Moderator
    2021-02-23T23:20:42.75+00:00

    @Joseph Patrick
    Thank you for your post!

    You can list all the roles in AzureAD and export the role names, descriptions, role template ID, and ObjectID, by using Get-AzureADDirectoryRole. In order to list the members assigned to them, you can use Get-AzureADDirectoryRoleMember.

    #Export all AzureAD roles to a CSV:  
    Get-AzureADDirectoryRole | Export-Csv -Path "C:\Test\AzureADRoles" -NoTypeInformation  
    #Get members of a directory role:  
    Get-AzureADDirectoryRoleMember -ObjectId "03a670cd-9e83-4b0c-8442-d0e99bee4584" | Export-Csv -Path "C:\Test\AzureADRolesAssigned" -NoTypeInformation  
    

    71229-azureadrolestocsv.gif
    After I exported the output, I had to manually rename the file adding the ".csv" extension so I could open it in Excel.

    I hope this helps! If you have any other questions, please let me know.
    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.