Azure-roldefinities weergeven

Een roldefinitie is een verzameling machtigingen die kunnen worden uitgevoerd, zoals lezen, schrijven en verwijderen. Het wordt meestal gewoon een rol genoemd. Op rollen gebaseerd toegangsbeheer van Azure (Azure RBAC) heeft meer dan 120 ingebouwde rollen of u kunt uw eigen aangepaste rollen maken. In dit artikel wordt beschreven hoe u de ingebouwde en aangepaste rollen weergeeft die u kunt gebruiken om toegang te verlenen tot Azure-resources.

Zie Beheer rolmachtigingen in Microsoft Entra ID voor de lijst met beheerdersrollen voor Microsoft Entra-id.

Vereisten

Geen

Azure Portal

Alle rollen weergeven

Volg deze stappen om alle rollen in Azure Portal weer te geven.

  1. Klik in Azure Portal op Alle services en selecteer vervolgens een bereik. U kunt bijvoorbeeld beheergroepen, abonnementen, resourcegroepen of een resource selecteren.

  2. Klik op de specifieke resource.

  3. Klik op Toegangsbeheer (IAM).

  4. Klik op het tabblad Rollen om een lijst te zien met alle ingebouwde en aangepaste rollen.

    Schermopname van de rollenlijst met nieuwe ervaring.

  5. Als u de machtigingen voor een bepaalde rol wilt zien, klikt u in de kolom Details op de koppeling Weergeven .

    Er wordt een deelvenster met machtigingen weergegeven.

  6. Klik op het tabblad Machtigingen om de machtigingen voor de geselecteerde rol weer te geven en te doorzoeken.

    Schermopname van rolmachtigingen met behulp van een nieuwe ervaring.

Azure PowerShell

Alle rollen weergeven

Als u alle rollen in Azure PowerShell wilt weergeven, gebruikt u Get-AzRoleDefinition.

Get-AzRoleDefinition | FT Name, Description
AcrImageSigner                                    acr image signer
AcrQuarantineReader                               acr quarantine data reader
AcrQuarantineWriter                               acr quarantine data writer
API Management Service Contributor                Can manage service and the APIs
API Management Service Operator Role              Can manage service but not the APIs
API Management Service Reader Role                Read-only access to service and APIs
Application Insights Component Contributor        Can manage Application Insights components
Application Insights Snapshot Debugger            Gives user permission to use Application Insights Snapshot Debugge...
Automation Job Operator                           Create and Manage Jobs using Automation Runbooks.
Automation Operator                               Automation Operators are able to start, stop, suspend, and resume ...
...

Een roldefinitie weergeven

Gebruik Get-AzRoleDefinition om de details van een specifieke rol weer te geven.

Get-AzRoleDefinition <role_name>
PS C:\> Get-AzRoleDefinition "Contributor"

Name             : Contributor
Id               : b24988ac-6180-42a0-ab88-20f7382dd24c
IsCustom         : False
Description      : Lets you manage everything except access to resources.
Actions          : {*}
NotActions       : {Microsoft.Authorization/*/Delete, Microsoft.Authorization/*/Write,
                  Microsoft.Authorization/elevateAccess/Action}
DataActions      : {}
NotDataActions   : {}
AssignableScopes : {/}

Een roldefinitie weergeven in JSON-indeling

Als u een rol in JSON-indeling wilt weergeven, gebruikt u Get-AzRoleDefinition.

Get-AzRoleDefinition <role_name> | ConvertTo-Json
PS C:\> Get-AzRoleDefinition "Contributor" | ConvertTo-Json

{
  "Name": "Contributor",
  "Id": "b24988ac-6180-42a0-ab88-20f7382dd24c",
  "IsCustom": false,
  "Description": "Lets you manage everything except access to resources.",
  "Actions": [
    "*"
  ],
  "NotActions": [
    "Microsoft.Authorization/*/Delete",
    "Microsoft.Authorization/*/Write",
    "Microsoft.Authorization/elevateAccess/Action",
    "Microsoft.Blueprint/blueprintAssignments/write",
    "Microsoft.Blueprint/blueprintAssignments/delete"
  ],
  "DataActions": [],
  "NotDataActions": [],
  "AssignableScopes": [
    "/"
  ]
}

Machtigingen van een roldefinitie weergeven

Gebruik Get-AzRoleDefinition om de machtigingen voor een specifieke rol weer te geven.

