I can provide you a PowerShell script, which was tested by other users before for the similar question. Hope, it helps you too
Here is the step-by-step procedure
- Copy the foillowing script to a text file 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 - Save the file as ps1 file under any folder (example C:\script\azuser.ps1)
- Connect Azure account in PowerShell (az login)
- Run the script (example PS C:\script> .\azuser.ps1
- If it runs well, the result which you are looking for will be saved in the same folder with name UserList.csv
Let's know how it goes
--please don't forget to upvote
and Accept as answer
if the reply is helpful--