Role Assignments - Create

Creates a role assignment.

PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}?api-version=2015-07-01

URI Parameters

Name In Required Type Description
roleAssignmentName
path True
  • string

The name of the role assignment to create. It can be any valid GUID.

scope
path True
  • string

The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource.

api-version
query True
  • string

The API version to use for this operation.

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

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Create role assignment

Sample Request

PUT https://management.azure.com/scope/providers/Microsoft.Authorization/roleAssignments/roleAssignmentName?api-version=2015-07-01
{
  "properties": {
    "roleDefinitionId": "/subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/roleDefinitions/de139f84-1756-47ae-9be6-808fbbe84772",
    "principalId": "d93a38bc-d029-4160-bfb0-fbda779ac214"
  }
}

Sample Response

{
  "properties": {
    "roleDefinitionId": "/subscriptions/subId/providers/Microsoft.Authorization/roleDefinitions/roledefinitionId",
    "principalId": "Pid",
    "scope": "/subscriptions/subId/resourcegroups/rgname"
  },
  "id": "/subscriptions/subId/resourcegroups/rgname/providers/Microsoft.Authorization/roleAssignments/roleassignmentId",
  "type": "Microsoft.Authorization/roleAssignments",
  "name": "roleassignmentId"
}

Definitions

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

RoleAssignment

Role Assignments

RoleAssignmentCreateParameters

Role assignment create parameters.

RoleAssignmentProperties

Role assignment properties.

RoleAssignmentPropertiesWithScope

Role assignment properties with scope.

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info
  • object

The additional info.

type
  • string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

The error additional info.

code
  • string

The error code.

details

The error details.

message
  • string

The error message.

target
  • string

The error target.

ErrorResponse

Error response

Name Type Description
error

The error object.

RoleAssignment

Role Assignments

Name Type Description
id
  • string

The role assignment ID.

name
  • string

The role assignment name.

properties

Role assignment properties.

type
  • string

The role assignment type.

RoleAssignmentCreateParameters

Role assignment create parameters.

Name Type Description
properties

Role assignment properties.

RoleAssignmentProperties

Role assignment properties.

Name Type Description
principalId
  • string

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
  • string

The role definition ID used in the role assignment.

RoleAssignmentPropertiesWithScope

Role assignment properties with scope.

Name Type Description
principalId
  • string

The principal ID.

roleDefinitionId
  • string

The role definition ID.

scope
  • string

The role assignment scope.