Get-AzRoleDefinition <role_name> | FL Actions, NotActions
PS C:\> Get-AzRoleDefinition "Contributor" | FL Actions, NotActions

Actions    : {*}
NotActions : {Microsoft.Authorization/*/Delete, Microsoft.Authorization/*/Write,
            Microsoft.Authorization/elevateAccess/Action,
            Microsoft.Blueprint/blueprintAssignments/write...}
(Get-AzRoleDefinition <role_name>).Actions
PS C:\> (Get-AzRoleDefinition "Virtual Machine Contributor").Actions

Microsoft.Authorization/*/read
Microsoft.Compute/availabilitySets/*
Microsoft.Compute/locations/*
Microsoft.Compute/virtualMachines/*
Microsoft.Compute/virtualMachineScaleSets/*
Microsoft.DevTestLab/schedules/*
Microsoft.Insights/alertRules/*
Microsoft.Network/applicationGateways/backendAddressPools/join/action
Microsoft.Network/loadBalancers/backendAddressPools/join/action
...

Azure CLI

Alle rollen weergeven

Als u alle rollen in Azure CLI wilt weergeven, gebruikt u az role definition list.

az role definition list

In het volgende voorbeeld ziet u de naam en beschrijving van alle beschikbare roldefinities:

az role definition list --output json --query '[].{roleName:roleName, description:description}'
[
  {
    "description": "Can manage service and the APIs",
    "roleName": "API Management Service Contributor"
  },
  {
    "description": "Can manage service but not the APIs",
    "roleName": "API Management Service Operator Role"
  },
  {
    "description": "Read-only access to service and APIs",
    "roleName": "API Management Service Reader Role"
  },

  ...

]

In het volgende voorbeeld ziet u alle ingebouwde rollen.

az role definition list --custom-role-only false --output json --query '[].{roleName:roleName, description:description, roleType:roleType}'
[
  {
    "description": "Can manage service and the APIs",
    "roleName": "API Management Service Contributor",
    "roleType": "BuiltInRole"
  },
  {
    "description": "Can manage service but not the APIs",
    "roleName": "API Management Service Operator Role",
    "roleType": "BuiltInRole"
  },
  {
    "description": "Read-only access to service and APIs",
    "roleName": "API Management Service Reader Role",
    "roleType": "BuiltInRole"
  },
  
  ...

]

Een roldefinitie weergeven

Gebruik az role definition list om details van een rol weer te geven.

az role definition list --name {roleName}

In het volgende voorbeeld ziet u de roldefinitie Inzender :

az role definition list --name "Contributor"
[
  {
    "assignableScopes": [
      "/"
    ],
    "description": "Lets you manage everything except access to resources.",
    "id": "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c",
    "name": "b24988ac-6180-42a0-ab88-20f7382dd24c",
    "permissions": [
      {
        "actions": [
          "*"
        ],
        "dataActions": [],
        "notActions": [
          "Microsoft.Authorization/*/Delete",
          "Microsoft.Authorization/*/Write",
          "Microsoft.Authorization/elevateAccess/Action",
          "Microsoft.Blueprint/blueprintAssignments/write",
          "Microsoft.Blueprint/blueprintAssignments/delete"
        ],
        "notDataActions": []
      }
    ],
    "roleName": "Contributor",
    "roleType": "BuiltInRole",
    "type": "Microsoft.Authorization/roleDefinitions"
  }
]

Machtigingen van een roldefinitie weergeven

In het volgende voorbeeld ziet u alleen de acties en notActions van de rol Inzender.

az role definition list --name "Contributor" --output json --query '[].{actions:permissions[0].actions, notActions:permissions[0].notActions}'
[
  {
    "actions": [
      "*"
    ],
    "notActions": [
      "Microsoft.Authorization/*/Delete",
      "Microsoft.Authorization/*/Write",
      "Microsoft.Authorization/elevateAccess/Action",
      "Microsoft.Blueprint/blueprintAssignments/write",
      "Microsoft.Blueprint/blueprintAssignments/delete"
    ]
  }
]

The following example lists just the actions of the Virtual Machine Contributor role.

