Role Assignments - Create
Een roltoewijzing maken of bijwerken op bereik en naam.
PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}?api-version=2022-04-01
URI-parameters
| Name | In | Vereist | Type | Description |
|---|---|---|---|---|
|
role
|
path | True |
string |
De naam van de roltoewijzing. Dit kan elke geldige GUID zijn. |
|
scope
|
path | True |
string |
Het bereik van de bewerking of resource. Geldige bereiken zijn: abonnement (indeling: /subscriptions/{subscriptionId}), resourcegroep (indeling: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' of resource (indeling: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' |
|
api-version
|
query | True |
string minLength: 1 |
De API-versie die voor deze bewerking moet worden gebruikt. |
Aanvraagbody
| Name | Vereist | Type | Description |
|---|---|---|---|
| properties.principalId | True |
string |
De principal-id. |
| properties.roleDefinitionId | True |
string |
De id van de roldefinitie. |
| properties.condition |
string |
De voorwaarden voor de roltoewijzing. Hiermee worden de resources beperkt waaraan deze kan worden toegewezen. bijvoorbeeld: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' |
|
| properties.conditionVersion |
string |
Versie van de voorwaarde. Momenteel is de enige geaccepteerde waarde '2.0' |
|
| properties.delegatedManagedIdentityResourceId |
string |
Id van de gedelegeerde beheerde identiteitsresource |
|
| properties.description |
string |
Beschrijving van roltoewijzing |
|
| properties.principalType |
Het principal-type van de toegewezen principal-id. |
Antwoorden
| Name | Type | Description |
|---|---|---|
| 200 OK |
Retourneert de roltoewijzing. |
|
| 201 Created |
Retourneert de roltoewijzing. |
|
| Other Status Codes |
Foutreactie waarin wordt beschreven waarom de bewerking is mislukt. |
Machtigingen
Als u deze API wilt aanroepen, moet er aan u een rol zijn toegewezen met de volgende machtigingen. Zie Ingebouwde rollen in Azure voor meer informatie.
Microsoft.Authorization/roleAssignments/write
Beveiliging
azure_auth
Azure Active Directory OAuth2-stroom
Type:
oauth2
Stroom:
implicit
Autorisatie-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiken
| Name | Description |
|---|---|
| user_impersonation | Uw gebruikersaccount imiteren |
Voorbeelden
| Create role assignment for resource |
| Create role assignment for resource group |
| Create role assignment for subscription |
Create role assignment for resource
Voorbeeldaanvraag
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"
}
}
Voorbeeldrespons
{
"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
Voorbeeldaanvraag
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"
}
}
Voorbeeldrespons
{
"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
Voorbeeldaanvraag
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"
}
}
Voorbeeldrespons
{
"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"
}
Definities
| Name | Description |
|---|---|
|
Error |
Aanvullende informatie over de resourcebeheerfout. |
|
Error |
De foutdetails. |
|
Error |
Foutreactie |
|
Principal |
Het principal-type van de toegewezen principal-id. |
|
Role |
Roltoewijzingen |
|
Role |
Parameters maken voor roltoewijzing. |
ErrorAdditionalInfo
Aanvullende informatie over de resourcebeheerfout.
| Name | Type | Description |
|---|---|---|
| info |
object |
De aanvullende informatie. |
| type |
string |
Het extra informatietype. |
ErrorDetail
De foutdetails.
| Name | Type | Description |
|---|---|---|
| additionalInfo |
De fout bevat aanvullende informatie. |
|
| code |
string |
De foutcode. |
| details |
De foutdetails. |
|
| message |
string |
Het foutbericht. |
| target |
string |
Het foutdoel. |
ErrorResponse
Foutreactie
| Name | Type | Description |
|---|---|---|
| error |
Het foutobject. |
PrincipalType
Het principal-type van de toegewezen principal-id.
| Waarde | Description |
|---|---|
| User | |
| Group | |
| ServicePrincipal | |
| ForeignGroup | |
| Device |
RoleAssignment
Roltoewijzingen
| Name | Type | Default value | Description |
|---|---|---|---|
| id |
string |
De roltoewijzings-id. |
|
| name |
string |
De naam van de roltoewijzing. |
|
| properties.condition |
string |
De voorwaarden voor de roltoewijzing. Hiermee worden de resources beperkt waaraan deze kan worden toegewezen. bijvoorbeeld: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' |
|
| properties.conditionVersion |
string |
Versie van de voorwaarde. Momenteel is de enige geaccepteerde waarde '2.0' |
|
| properties.createdBy |
string |
Id van de gebruiker die de toewijzing heeft gemaakt |
|
| properties.createdOn |
string (date-time) |
Tijdstip waarop het is gemaakt |
|
| properties.delegatedManagedIdentityResourceId |
string |
Id van de gedelegeerde beheerde identiteitsresource |
|
| properties.description |
string |
Beschrijving van roltoewijzing |
|
| properties.principalId |
string |
De principal-id. |
|
| properties.principalType | User |
Het principal-type van de toegewezen principal-id. |
|
| properties.roleDefinitionId |
string |
De id van de roldefinitie. |
|
| properties.scope |
string |
Het bereik van de roltoewijzing. |
|
| properties.updatedBy |
string |
Id van de gebruiker die de toewijzing heeft bijgewerkt |
|
| properties.updatedOn |
string (date-time) |
Tijdstip waarop het is bijgewerkt |
|
| type |
string |
Het type roltoewijzing. |
RoleAssignmentCreateParameters
Parameters maken voor roltoewijzing.
| Name | Type | Default value | Description |
|---|---|---|---|
| properties.condition |
string |
De voorwaarden voor de roltoewijzing. Hiermee worden de resources beperkt waaraan deze kan worden toegewezen. bijvoorbeeld: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' |
|
| properties.conditionVersion |
string |
Versie van de voorwaarde. Momenteel is de enige geaccepteerde waarde '2.0' |
|
| properties.createdBy |
string |
Id van de gebruiker die de toewijzing heeft gemaakt |
|
| properties.createdOn |
string (date-time) |
Tijdstip waarop het is gemaakt |
|
| properties.delegatedManagedIdentityResourceId |
string |
Id van de gedelegeerde beheerde identiteitsresource |
|
| properties.description |
string |
Beschrijving van roltoewijzing |
|
| properties.principalId |
string |
De principal-id. |
|
| properties.principalType | User |
Het principal-type van de toegewezen principal-id. |
|
| properties.roleDefinitionId |
string |
De id van de roldefinitie. |
|
| properties.scope |
string |
Het bereik van de roltoewijzing. |
|
| properties.updatedBy |
string |
Id van de gebruiker die de toewijzing heeft bijgewerkt |
|
| properties.updatedOn |
string (date-time) |
Tijdstip waarop het is bijgewerkt |