-1

I am trying the available Microsoft gallery script [https://gallery.technet.microsoft.com/scriptcenter/Export-Azure-Resource-092b9c2a#content] but it's running on subscription level and it's hanging in the middle. Looking for the solution from PowerShell or Microsoft Graph API to pull the required RBAC roles from Subscription, resource groups and each resource level.

EdChum
  • 376,765
  • 198
  • 813
  • 562
  • If my reply is helpful, please mark it as the answer(on the left my reply, there is an option to mark), thanks. – Joy Wang May 10 '19 at 00:58

2 Answers2

0

Because the command in the script lists all role assignments in the selected Azure subscription by default. You just need to use the parameters e.g.-ResourceGroupName, -Scope in the command, then you will be able to do what you want.

Besides, in your script, it uses old AzureRm command Get-AzureRmRoleAssignment, it was deprecated. I recommend you to use Get-AzRoleAssignment.

For more details, see this link: Get-AzRoleAssignment.

Joy Wang
  • 39,905
  • 3
  • 30
  • 54
0

to achieve that you just need to use Get-AzRoleAssignment together with a filter:

Get-AzRoleAssignment | Where-Object { $_.Scope -match 'resource_group_name' }
4c74356b41
  • 69,186
  • 6
  • 100
  • 141