az role definition list --name "Virtual Machine Contributor" --output json --query '[].permissions[0].actions'
[
  [
    "Microsoft.Authorization/*/read",
    "Microsoft.Compute/availabilitySets/*",
    "Microsoft.Compute/locations/*",
    "Microsoft.Compute/virtualMachines/*",
    "Microsoft.Compute/virtualMachineScaleSets/*",
    "Microsoft.Compute/disks/write",
    "Microsoft.Compute/disks/read",
    "Microsoft.Compute/disks/delete",
    "Microsoft.DevTestLab/schedules/*",
    "Microsoft.Insights/alertRules/*",
    "Microsoft.Network/applicationGateways/backendAddressPools/join/action",
    "Microsoft.Network/loadBalancers/backendAddressPools/join/action",

    ...

    "Microsoft.Storage/storageAccounts/listKeys/action",
    "Microsoft.Storage/storageAccounts/read",
    "Microsoft.Support/*"
  ]
]

REST API

Vereisten

U moet de volgende versie gebruiken:

  • 2015-07-01 of hoger

Zie API-versies van Azure RBAC REST API's voor meer informatie.

Alle roldefinities weergeven

Als u roldefinities in een tenant wilt weergeven, gebruikt u de roldefinities - REST API vermelden .

  • In het volgende voorbeeld ziet u alle roldefinities in een tenant:

    Aanvragen

    GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01
    

    Response

    {
        "value": [
            {
                "properties": {
                    "roleName": "Billing Reader Plus",
                    "type": "CustomRole",
                    "description": "Read billing data and download invoices",
                    "assignableScopes": [
                        "/subscriptions/473a4f86-11e3-48cb-9358-e13c220a2f15"
                    ],
                    "permissions": [
                        {
                            "actions": [
                                "Microsoft.Authorization/*/read",
                                "Microsoft.Billing/*/read",
                                "Microsoft.Commerce/*/read",
                                "Microsoft.Consumption/*/read",
                                "Microsoft.Management/managementGroups/read",
                                "Microsoft.CostManagement/*/read",
                                "Microsoft.Billing/invoices/download/action",
                                "Microsoft.CostManagement/exports/*"
                            ],
                            "notActions": [
                                "Microsoft.CostManagement/exports/delete"
                            ],
                            "dataActions": [],
                            "notDataActions": []
                        }
                    ],
                    "createdOn": "2021-05-22T21:57:23.5764138Z",
                    "updatedOn": "2021-05-22T21:57:23.5764138Z",
                    "createdBy": "68f66d4c-c0eb-4009-819b-e5315d677d70",
                    "updatedBy": "68f66d4c-c0eb-4009-819b-e5315d677d70"
                },
                "id": "/providers/Microsoft.Authorization/roleDefinitions/17adabda-4bf1-4f4e-8c97-1f0cab6dea1c",
                "type": "Microsoft.Authorization/roleDefinitions",
                "name": "17adabda-4bf1-4f4e-8c97-1f0cab6dea1c"
            },
            {
                "properties": {
                    "roleName": "AcrPush",
                    "type": "BuiltInRole",
                    "description": "acr push",
                    "assignableScopes": [
                        "/"
                    ],
                    "permissions": [
                        {
                            "actions": [
                                "Microsoft.ContainerRegistry/registries/pull/read",
                                "Microsoft.ContainerRegistry/registries/push/write"
                            ],
                            "notActions": [],
                            "dataActions": [],
                            "notDataActions": []
                        }
                    ],
                    "createdOn": "2018-10-29T17:52:32.5201177Z",
                    "updatedOn": "2021-11-11T20:13:07.4993029Z",
                    "createdBy": null,
                    "updatedBy": null
                },
                "id": "/providers/Microsoft.Authorization/roleDefinitions/8311e382-0749-4cb8-b61a-304f252e45ec",
                "type": "Microsoft.Authorization/roleDefinitions",
                "name": "8311e382-0749-4cb8-b61a-304f252e45ec"
            }
        ]
    }
    

Lijst met roldefinities weergeven

