hightest
hightest

Reputation: 493

List of all Resources in my Azure Subscription + IAM Access Control Credentials

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

Answers (1)

Joy Wang
Joy Wang

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

enter image description here

Upvotes: 2

Related Questions