Export the list of user in Azure with their respective permissions on resources Groups as csv via PowerShell command

Here is a handy script to export the list of user in Azure with their respective permissions on resources Groups as csv file via PowerShell command

Get-AzResourceGroup| foreach-object {
$ResourceGroupName = $_.ResourceGroupName
Get-AzRoleAssignment | Select-Object DisplayName,RoleAssignmentID,@{Name = "ResourceGroup Name"; Expression = { (Get-AzResourceGroup $ResourceGroupName).ResourceGroupName}} ,Scope,RoleDefinitionName,@{name="SubscriptionName";expression = {$Name}},ObjectType | Sort-Object DisplayName 
}-OutVariable azusers
$azusers | Export-CSV UserList.csv -NoTypeInformation -Encoding UTF8 

Tags:

No responses yet

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Comments
Add External Contacts in Microsoft Teams