Als u roldefinities wilt weergeven, gebruikt u de roldefinities - REST API weergeven . Als u de resultaten wilt verfijnen, geeft u een bereik en een optioneel filter op.

  1. Begin met de volgende aanvraag:

    GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?$filter={$filter}&api-version=2022-04-01
    

    Voor een bereik op tenantniveau kunt u deze aanvraag gebruiken:

    GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions?filter={$filter}&api-version=2022-04-01
    
  2. Vervang {scope} in de URI door het bereik waarvoor u de roldefinities wilt weergeven.

    Bereik Type
    providers/Microsoft.Management/managementGroups/{groupId1} Beheergroep
    subscriptions/{subscriptionId1} Abonnement
    subscriptions/{subscriptionId1}/resourceGroups/myresourcegroup1 Resourcegroep
    subscriptions/{subscriptionId1}/resourceGroups/myresourcegroup1/providers/Microsoft.Web/sites/mysite1 Bron

    In het vorige voorbeeld is microsoft.web een resourceprovider die verwijst naar een App Service-exemplaar. Op dezelfde manier kunt u alle andere resourceproviders gebruiken en het bereik opgeven. Zie Azure-resourceproviders en -typen en ondersteunde bewerkingen van Azure-resourceproviders voor meer informatie.

  3. Vervang {filter} door de voorwaarde die u wilt toepassen om de lijst met roldefinities te filteren.

    Filteren Beschrijving
    $filter=type+eq+'{type}' Hiermee worden roldefinities van het opgegeven type weergegeven. Het type rol kan CustomRole of BuiltInRole.

    In het volgende voorbeeld worden alle aangepaste rollen in een tenant weergegeven:

    Aanvragen

    GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions?$filter=type+eq+'CustomRole'&api-version=2022-04-01
    

    Response

    {
        "value": [
            {
                "properties": {
                    "roleName": "Billing Reader Plus",
                    "type": "CustomRole",
                    "description": "Read billing data and download invoices",
                    "assignableScopes": [
                        "/subscriptions/473a4f86-11e3-48cb-9358-e13c220a2f15"
                    ],
                    "permissions": [
                        {
                            "actions": [
                                "Microsoft.Authorization/*/read",
                                "Microsoft.Billing/*/read",
                                "Microsoft.Commerce/*/read",
                                "Microsoft.Consumption/*/read",
                                "Microsoft.Management/managementGroups/read",
                                "Microsoft.CostManagement/*/read",
                                "Microsoft.Billing/invoices/download/action",
                                "Microsoft.CostManagement/exports/*"
                            ],
                            "notActions": [
                                "Microsoft.CostManagement/exports/delete"
                            ],
                            "dataActions": [],
                            "notDataActions": []
                        }
                    ],
                    "createdOn": "2021-05-22T21:57:23.5764138Z",
                    "updatedOn": "2021-05-22T21:57:23.5764138Z",
                    "createdBy": "68f66d4c-c0eb-4009-819b-e5315d677d70",
                    "updatedBy": "68f66d4c-c0eb-4009-819b-e5315d677d70"
                },
                "id": "/providers/Microsoft.Authorization/roleDefinitions/17adabda-4bf1-4f4e-8c97-1f0cab6dea1c",
                "type": "Microsoft.Authorization/roleDefinitions",
                "name": "17adabda-4bf1-4f4e-8c97-1f0cab6dea1c"
            }
        ]
    }
    

Een roldefinitie weergeven

Als u de details van een specifieke rol wilt weergeven, gebruikt u de roldefinities - Ophalen of roldefinities - Ophalen op id REST API.

  1. Begin met de volgende aanvraag:

    GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2022-04-01
    

    Voor een roldefinitie op tenantniveau kunt u deze aanvraag gebruiken:

    GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2022-04-01
    
  2. Vervang {scope} in de URI door het bereik waarvoor u de roldefinitie wilt weergeven.

    Bereik Type
    providers/Microsoft.Management/managementGroups/{groupId1} Beheergroep
    subscriptions/{subscriptionId1} Abonnement
    subscriptions/{subscriptionId1}/resourceGroups/myresourcegroup1 Resourcegroep
    subscriptions/{subscriptionId1}/resourceGroups/myresourcegroup1/providers/Microsoft.Web/sites/mysite1 Bron
  3. Vervang {roleDefinitionId} door de roldefinitie-id.

    In het volgende voorbeeld ziet u de roldefinitie Lezer :

Request

GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7?api-version=2022-04-01

Response

{
    "properties": {
        "roleName": "Reader",
        "type": "BuiltInRole",
        "description": "View all resources, but does not allow you to make any changes.",
        "assignableScopes": [
            "/"
        ],
        "permissions": [
            {
                "actions": [
                    "*/read"
                ],
                "notActions": [],
                "dataActions": [],
                "notDataActions": []
            }
        ],
        "createdOn": "2015-02-02T21:55:09.8806423Z",
        "updatedOn": "2021-11-11T20:13:47.8628684Z",
        "createdBy": null,
        "updatedBy": null
    },
    "id": "/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7",
    "type": "Microsoft.Authorization/roleDefinitions",
    "name": "acdd72a7-3385-48ef-bd42-f606fba81ae7"
}