Role Assignments - Create

Kapsam ve ada göre rol ataması oluşturun veya güncelleştirin.

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

URI Parametreleri

Name İçinde Gerekli Tür Description
roleAssignmentName
path True

string

Rol atamasının adı. Herhangi bir geçerli GUID olabilir.

scope
path True

string

İşlemin veya kaynağın kapsamı. Geçerli kapsamlar şunlardır: abonelik (biçim: '/subscriptions/{subscriptionId}'), kaynak grubu (biçim: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', veya kaynak (biçim: '/subscriptions/{subscriptionId}/resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'

api-version
query True

string

Bu işlem için kullanılacak API sürümü.

İstek Gövdesi

Name Gerekli Tür Description
properties.principalId True

string

Asıl kimlik.

properties.roleDefinitionId True

string

Rol tanımı kimliği.

properties.condition

string

Rol ataması koşulları. Bu, atanabileceği kaynakları sınırlar. Örneğin: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'

properties.conditionVersion

string

Koşulun sürümü. Şu anda kabul edilen tek değer '2.0'

properties.delegatedManagedIdentityResourceId

string

Temsilci olarak atanan yönetilen kimlik kaynağının kimliği

properties.description

string

Rol atamasının açıklaması

properties.principalType

PrincipalType

Atanan asıl kimliğin asıl türü.

Yanıtlar

Name Tür Description
200 OK

RoleAssignment

Rol atamasını döndürür.

201 Created

RoleAssignment

Rol atamasını döndürür.

Other Status Codes

ErrorResponse

İşlemin neden başarısız olduğunu açıklayan hata yanıtı.

İzinler

Bu API’yi çağırmak için aşağıdaki izinlere sahip bir rol atanması gerekir. Daha fazla bilgi için bkz. Azure yerleşik rolleri.

Microsoft.Authorization/roleAssignments/write

Güvenlik

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 kullanıcı hesabınızın kimliğine bürünme

Örnekler

Create role assignment for resource
Create role assignment for resource group
Create role assignment for subscription

Create role assignment for resource

Sample Request

PUT https://management.azure.com/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff?api-version=2022-04-01

{
  "properties": {
    "roleDefinitionId": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User"
  }
}

Sample Response

{
  "properties": {
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User",
    "scope": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account"
  },
  "id": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff",
  "type": "Microsoft.Authorization/roleAssignments",
  "name": "05c5a614-a7d6-4502-b150-c2fb455033ff"
}
{
  "properties": {
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User",
    "scope": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account"
  },
  "id": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff",
  "type": "Microsoft.Authorization/roleAssignments",
  "name": "05c5a614-a7d6-4502-b150-c2fb455033ff"
}

Create role assignment for resource group

Sample Request

PUT https://management.azure.com/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff?api-version=2022-04-01

{
  "properties": {
    "roleDefinitionId": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User"
  }
}

Sample Response

{
  "properties": {
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User",
    "scope": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg"
  },
  "id": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff",
  "type": "Microsoft.Authorization/roleAssignments",
  "name": "05c5a614-a7d6-4502-b150-c2fb455033ff"
}
{
  "properties": {
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User",
    "scope": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg"
  },
  "id": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff",
  "type": "Microsoft.Authorization/roleAssignments",
  "name": "05c5a614-a7d6-4502-b150-c2fb455033ff"
}

Create role assignment for subscription

Sample Request

PUT https://management.azure.com/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff?api-version=2022-04-01

{
  "properties": {
    "roleDefinitionId": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User"
  }
}

Sample Response

{
  "properties": {
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User",
    "scope": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"
  },
  "id": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff",
  "type": "Microsoft.Authorization/roleAssignments",
  "name": "05c5a614-a7d6-4502-b150-c2fb455033ff"
}
{
  "properties": {
    "roleDefinitionId": "/providers/Microsoft.Authorization/roleDefinitions/0b5fe924-9a61-425c-96af-cfe6e287ca2d",
    "principalId": "ce2ce14e-85d7-4629-bdbc-454d0519d987",
    "principalType": "User",
    "scope": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2"
  },
  "id": "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/providers/Microsoft.Authorization/roleAssignments/05c5a614-a7d6-4502-b150-c2fb455033ff",
  "type": "Microsoft.Authorization/roleAssignments",
  "name": "05c5a614-a7d6-4502-b150-c2fb455033ff"
}

Tanımlar

Name Description
ErrorAdditionalInfo

Kaynak yönetimi hatası ek bilgileri.

ErrorDetail

Hata ayrıntısı.

ErrorResponse

Hata yanıtı

PrincipalType

Atanan asıl kimliğin asıl türü.

RoleAssignment

Rol Atamaları

RoleAssignmentCreateParameters

Rol ataması parametreleri oluşturur.

ErrorAdditionalInfo

Kaynak yönetimi hatası ek bilgileri.

Name Tür Description
info

object

Ek bilgiler.

type

string

Ek bilgi türü.

ErrorDetail

Hata ayrıntısı.

Name Tür Description
additionalInfo

ErrorAdditionalInfo[]

Hata ek bilgileri.

code

string

Hata kodu.

details

ErrorDetail[]

Hata ayrıntıları.

message

string

Hata iletisi.

target

string

Hata hedefi.

ErrorResponse

Hata yanıtı

Name Tür Description
error

ErrorDetail

Hata nesnesi.

PrincipalType

Atanan asıl kimliğin asıl türü.

Name Tür Description
Device

string

ForeignGroup

string

Group

string

ServicePrincipal

string

User

string

RoleAssignment

Rol Atamaları

Name Tür Varsayılan değer Description
id

string

Rol atama kimliği.

name

string

Rol ataması adı.

properties.condition

string

Rol ataması koşulları. Bu, atanabileceği kaynakları sınırlar. Örneğin: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'

properties.conditionVersion

string

Koşulun sürümü. Şu anda kabul edilen tek değer '2.0'

properties.createdBy

string

Atamayı oluşturan kullanıcının kimliği

properties.createdOn

string

Oluşturulduğu zaman

properties.delegatedManagedIdentityResourceId

string

Temsilci olarak atanan yönetilen kimlik kaynağının kimliği

properties.description

string

Rol atamasının açıklaması

properties.principalId

string

Asıl kimlik.

properties.principalType

PrincipalType

User

Atanan asıl kimliğin asıl türü.

properties.roleDefinitionId

string

Rol tanımı kimliği.

properties.scope

string

Rol atama kapsamı.

properties.updatedBy

string

Atamayı güncelleştiren kullanıcının kimliği

properties.updatedOn

string

Güncelleştirme zamanı

type

string

Rol atama türü.

RoleAssignmentCreateParameters

Rol ataması parametreleri oluşturur.

Name Tür Varsayılan değer Description
properties.condition

string

Rol ataması koşulları. Bu, atanabileceği kaynakları sınırlar. Örneğin: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container'

properties.conditionVersion

string

Koşulun sürümü. Şu anda kabul edilen tek değer '2.0'

properties.createdBy

string

Atamayı oluşturan kullanıcının kimliği

properties.createdOn

string

Oluşturulduğu zaman

properties.delegatedManagedIdentityResourceId

string

Temsilci olarak atanan yönetilen kimlik kaynağının kimliği

properties.description

string

Rol atamasının açıklaması

properties.principalId

string

Asıl kimlik.

properties.principalType

PrincipalType

User

Atanan asıl kimliğin asıl türü.

properties.roleDefinitionId

string

Rol tanımı kimliği.

properties.scope

string

Rol atama kapsamı.

properties.updatedBy

string

Atamayı güncelleştiren kullanıcının kimliği

properties.updatedOn

string

Güncelleştirme zamanı