Exporting Management Groups with Role Assignment(IAM)

H Raja 281 Reputation points
2022-02-28T13:32:09.55+00:00

Is it possible to generate a report via PowerShell on all Management Groups and Subscriptions with all role assignment permissions details.

Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
851 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,646 questions
0 comments No comments
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,751 Reputation points Microsoft Employee
    2022-03-10T23:16:57.297+00:00

    @H Raja
    Thank you for your post and I apologize for such a delayed response!

    When it comes to generating/ getting a report via PowerShell on all your Management Groups, and Subscriptions, with all Role Assignment details, you should be able to do this via the Get-AzRoleAssignment command. The Az PowerShell command lists Azure RBAC role assignments at the specified scope, and by default it lists all role assignments in the selected Azure subscription.

    When I tested Get-AzRoleAssignment within my Azure AD Tenant, I received the RBAC roles from my Management Group all the way to Resources.
    181920-image.png

    #Connect to Azure via PowerShell  
    Connect-AzAccount  
      
    #Execute the Get-AzRoleAssignment Command  
    $getrRoleAssignments =  Get-AzRoleAssignment  
      
    #Export Output into an Excel doc   
    $getrRoleAssignment | export-csv -Path .\rbacROles.csv  
      
    #Management Group and Subscription AZ commands  
    Get-AzManagementGroup  
    Get-AzSubscription  
    

    Additional Links:
    Get-AzManagementGroup
    Get-AzSubscription

    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 comments No comments

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.