Microsoft。授權角色定義

言論

如需建立角色指派和定義的指引,請參閱 使用 Bicep建立 Azure RBAC 資源。

Bicep 資源定義

roleDefinitions 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

使用範例

Bicep 範例

部署自訂角色定義的基本範例。

targetScope = 'subscription'

param resourceName string = 'acctest0001'
param location string = 'eastus'

resource roleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' = {
  name: '6faae21a-0cd6-4536-8c23-a278823d12ed'
  properties: {
    assignableScopes: [
      subscription().id
    ]
    description: ''
    permissions: [
      {
        actions: [
          '*'
        ]
        dataActions: []
        notActions: []
        notDataActions: []
      }
    ]
    roleName: resourceName
    type: 'CustomRole'
  }
}

Azure 快速入門範例

下列 Azure 快速入門範本 包含用於部署此資源類型的 Bicep 範例。

Bicep 檔案 描述
使用 Azure Windows 基準 Azure Image Builder 建立 Azure Image Builder 環境,並建置已套用最新 Windows Update 和 Azure Windows 基準的 Windows Server 映射。
設定開發箱服務 此範本會根據 Dev Box 快速入門指南 (/azure/dev-box/quickstart-create-dev-box) 建立所有 Dev Box 管理員資源。 您可以檢視所有建立的資源,或直接移至 DevPortal.microsoft.com 來建立您的第一個開發方塊。
透過訂用帳戶層級部署建立新的角色 def 此範本是訂用帳戶層級範本,將在訂用帳戶範圍建立角色定義。

資源格式

若要建立 Microsoft.Authorization/roleDefinitions 資源,請將下列 Bicep 新增至您的範本。

resource symbolicname 'Microsoft.Authorization/roleDefinitions@2022-05-01-preview' = {
  scope: resourceSymbolicName or scope
  name: 'string'
  properties: {
    assignableScopes: [
      'string'
    ]
    description: 'string'
    permissions: [
      {
        actions: [
          'string'
        ]
        dataActions: [
          'string'
        ]
        notActions: [
          'string'
        ]
        notDataActions: [
          'string'
        ]
      }
    ]
    roleName: 'string'
    type: 'string'
  }
}

屬性值

Microsoft.Authorization/roleDefinitions

名字 描述 價值
名字 資源名稱 字串 (必要)
性能 角色定義屬性。 RoleDefinitionProperties
範圍 在與部署範圍不同的範圍內建立資源時,請使用 。 將此屬性設定為資源的符號名稱,以套用 擴充資源。

許可

名字 描述 價值
行動 允許的動作。 string[]
dataActions 允許的數據動作。 string[]
notActions 拒絕的動作。 string[]
notDataActions 拒絕的數據動作。 string[]

RoleDefinitionProperties

名字 描述 價值
assignableScopes 角色定義可指派的範圍。 string[]
描述 角色定義描述。 字串
使用權限 角色定義許可權。 許可權[]
roleName 角色名稱。 字串
型別 角色類型。 字串

ARM 樣本資源定義

roleDefinitions 資源類型可以使用目標作業來部署:

使用範例

Azure 快速入門範本

下列 Azure 快速入門範本 部署此資源類型。

範本 描述
使用 Azure Windows 基準 Azure Image Builder

部署至 Azure
建立 Azure Image Builder 環境,並建置已套用最新 Windows Update 和 Azure Windows 基準的 Windows Server 映射。
設定開發箱服務

部署至 Azure
此範本會根據 Dev Box 快速入門指南 (/azure/dev-box/quickstart-create-dev-box) 建立所有 Dev Box 管理員資源。 您可以檢視所有建立的資源,或直接移至 DevPortal.microsoft.com 來建立您的第一個開發方塊。
透過訂用帳戶層級部署建立新的角色 def

部署至 Azure
此範本是訂用帳戶層級範本,將在訂用帳戶範圍建立角色定義。
為 SAP ILM 存放區部署記憶體帳戶

部署至 Azure
Microsoft Azure 記憶體帳戶現在可作為 ILM 存放區,以保存 SAP ILM 系統的封存盤案和附件。 ILM 存放區是滿足 SAP ILM 相容記憶體系統需求的元件。 您可以使用 WebDAV 介面標準將封存盤案儲存在記憶體媒體中,同時使用 SAP ILM 保留管理規則。 如需 SAP ILM 存放區的詳細資訊,請參閱 <href='https://www.sap.com'> SAP 說明入口網站 </a>。
部署深色追蹤自動調整 vSensors

