Düzenle

Aracılığıyla paylaş


Azure rol tanımlarını listeleme

Rol tanımı, okuma, yazma ve silme gibi gerçekleştirilebilecek izinlerden oluşan bir koleksiyondur. Bu genellikle yalnızca rol olarak adlandırılır. Azure rol tabanlı erişim denetiminin (Azure RBAC) 120'den fazla yerleşik rolü vardır veya kendi özel rollerinizi oluşturabilirsiniz. Bu makalede, Azure kaynaklarına erişim vermek için kullanabileceğiniz yerleşik ve özel rollerin nasıl listelendiğini açıklanmaktadır.

Microsoft Entra Id yönetici rollerinin listesini görmek için bkz. Microsoft Entra Id'de Yönetici istrator rol izinleri.

Önkoşullar

Hiçbiri

Azure portalı

Tüm rolleri listeleme

Azure portalındaki tüm rolleri listelemek için bu adımları izleyin.

  1. Azure portalında Tüm hizmetler'e tıklayın ve ardından herhangi bir kapsam seçin. Örneğin, Yönetim grupları, Abonelikler, Kaynak grupları veya bir kaynak seçebilirsiniz.

  2. Belirli bir kaynağa tıklayın.

  3. Erişim denetimi (IAM) öğesine tıklayın.

  4. Tüm yerleşik ve özel rollerin listesini görmek için Roller sekmesine tıklayın.

    Yeni deneyimi kullanan Roller listesini gösteren ekran görüntüsü.

  5. Belirli bir rolün izinlerini görmek için Ayrıntılar sütununda Görünüm bağlantısına tıklayın.

    İzinler bölmesi görüntülenir.

  6. Seçili rolün izinlerini görüntülemek ve aramak için İzinler sekmesine tıklayın.

    Yeni deneyimi kullanarak rol izinlerini gösteren ekran görüntüsü.

Azure PowerShell

Tüm rolleri listeleme

Azure PowerShell'deki tüm rolleri listelemek için Get-AzRoleDefinition kullanın.

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

Rol tanımını listeleme

Belirli bir rolün ayrıntılarını listelemek için Get-AzRoleDefinition kullanın.

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 : {/}

Rol tanımını JSON biçiminde listeleme

Bir rolü JSON biçiminde listelemek için Get-AzRoleDefinition kullanın.

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": [
    "/"
  ]
}

Rol tanımının izinlerini listeleme

Belirli bir rolün izinlerini listelemek için Get-AzRoleDefinition komutunu kullanın.

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

Tüm rolleri listeleme

Azure CLI'daki tüm rolleri listelemek için az role definition list komutunu kullanın.

az role definition list

Aşağıdaki örnekte, kullanılabilir tüm rol tanımlarının adı ve açıklaması listelenir:

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

  ...

]

Aşağıdaki örnekte tüm yerleşik roller listelenmiştir.

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

]

Rol tanımını listeleme

Bir rolün ayrıntılarını listelemek için az role definition list komutunu kullanın.

az role definition list --name {roleName}

Aşağıdaki örnek Katkıda Bulunan rol tanımını listeler:

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

Rol tanımının izinlerini listeleme

Aşağıdaki örnek yalnızca Katkıda Bulunan rolünün eylemlerini ve notActions'larınılisteler.

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

Önkoşullar

Aşağıdaki sürümü kullanmanız gerekir:

  • 2015-07-01 veya üzeri

Daha fazla bilgi için bkz . Azure RBAC REST API'lerinin API sürümleri.

Tüm rol tanımlarını listeleme

Kiracıdaki rol tanımlarını listelemek için Rol Tanımları - Liste REST API'sini kullanın.

  • Aşağıdaki örnekte bir kiracıdaki tüm rol tanımları listelenmektedir:

    İste

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

Rol tanımlarını listeleme

Rol tanımlarını listelemek için Rol Tanımları - Liste REST API'sini kullanın. Sonuçlarınızı daraltmak için bir kapsam ve isteğe bağlı bir filtre belirtirsiniz.

  1. Aşağıdaki istekle başlayın:

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

    Kiracı düzeyinde bir kapsam için şu isteği kullanabilirsiniz:

    GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions?filter={$filter}&api-version=2022-04-01
    
  2. URI'nin içinde {scope} öğesini rol tanımlarını listelemek istediğiniz kapsamla değiştirin.

    Kapsam Tür
    providers/Microsoft.Management/managementGroups/{groupId1} Yönetim grubu
    subscriptions/{subscriptionId1} Abonelik
    subscriptions/{subscriptionId1}/resourceGroups/myresourcegroup1 Kaynak grubu
    subscriptions/{subscriptionId1}/resourceGroups/myresourcegroup1/providers/Microsoft.Web/sites/mysite1 Kaynak

    Önceki örnekte, microsoft.web bir App Service örneğine başvuran bir kaynak sağlayıcısıdır. Benzer şekilde, diğer tüm kaynak sağlayıcılarını kullanabilir ve kapsamı belirtebilirsiniz. Daha fazla bilgi için bkz . Azure Kaynak sağlayıcıları ve türleri ve desteklenen Azure kaynak sağlayıcısı işlemleri.

  3. {filter} öğesini rol tanımı listesine filtre uygulamak istediğiniz koşulla değiştirin.

    Filtre Açıklama
    $filter=type+eq+'{type}' Belirtilen türdeki rol tanımlarını listeler. Rolün türü veya BuiltInRoleolabilirCustomRole.

    Aşağıdaki örnekte bir kiracıdaki tüm özel roller listelenmektedir:

    İste

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

Rol tanımını listeleme

Belirli bir rolün ayrıntılarını listelemek için Rol Tanımları - Get veya Role Definitions - Get By Id REST API'sini kullanın.

  1. Aşağıdaki istekle başlayın:

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

    Kiracı düzeyinde rol tanımı için şu isteği kullanabilirsiniz:

    GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2022-04-01
    
  2. URI'nin içinde {scope} öğesini rol tanımını listelemek istediğiniz kapsamla değiştirin.

    Kapsam Tür
    providers/Microsoft.Management/managementGroups/{groupId1} Yönetim grubu
    subscriptions/{subscriptionId1} Abonelik
    subscriptions/{subscriptionId1}/resourceGroups/myresourcegroup1 Kaynak grubu
    subscriptions/{subscriptionId1}/resourceGroups/myresourcegroup1/providers/Microsoft.Web/sites/mysite1 Kaynak
  3. {roleDefinitionId} öğesini rol tanımı tanımlayıcısıyla değiştirin.

    Aşağıdaki örnek, Okuyucu rol tanımını listeler:

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