az role assignment
Manage Azure role assignments.
Commands
| Name | Description | Type | Status |
|---|---|---|---|
| az role assignment create |
Create a role assignment. |
Core | Preview |
| az role assignment delete |
Delete a role assignment. |
Core | Preview |
| az role assignment list |
List role assignments. |
Core | Preview |
az role assignment create
Create a role assignment.
Create an Azure RBAC role assignment, granting a principal a role at a scope. The scope is the grant target (the subscription, resource group, or resource the access applies to): it defaults to the subscription and can be narrowed with --resource-group or overridden with --scope (the two are mutually exclusive). --role takes a role definition GUID or a fully-qualified role definition ID, and the principal (--assignee-object-id or --assignee) takes a GUID; role name and principal name/UPN/service-principal resolution are not yet supported. The assignment name is generated when --name is omitted. With a generated name, re-running create for a principal, role, and scope that already has an assignment returns that existing assignment instead of failing. Supplying an explicit --name is stricter: the command then fails if a differently-named assignment already grants that access.
az role assignment create --role
[--assignee]
[--assignee-object-id]
[--assignee-principal-type {User, Group, ServicePrincipal, ForeignGroup}]
[--condition]
[--condition-version]
[--description]
[--name]
[--profile]
[--resource-group]
[--scope]
[--subscription-id]
Examples
Create a role assignment at a resource group scope
az role assignment create --resource-group my-rg --role b24988ac-6180-42a0-ab88-20f7382dd24c --assignee-object-id 11111111-2222-3333-4444-555555555555
Create a role assignment at an explicit scope
az role assignment create --scope /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Storage/storageAccounts/my-account --role b24988ac-6180-42a0-ab88-20f7382dd24c --assignee-object-id 11111111-2222-3333-4444-555555555555
Create a role assignment with a principal type and description
az role assignment create --scope /subscriptions/00000000-0000-0000-0000-000000000000 --role b24988ac-6180-42a0-ab88-20f7382dd24c --assignee-object-id 11111111-2222-3333-4444-555555555555 --assignee-principal-type ServicePrincipal --description "grant CI access"
Required Parameters
The role to assign: a role definition ID (GUID) or a fully-qualified role definition ID. Role name resolution is not yet supported.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
The principal to assign the role to. Accepts an object (principal) ID; name/UPN/service-principal resolution is not yet supported.
The principal's object (principal) ID (GUID) to assign the role to.
The principal type of the assignee (User, Group, ServicePrincipal, or ForeignGroup).
| Property | Value |
|---|---|
| Accepted values: | User, Group, ServicePrincipal, ForeignGroup |
Condition under which the principal is granted permission.
Version of the condition syntax (currently only '2.0').
Description of the role assignment.
The role assignment name (a GUID). Generated when omitted.
Use the named profile for this command (overrides the active profile).
Create the role assignment scoped to this resource group under the subscription. Mutually exclusive with --scope.
Fully qualified scope to create the role assignment at (the grant target), e.g. a subscription, resource group, or resource ID. Mutually exclusive with --resource-group. Defaults to the subscription scope.
Azure Subscription Id. Defaults to the active profile's subscription.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az role assignment delete
Delete a role assignment.
Delete an Azure RBAC role assignment by scope and name. The scope is the delete target: it defaults to the subscription and can be narrowed with --resource-group or overridden with --scope (the two are mutually exclusive). --name (the assignment's GUID) is required: this targets exactly one already-known assignment. Deleting by principal/role filter, or deleting every assignment at a scope, is not supported — use az role assignment list first to find the assignment's name.
az role assignment delete --name
[--profile]
[--resource-group]
[--scope]
[--subscription-id]
Examples
Delete a role assignment by name at a resource group scope
az role assignment delete --resource-group my-rg --name aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
Delete a role assignment at an explicit scope
az role assignment delete --scope /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg --name aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
Required Parameters
The role assignment name (a GUID) to delete.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Use the named profile for this command (overrides the active profile).
Delete the role assignment scoped to this resource group under the subscription. Mutually exclusive with --scope.
Fully qualified scope to delete the role assignment from. Mutually exclusive with --resource-group. Defaults to the subscription scope.
Azure Subscription Id. Defaults to the active profile's subscription.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.
az role assignment list
List role assignments.
List Azure RBAC role assignments at a subscription, resource group, or resource scope. The scope defaults to the active subscription.
az role assignment list [--all]
[--assignee]
[--assignee-object-id]
[--include-groups]
[--include-inherited]
[--profile]
[--resource-group]
[--role]
[--scope]
[--subscription-id]
Examples
List role assignments at the subscription scope
az role assignment list
List role assignments scoped to a resource group
az role assignment list --resource-group my-rg
List role assignments at an explicit scope
az role assignment list --scope /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg
List role assignments for a specific principal
az role assignment list --assignee-object-id 11111111-2222-3333-4444-555555555555
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
List role assignments across the whole subscription, including every nested scope. Cannot be combined with --scope or --resource-group.
Filter to role assignments for this principal. Accepts an object (principal) ID; name/UPN/service-principal resolution is not yet supported.
Filter to role assignments for this principal's object (principal) ID (GUID).
When filtering by assignee, also include assignments granted through groups the principal belongs to (transitive).
Include role assignments inherited from ancestor scopes. By default only assignments at the exact scope are listed.
Use the named profile for this command (overrides the active profile).
List role assignments scoped to this resource group under the subscription.
Filter to role assignments for this role definition ID (GUID). Role name resolution is not yet supported.
Fully qualified scope to list role assignments at. Mutually exclusive with --resource-group. Defaults to the subscription scope.
Azure Subscription Id. Defaults to the active profile's subscription.
Global Parameters
Increase logging verbosity to show all debug logs.
Show help for the command or group and exit.
Bypass the extension discovery cache and reload extensions from disk.
Output format.
| Property | Value |
|---|---|
| Default value: | json |
| Accepted values: | json, jsonc, table, tsv, yaml, yamlc |
JMESPath query string to filter/project the command result before rendering.