Skip to content

Instantly share code, notes, and snippets.

@brootware
Created June 25, 2019 00:38
Show Gist options
  • Save brootware/83c7f473e3f65d8d977020e035e27c17 to your computer and use it in GitHub Desktop.
Save brootware/83c7f473e3f65d8d977020e035e27c17 to your computer and use it in GitHub Desktop.
exports role assignments in JSON format
#Get Resources
$Resources = Get-AzureRmRoleAssignment
#Get Resource Data
$Output = $Resources| ForEach-Object {
[PSCustomObject]@{
"Name" = $_.DisplayName
"ObjectId" = $_.ObjectId
"ObjectType" = $_.ObjectType
"RoleAssignmentId" = $_.RoleAssignmentId
"RoleDefinitionName" = $_.RoleDefinitionName
"RoleDefinitionId" = $_.RoleDefinitionId
"Scope" = $_.Scope
"SignInName" = $_.SignInName
"CanDelegate" = $_.CanDelegate
}
}
#Output Resource Data
$Output | ConvertTo-Json -Depth 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment