Reputation: 493
I need to export all the Resources from my Azure subscription and i got the command for this:
Get-AzureRmResource | Export-CSV C:\temp\azure-resources.csv
But I want to export all IAM Access Control Information from each Resource separately, to see all the user that has access to this resource and all the permissions.
Does someone have an idea how to do it with PS commands?
Upvotes: 0
Views: 3094
Reputation: 42063
Try the command below to export the each resource IAM information(role assignment) to CSV.
$resource = (Get-AzureRmResource | Select-Object ResourceId).ResourceId
foreach($item in $resource){
$role += Get-AzureRmRoleAssignment -Scope $item
}
$role | Export-CSV C:\Users\joyw\Desktop\test.csv
Upvotes: 2