Skip to content

Instantly share code, notes, and snippets.

@frankhu-2021
Created September 20, 2019 22:59
Show Gist options
  • Save frankhu-2021/dec59b48058350e0d448905f5d9f7594 to your computer and use it in GitHub Desktop.
Save frankhu-2021/dec59b48058350e0d448905f5d9f7594 to your computer and use it in GitHub Desktop.
This PowerShell script will list all the definitions from the Azure RBAC role that you put in the -name parameter.
Get-AzRoleDefinition -name "<Insert-Your-Azure-RBAC-Role>" | `
%{
$a = $_
$_.Actions | select `
@{n="Role";e={$a.Name}},
@{n="Type";e={"Actions"}},
@{n="Definition";e={$_}}
$_.DataActions | select `
@{n="Role";e={$a.Name}},
@{n="Type";e={"DataActions"}},
@{n="Definition";e={$_}}
$_.NotActions | select `
@{n="Role";e={$a.Name}},
@{n="Type";e={"NotActions"}},
@{n="Definition";e={$_}}
$_.NotDataActions | select `
@{n="Role";e={$a.Name}},
@{n="Type";e={"NotDataActions"}},
@{n="Definition";e={$_}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment