Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamsunny/541527f9b263daacda9707355b57ffb4 to your computer and use it in GitHub Desktop.
Save iamsunny/541527f9b263daacda9707355b57ffb4 to your computer and use it in GitHub Desktop.
Create Custom Roles in Azure using Powershell
$role = [Microsoft.Azure.Commands.Resources.Models.Authorization.PSRoleDefinition]::new()
$role.Name = "Custom Role"
$role.IsCustom = $true
$role.Description = "Can perform assigned activities"
$perms = 'Microsoft.Compute/virtualMachines/read','Microsoft.Compute/virtualMachines/write'
$role.Actions = $perms
$role.assignableScopes = "/subscriptions/11111111-1111-1111-1111-111111111111"
New-AzRoleDefinition -Role $role
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment