Role definitions - az role definition

Manage role definitions.

Commands

az role definition create
az role definition delete Delete a role definition.
az role definition list List role definitions.
az role definition update Update a role definition.

az role definition create

az role definition create --role-definition

Examples

Create a role with following definition content

{
                            "Name": "Contoso On-call",
                            "Description": "Can monitor compute, network and storage, and restart virtual machines",
                            "Actions": [
                                "Microsoft.Compute//read",
                                    "Microsoft.Compute/virtualMachines/start/action",
                                    "Microsoft.Compute/virtualMachines/restart/action",
                                    "Microsoft.Network//read",
                                "Microsoft.Storage//read",
                                    "Microsoft.Authorization//read",
                                "Microsoft.Resources/subscriptions/resourceGroups/read",
                                "Microsoft.Resources/subscriptions/resourceGroups/resources/read",
                                "Microsoft.Insights/alertRules/",
                                    "Microsoft.Support/"
                            ],
                            "AssignableScopes": ["/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]
                        }

Required Parameters

--role-definition

JSON formatted string or a path to a file with such content.

az role definition delete

Delete a role definition.

az role definition delete --name
[--custom-role-only]
[--resource-group]
[--scope]

Required Parameters

--name -n

The role's name.

Optional Parameters

--custom-role-only

Custom roles only(vs. build-in ones).

--resource-group -g

Use it only if the role or assignment was added at the level of a resource group.

--scope

Scope at which the role assignment or definition applies to, e.g., /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333, /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM.

az role definition list

List role definitions.

az role definition list [--custom-role-only]
[--name]
[--resource-group]
[--scope]

Optional Parameters

--custom-role-only

Custom roles only(vs. build-in ones).

--name -n

The role's name.

--resource-group -g

Use it only if the role or assignment was added at the level of a resource group.

--scope

Scope at which the role assignment or definition applies to, e.g., /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333, /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup, or /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/myGroup/providers/Microsoft.Compute/virtualMachines/myVM.

az role definition update

Update a role definition.

az role definition update --role-definition

Required Parameters

--role-definition

Json formatted content which defines the new role.