部署至 Azure
此範本可讓您部署 Darktrace vSensors 的自動自動調整部署
Azure 上的 IBM Cloud Pak for Data

部署至 Azure
此範本會在 Azure 上部署 Openshift 叢集,其中包含所有必要的資源、基礎結構,然後部署 IBM Cloud Pak for Data,以及使用者選擇的附加元件。

資源格式

若要建立 Microsoft.Authorization/roleDefinitions 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.Authorization/roleDefinitions",
  "apiVersion": "2022-05-01-preview",
  "name": "string",
  "properties": {
    "assignableScopes": [ "string" ],
    "description": "string",
    "permissions": [
      {
        "actions": [ "string" ],
        "dataActions": [ "string" ],
        "notActions": [ "string" ],
        "notDataActions": [ "string" ]
      }
    ],
    "roleName": "string",
    "type": "string"
  }
}

屬性值

Microsoft.Authorization/roleDefinitions

名字 描述 價值
apiVersion API 版本 '2022-05-01-preview'
名字 資源名稱 字串 (必要)
性能 角色定義屬性。 RoleDefinitionProperties
型別 資源類型 'Microsoft.Authorization/roleDefinitions'

許可

名字 描述 價值
行動 允許的動作。 string[]
dataActions 允許的數據動作。 string[]
notActions 拒絕的動作。 string[]
notDataActions 拒絕的數據動作。 string[]

RoleDefinitionProperties

名字 描述 價值
assignableScopes 角色定義可指派的範圍。 string[]
描述 角色定義描述。 字串
使用權限 角色定義許可權。 許可權[]
roleName 角色名稱。 字串
型別 角色類型。 字串

Terraform (AzAPI 提供者) 資源定義

roleDefinitions 資源類型可以使用目標作業來部署:

  • 租戶* 管理團隊* 訂閱* 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

使用範例

Terraform 範例

部署自訂角色定義的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
    azurerm = {
      source = "hashicorp/azurerm"
    }
  }
}

provider "azurerm" {
  features {
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "eastus"
}

data "azurerm_client_config" "current" {
}

data "azapi_resource" "subscription" {
  type                   = "Microsoft.Resources/subscriptions@2021-01-01"
  resource_id            = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
  response_export_values = ["*"]
}

resource "azapi_resource" "roleDefinition" {
  type      = "Microsoft.Authorization/roleDefinitions@2018-01-01-preview"
  parent_id = data.azapi_resource.subscription.id
  name      = "6faae21a-0cd6-4536-8c23-a278823d12ed"
  body = {
    properties = {
      assignableScopes = [
        data.azapi_resource.subscription.id,
      ]
      description = ""
      permissions = [
        {
          actions = [
            "*",
          ]
          dataActions = [
          ]
          notActions = [
          ]
          notDataActions = [
          ]
        },
      ]
      roleName = var.resource_name
      type     = "CustomRole"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

資源格式

若要建立 Microsoft.Authorization/roleDefinitions 資源,請將下列 Terraform 新增至您的範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Authorization/roleDefinitions@2022-05-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      assignableScopes = [
        "string"
      ]
      description = "string"
      permissions = [
        {
          actions = [
            "string"
          ]
          dataActions = [
            "string"
          ]
          notActions = [
            "string"
          ]
          notDataActions = [
            "string"
          ]
        }
      ]
      roleName = "string"
      type = "string"
    }
  }
}

屬性值

Microsoft.Authorization/roleDefinitions

名字 描述 價值
名字 資源名稱 字串 (必要)
parent_id 要套用此延伸模組資源之資源的標識碼。 字串 (必要)
性能 角色定義屬性。 RoleDefinitionProperties
型別 資源類型 “Microsoft.Authorization/roleDefinitions@2022-05-01-preview”

許可

名字 描述 價值
行動 允許的動作。 string[]
dataActions 允許的數據動作。 string[]
notActions 拒絕的動作。 string[]
notDataActions 拒絕的數據動作。 string[]

RoleDefinitionProperties

名字 描述 價值
assignableScopes 角色定義可指派的範圍。 string[]
描述 角色定義描述。 字串
使用權限 角色定義許可權。 許可權[]
roleName 角色名稱。 字串
型別 角色類型。 字串