Role Assignments - Create
Creates a role assignment.
PUT {vaultBaseUrl}/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}?api-version=7.3
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
role
|
path | True |
|
The name of the role assignment to create. It can be any valid GUID. |
|
scope
|
path | True |
|
The scope of the role assignment to create. |
|
vault
|
path | True |
|
The vault name, for example https://myvault.vault.azure.net. |
|
api-version
|
query | True |
|
Client API version. |
Request Body
| Name | Required | Type | Description |
|---|---|---|---|
| properties | True |
Role assignment properties. |
Responses
| Name | Type | Description |
|---|---|---|
| 201 Created |
Created - Returns information about the role assignment. |
|
| Other Status Codes |
Key Vault error response describing why the operation failed. |
Examples
PutRoleAssignments
Sample Request
PUT https://myvault.vault.azure.net//keys/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName?api-version=7.3
{
"properties": {
"roleDefinitionId": "/keys/providers/Microsoft.Authorization/roleDefinitions/roleDefinitionId",
"principalId": "principalId"
}
}
Sample Response
{
"properties": {
"roleDefinitionId": "/keys/providers/Microsoft.Authorization/roleDefinitions/roleDefinitionId",
"principalId": "principalId",
"scope": "/keys"
},
"id": "/keys/providers/Microsoft.Authorization/roleAssignments/roleAssignmentId",
"type": "Microsoft.Authorization/roleAssignments",
"name": "roleAssignmentId"
}
Definitions
| Error |
The key vault server error. |
|
Key |
The key vault error exception. |
|
Role |
Role Assignments |
|
Role |
Role assignment create parameters. |
|
Role |
Role assignment properties. |
|
Role |
Role assignment properties with scope. |
|
Role |
The role scope. |
Error
The key vault server error.
| Name | Type | Description |
|---|---|---|
| code |
|
The error code. |
| innererror |
The key vault server error. |
|
| message |
|
The error message. |
KeyVaultError
The key vault error exception.
| Name | Type | Description |
|---|---|---|
| error |
The key vault server error. |
RoleAssignment
Role Assignments
| Name | Type | Description |
|---|---|---|
| id |
|
The role assignment ID. |
| name |
|
The role assignment name. |
| properties |
Role assignment properties. |
|
| type |
|
The role assignment type. |
RoleAssignmentCreateParameters
Role assignment create parameters.
| Name | Type | Description |
|---|---|---|
| properties |
Role assignment properties. |
RoleAssignmentProperties
Role assignment properties.
| Name | Type | Description |
|---|---|---|
| principalId |
|
The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. |
| roleDefinitionId |
|
The role definition ID used in the role assignment. |
RoleAssignmentPropertiesWithScope
Role assignment properties with scope.
| Name | Type | Description |
|---|---|---|
| principalId |
|
The principal ID. |
| roleDefinitionId |
|
The role definition ID. |
| scope |
The role scope. |
RoleScope
The role scope.
| Name | Type | Description |
|---|---|---|
| / |
|
Global scope |
| /keys |
|
Keys scope |