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
roleAssignmentName
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

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 roldefinitie-id.

properties.condition

string

De voorwaarden voor de roltoewijzing. Dit beperkt de resources waaraan het 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

PrincipalType

Het principal-type van de toegewezen principal-id.

Antwoorden

Name Type Description
200 OK

RoleAssignment

Retourneert de roltoewijzing.

201 Created

RoleAssignment

Retourneert de roltoewijzing.

Other Status Codes

ErrorResponse

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
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

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

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"
}

Definities

Name Description
ErrorAdditionalInfo

Aanvullende informatie over de resourcebeheerfout.

ErrorDetail

De foutdetails.

ErrorResponse

Foutreactie

PrincipalType

Het principal-type van de toegewezen principal-id.

RoleAssignment

Roltoewijzingen

RoleAssignmentCreateParameters

Parameters voor het maken van roltoewijzingen.

ErrorAdditionalInfo

Aanvullende informatie over de resourcebeheerfout.

Name Type Description
info

object

De aanvullende informatie.

type

string

Het type aanvullende informatie.

ErrorDetail

De foutdetails.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

Aanvullende informatie over de fout.

code

string

De foutcode.

details

ErrorDetail[]

De foutdetails.

message

string

Het foutbericht.

target

string

Het foutdoel.

ErrorResponse

Foutreactie

Name Type Description
error

ErrorDetail

Het foutobject.

PrincipalType

Het principal-type van de toegewezen principal-id.

Name Type Description
Device

string

ForeignGroup

string

Group

string

ServicePrincipal

string

User

string

RoleAssignment

Roltoewijzingen

Name Type Standaardwaarde Description
id

string

De roltoewijzings-id.

name

string

De naam van de roltoewijzing.

properties.condition

string

De voorwaarden voor de roltoewijzing. Dit beperkt de resources waaraan het 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

Tijdstip waarop deze 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

PrincipalType

User

Het principal-type van de toegewezen principal-id.

properties.roleDefinitionId

string

De roldefinitie-id.

properties.scope

string

Het bereik van de roltoewijzing.

properties.updatedBy

string

Id van de gebruiker die de toewijzing heeft bijgewerkt

properties.updatedOn

string

Tijdstip waarop deze is bijgewerkt

type

string

Het roltoewijzingstype.

RoleAssignmentCreateParameters

Parameters voor het maken van roltoewijzingen.

Name Type Standaardwaarde Description
properties.condition

string

De voorwaarden voor de roltoewijzing. Dit beperkt de resources waaraan het 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

Tijdstip waarop deze 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

PrincipalType

User

Het principal-type van de toegewezen principal-id.

properties.roleDefinitionId

string

De roldefinitie-id.

properties.scope

string

Het bereik van de roltoewijzing.

properties.updatedBy

string

Id van de gebruiker die de toewijzing heeft bijgewerkt

properties.updatedOn

string

Tijdstip waarop deze is bijgewerkt