Skip to content

Instantly share code, notes, and snippets.

@gsuttie
Last active July 8, 2020 18:38
Show Gist options
  • Save gsuttie/3b339a128eac2613d0eafa025bb6f5db to your computer and use it in GitHub Desktop.
Save gsuttie/3b339a128eac2613d0eafa025bb6f5db to your computer and use it in GitHub Desktop.
PowerShell Script to Create Azure Custom RBAC Role
CD $HOME
wget https://gist.githubusercontent.com/gsuttie/9fc7736ebf06371a601218902adee770/raw/9d007ccb7fc367bf26a3b3d6c71fa11b3b5ffa85/customRoleDefinition.json
$subscription_id = (Get-AzContext).Subscription.id
(Get-Content -Path $HOME/customRoleDefinition.json) -Replace 'SUBSCRIPTION_ID', $subscription_id |
Set-Content -Path $HOME/customRoleDefinition.json
New-AzRoleDefinition -InputFile ./customRoleDefinition.json
Get-AzRoleDefinition -Name 'Virtual Machine Operator (Custom)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment