本文介绍如何管理对 Azure 机器学习工作区的访问权限(授权)。 使用 Azure 基于角色的访问控制 (Azure RBAC)管理对 Azure 资源的访问。 通过使用 Azure RBAC,用户可以创建新资源或使用现有资源。 将特定角色分配给Microsoft Entra ID 中的用户,以授予对资源的访问权限。 Azure 提供内置角色和创建自定义角色的功能。
提示
虽然本文着重介绍的是 Azure 机器学习,但单独的服务也提供了它们自己的 RBAC 设置。 例如,通过使用本文中的信息,可以配置谁可以将评分请求提交到 Azure Kubernetes 服务上部署为 Web 服务的模型。 但 Azure Kubernetes 服务具有它自己的一组 Azure 角色。 有关对于 Azure 机器学习可能有用的服务特定的 RBAC 信息,请参阅以下链接:
警告
应用某些角色可能会限制 Azure 机器学习工作室中针对其他用户的 UI 功能。 例如,如果用户的角色无法创建计算实例,工作室中就不会提供创建计算实例的选项。 此行为是正常的,可以防止用户尝试会返回“拒绝访问”错误的操作。
默认角色
Azure 机器学习工作区具有默认可用的内置角色。 将用户添加到工作区时,请为其分配以下角色之一。
| 角色 | 访问级别 |
|---|---|
| AzureML 数据科学家 | 可以在 Azure 机器学习工作区中执行所有操作,但创建或删除计算资源及修改工作区本身除外。 |
| AzureML 计算操作员 | 可以在工作区中创建、管理、删除和访问计算资源。 |
| 读者 | 工作区中的只读操作。 用户可以在工作区中列出和查看资源,包括数据存储凭据。 读取者不能创建或更新这些资产。 |
| 参与者 | 在工作区中查看、创建、编辑或删除(如果适用)资产。 例如,参与者可以创建试验、创建或附加计算群集、提交运行和部署 Web 服务。 |
| 所有者 | 对工作区的完全访问权限,包括能够在工作区中查看、创建、编辑或删除(如果适用)资产。 此外,还可以更改角色分配。 |
此外, Azure 机器学习注册表 具有一个 Azure 机器学习注册表用户角色,可以分配给注册表资源,以向数据科学家授予用户级权限。 若要获得管理员级权限来创建或删除注册表,请使用“参与者”或“所有者”角色。
| 角色 | 访问级别 |
|---|---|
| AzureML 注册表用户 | 可以获取注册表并在其中读取、写入和删除资产。 无法创建新的注册表资源或删除它们。 |
可以组合角色以授予不同级别的访问权限。 例如,授予工作区用户 AzureML 数据科学家 和 AzureML 计算操作员 角色,以允许用户在以自助服务方式创建计算时执行试验。
重要
可以在 Azure 中将角色访问权限限定为多个级别。 例如,具有工作区所有者访问权限的人员可能无权访问包含工作区的资源组。 有关详细信息,请参阅 Azure RBAC 工作原理。
管理工作区访问权限
如果你是工作区的所有者,则可以为工作区添加和删除角色。 还可以将角色分配给用户。 使用以下链接了解如何管理访问权限:
例如,使用 Azure CLI 通过以下命令为this-rg资源组中的joe@contoso.com参与者角色:
az role assignment create --role "Contributor" --assignee "joe@contoso.com" --resource-group this-rg
使用 Microsoft Entra 安全组管理工作区访问权限
可以使用 Microsoft Entra 安全组来管理对工作区的访问权限。 此方法提供以下优势:
- 团队或项目主管能够以安全组所有者的身份管理用户对工作区的访问权限,而无需直接拥有工作区资源的所有者角色。
- 你能够以组的形式组织、管理和撤销用户对工作区和其他资源的权限,而无需逐一管理每个用户的权限。
若要使用 Microsoft Entra 安全组,请执行以下操作:
- 创建一个安全组。
- 添加组所有者。 此用户有权添加或删除组成员。 组所有者不必是组成员,也不必在工作区中拥有直接 RBAC 角色。
- 为该组分配工作区中的 RBAC 角色,例如 AzureML 数据科学家、读取者或参与者。
- 添加组成员。 成员可取得工作区的访问权限。
创建自定义角色
如果内置角色不符合你的需求,请创建自定义角色。 自定义角色可以在该工作区中具有读取、写入、删除和计算资源权限。 可以使角色在特定工作区级别、特定资源组级别或特定订阅级别可用。
注意
若要在资源中创建自定义角色,你必须是该级别的资源的所有者。
要创建自定义角色,请首先构造角色定义 JSON 文件,指定角色的权限和作用域。 以下示例定义了“Data Scientist Custom”自定义角色,其作用域为特定工作区级别:
data_scientist_custom_role.json :
{
"Name": "Data Scientist Custom",
"IsCustom": true,
"Description": "Can run experiment but can't create or delete compute.",
"Actions": ["*"],
"NotActions": [
"Microsoft.MachineLearningServices/workspaces/*/delete",
"Microsoft.MachineLearningServices/workspaces/write",
"Microsoft.MachineLearningServices/workspaces/computes/*/write",
"Microsoft.MachineLearningServices/workspaces/computes/*/delete",
"Microsoft.Authorization/*/write"
],
"AssignableScopes": [
"/subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.MachineLearningServices/workspaces/<workspaceName>"
]
}
提示
可以更改 AssignableScopes 字段,以在订阅级别、资源组级别或特定工作区级别设置此自定义角色的作用域。
以前的自定义角色只是一个示例。 有关更多示例,请参阅 Azure 机器学习服务的一些建议自定义角色。
此自定义角色可以在工作区中执行除以下操作之外的所有操作:
- 无法删除工作区。
- 它无法创建或更新工作区。
- 它无法创建或更新计算资源。
- 它无法删除计算资源。
- 不能添加、删除或更改角色分配。
要部署此自定义角色,请使用以下 Azure CLI 命令:
az role definition create --role-definition data_scientist_custom_role.json
部署后,此角色在指定的工作区中可用。 现在,可以在 Azure 门户中添加和分配此角色。
有关自定义角色的详细信息,请参阅 Azure 自定义角色。
Azure 机器学习操作
有关可用于自定义角色的操作(包括操作和非操作)的详细信息,请参阅 资源提供程序操作。 还可以使用以下 Azure CLI 命令来列出操作:
az provider operation show –n Microsoft.MachineLearningServices
列出自定义角色
在 Azure CLI 中运行以下命令:
az role definition list --subscription <subscriptionId> --custom-role-only true
若要查看特定自定义角色的角色定义,请使用以下 Azure CLI 命令。
<roleName> 的格式应与上一命令返回的格式相同:
az role definition list -n <roleName> --subscription <subscriptionId>
更新自定义角色
在 Azure CLI 中运行以下命令:
az role definition update --role-definition update_def.json --subscription <subscriptionId>
你需要对新角色定义的全部范围拥有权限。 例如,如果此新角色具有跨三个订阅的范围,则需要对所有三个订阅拥有权限。
注意
角色更新可能需要花费 15 分钟到一小时才能应用于该作用域中的所有角色分配。
使用 Azure 资源管理器模板实现可重复性
如果预计需要重新创建复杂的角色分配,则使用 Azure 资源管理器模板可能会很有帮助。 机器学习依赖项-角色分配模板演示如何在源代码中指定角色分配以供重复使用。
常见方案
下表总结了 Azure 机器学习活动以及至少执行这些活动所需的权限。 例如,如果某个活动可以在工作区范围(第 4 列)内执行,那么具有该权限的所有更高级别的范围将自动适用。 对于某些活动,权限在 V1 API 和 V2 API 之间有所不同。
重要
此表中所有以/开头的路径都是
| 活动 | 订阅级作用域 | 资源组级作用域 | 工作区级作用域 |
|---|---|---|---|
| 创建新工作区 1 | 不是必需 | 允许的所有者、参与者或自定义角色:Microsoft.Resources/deployments/*、Microsoft.MachineLearningServices/workspaces/write 和依赖资源的写入权限(请参阅下面的第 3 点) |
不适用(在创建后成为所有者或继承更高作用域角色) |
| 请求订阅级别 Amlcompute 配额或设置工作区级别配额 | 所有者、参与者或自定义角色 允许 /locations/updateQuotas/action(在订阅范围内) |
未授权 | 未授权 |
| 新建计算群集 | 不是必需 | 不是必需 | 所有者、参与者或自定义角色允许:/workspaces/computes/write |
| 新建计算实例 | 不是必需 | 不是必需 | 所有者、参与者或自定义角色允许:/workspaces/computes/write |
| 提交任何类型的运行 (V1) | 不是必需 | 不是必需 | 所有者、贡献者或允许的自定义角色:/workspaces/*/read、/workspaces/environments/write、/workspaces/experiments/runs/write、/workspaces/metadata/artifacts/write、/workspaces/metadata/snapshots/write、/workspaces/environments/build/action、/workspaces/experiments/runs/submit/action、/workspaces/environments/readSecrets/action |
| 提交任何类型的运行 (V2) | 不是必需 | 不是必需 | 允许 /workspaces/*/read、/workspaces/environments/write、/workspaces/jobs/*、/workspaces/metadata/artifacts/write、/workspaces/environments/build/action、/workspaces/environments/readSecrets/action 的所有者、参与者或自定义角色 |
| 发布管道和终结点 (V1) | 不是必需 | 不是必需 | 所有者、参与者或自定义角色允许:/workspaces/endpoints/pipelines/*、/workspaces/pipelinedrafts/*、/workspaces/modules/* |
| 发布管道和终结点 (V2) | 不是必需 | 不是必需 | 所有者、参与者或自定义角色允许:/workspaces/endpoints/pipelines/*、/workspaces/pipelinedrafts/*、/workspaces/components/* |
| 附加 AKS 资源 2 | 不是必需 | 包含 AKS 的资源组的所有者或贡献者 | |
| 在 AKS/ACI 资源上部署已注册的模型 | 不是必需 | 不是必需 | 所有者、参与者或自定义角色允许:/workspaces/services/aks/write、/workspaces/services/aci/write |
| 针对已部署的 AKS 终结点进行评分 | 不是必需 | 不是必需 | 所有者、参与者或自定义角色允许:/workspaces/services/aks/score/action、/workspaces/services/aks/listkeys/action(未使用 Microsoft Entra 身份验证时)或 /workspaces/read(使用令牌身份验证时) |
| 使用交互式笔记本访问存储 | 不是必需 | 不是必需 | 所有者、参与者或自定义角色允许:/workspaces/computes/read、/workspaces/notebooks/samples/read、/workspaces/notebooks/storage/*、/workspaces/listStorageAccountKeys/action、/workspaces/listNotebookAccessToken/read |
| 创建新的自定义角色 | 所有者、参与者或自定义角色允许 Microsoft.Authorization/roleDefinitions/write |
不是必需 | 所有者、参与者或自定义角色允许:/workspaces/computes/write |
| 创建/管理联机终结点和部署 | 不是必需 | 若要在工作室上部署,Microsoft.Resources/deployments/write |
所有者、参与者或自定义角色允许 Microsoft.MachineLearningServices/workspaces/onlineEndpoints/*。 |
| 检索联机终结点的身份验证凭据 | 不是必需 | 不是必需 | 所有者、参与者或自定义角色允许 Microsoft.MachineLearningServices/workspaces/onlineEndpoints/token/action 和 Microsoft.MachineLearningServices/workspaces/onlineEndpoints/listKeys/action |
如果您第一次尝试创建工作区时遭遇失败,请确保您的角色允许
Microsoft.MachineLearningServices/register/action。 可以通过此操作将 Azure 机器学习资源提供程序注册到 Azure 订阅。附加 AKS 群集时,您还需要在群集中拥有 Azure Kubernetes 服务群集管理员角色。
这些方案不包括创建工作区依赖资源所需的权限。 有关详细信息,请参阅 存储、 OperationalInsights、 Key Vault 和 容器注册表的写入权限。
附加用户管理的标识时,还需要对标识具有
Microsoft.ManagedIdentity/userAssignedIdentities/assign/action权限。 有关详细信息,请参阅用于标识的 Azure 内置角色。指定无服务器计算自定义子网时,您还需要确保虚拟网络上存在
Microsoft.Network/virtualNetworks/subnets/join/action。 有关详细信息,请参阅 Azure 网络权限。
部署到虚拟网络或子网
若要将资源部署到虚拟网络或子网中,你的用户帐户必须在 Azure 基于角色的访问控制 (Azure RBAC) 中具有以下操作的权限:
- “Microsoft.Network/*/read”(在虚拟网络资源上)。 对于 Azure 资源管理器 (ARM) 模板部署,不需要此权限。
- “Microsoft.Network/virtualNetworks/join/action”(在虚拟网络资源上)。
- “Microsoft.Network/virtualNetworks/subnets/join/action”(在子网资源上)。
若要详细了解如何将 Azure RBAC 与网络配合使用,请参阅网络内置角色
V1 API 和 V2 API 的操作之间的差异
V1 API 和 V2 API 的操作之间存在某些差异。
| 资产 | V1 API 的操作路径 | V2 API 的操作路径 |
|---|---|---|
| 数据集 | Microsoft.MachineLearningServices/workspaces/datasets | Microsoft.MachineLearningServices/workspaces/datasets/versions |
| 试验运行和作业 | 微软.机器学习服务/工作区/实验 | Microsoft.MachineLearningServices/workspaces/jobs |
| 模型 | 微软.机器学习服务/工作空间/模型 | Microsoft.MachineLearningServices/workspaces/models/versions |
| 模块和组件 | Microsoft.MachineLearningServices/workspaces/modules | Microsoft.MachineLearningServices/workspaces/components |
可以通过包括这两个作或使用包含这两个作的通配符(例如 Microsoft.MachineLearningServices/workspaces/datasets/*/read)使自定义角色与 V1 和 V2 API 兼容。
创建使用客户管理的密钥的工作区
使用客户管理的密钥(CMK)时,Azure Key Vault 会存储密钥。 用于创建工作区的用户或服务主体必须具备对密钥保管库的所有者或贡献者访问权限。
如果使用 用户分配的托管标识配置工作区,请向标识授予以下角色。 使用客户管理的密钥时,这些角色允许托管标识创建 Azure 存储、Azure Cosmos DB 和 Azure 搜索资源:
Microsoft.Storage/storageAccounts/writeMicrosoft.Search/searchServices/writeMicrosoft.DocumentDB/databaseAccounts/write
在密钥保管库中,用户或服务主体必须通过密钥保管库访问策略获取对密钥的创建、获取、删除和清除访问权限。 有关详细信息,请参阅 Azure Key Vault 安全性。
用于 Azure 机器学习计算群集的用户分配的托管标识
若要为 Azure 机器学习计算群集分配用户分配的标识,需要有写入权限来创建该计算,并且需要托管标识操作员角色。 有关使用托管标识的 Azure RBAC 的详细信息,请参阅 如何管理用户分配的标识。
MLflow 操作
若要在 Azure 机器学习工作区中执行 MLflow 操作,请在自定义角色中使用以下权限范围:
| MLflow 操作 | Scope |
|---|---|
| (V1) 列出、读取、创建、更新或删除试验 | Microsoft.MachineLearningServices/workspaces/experiments/* |
| (V2) 列出、读取、创建、更新或删除作业 | Microsoft.MachineLearningServices/workspaces/jobs/* |
| 按名称获取已注册的模型,获取注册表中所有已注册模型的列表,搜索每个请求阶段的已注册模型、最新版模型,获取已注册模型的版本,搜索模型版本,获取 URI(其中存储了模型版本的项目),按试验 ID 搜索运行 | Microsoft.MachineLearningServices/workspaces/models/*/read |
| 创建新的已注册模型,更新已注册模型的名称或说明,重命名现有注册模型,创建新版本的模型,更新模型版本的说明,将已注册的模型转换为其中一个阶段 | Microsoft.MachineLearningServices/workspaces/models/*/write |
| 删除已注册的模型及其所有版本,删除已注册模型的特定版本 | Microsoft.MachineLearningServices/workspaces/models/*/delete |
自定义角色示例
数据科学家
使用此角色授予数据科学家执行工作区中的所有作的权限, 但以下情况除外:
- 创建计算资源。
- 将模型部署到生产 AKS 群集。
- 在生产环境中部署管道端点。
data_scientist_custom_role.json :
{
"Name": "Data Scientist Custom",
"IsCustom": true,
"Description": "Can run experiment but can't create or delete compute or deploy production endpoints.",
"Actions": [
"Microsoft.MachineLearningServices/workspaces/*/read",
"Microsoft.MachineLearningServices/workspaces/*/action",
"Microsoft.MachineLearningServices/workspaces/*/delete",
"Microsoft.MachineLearningServices/workspaces/*/write"
],
"NotActions": [
"Microsoft.MachineLearningServices/workspaces/delete",
"Microsoft.MachineLearningServices/workspaces/write",
"Microsoft.MachineLearningServices/workspaces/computes/*/write",
"Microsoft.MachineLearningServices/workspaces/computes/*/delete",
"Microsoft.Authorization/*",
"Microsoft.MachineLearningServices/workspaces/computes/listKeys/action",
"Microsoft.MachineLearningServices/workspaces/listKeys/action",
"Microsoft.MachineLearningServices/workspaces/services/aks/write",
"Microsoft.MachineLearningServices/workspaces/services/aks/delete",
"Microsoft.MachineLearningServices/workspaces/endpoints/pipelines/write"
],
"AssignableScopes": [
"/subscriptions/<subscriptionId>"
]
}
受限制的数据科学家
使用此角色可以授予更受限的角色定义,并且在允许的操作中不使用通配符。 它可以在工作区中执行所有操作,但以下操作除外:
- 创建计算资源。
- 将模型部署到生产 AKS 群集。
- 在生产环境中部署管道端点。
data_scientist_restricted_custom_role.json :
{
"Name": "Data Scientist Restricted Custom",
"IsCustom": true,
"Description": "Can run experiment but can't create or delete compute or deploy production endpoints",
"Actions": [
"Microsoft.MachineLearningServices/workspaces/*/read",
"Microsoft.MachineLearningServices/workspaces/computes/start/action",
"Microsoft.MachineLearningServices/workspaces/computes/stop/action",
"Microsoft.MachineLearningServices/workspaces/computes/restart/action",
"Microsoft.MachineLearningServices/workspaces/computes/applicationaccess/action",
"Microsoft.MachineLearningServices/workspaces/notebooks/storage/write",
"Microsoft.MachineLearningServices/workspaces/notebooks/storage/delete",
"Microsoft.MachineLearningServices/workspaces/experiments/runs/write",
"Microsoft.MachineLearningServices/workspaces/experiments/write",
"Microsoft.MachineLearningServices/workspaces/experiments/runs/submit/action",
"Microsoft.MachineLearningServices/workspaces/pipelinedrafts/write",
"Microsoft.MachineLearningServices/workspaces/metadata/snapshots/write",
"Microsoft.MachineLearningServices/workspaces/metadata/artifacts/write",
"Microsoft.MachineLearningServices/workspaces/environments/write",
"Microsoft.MachineLearningServices/workspaces/models/*/write",
"Microsoft.MachineLearningServices/workspaces/modules/write",
"Microsoft.MachineLearningServices/workspaces/components/*/write",
"Microsoft.MachineLearningServices/workspaces/datasets/*/write",
"Microsoft.MachineLearningServices/workspaces/datasets/*/delete",
"Microsoft.MachineLearningServices/workspaces/computes/listNodes/action",
"Microsoft.MachineLearningServices/workspaces/environments/build/action"
],
"NotActions": [
"Microsoft.MachineLearningServices/workspaces/computes/write",
"Microsoft.MachineLearningServices/workspaces/write",
"Microsoft.MachineLearningServices/workspaces/computes/delete",
"Microsoft.MachineLearningServices/workspaces/delete",
"Microsoft.MachineLearningServices/workspaces/computes/listKeys/action",
"Microsoft.MachineLearningServices/workspaces/connections/listsecrets/action",
"Microsoft.MachineLearningServices/workspaces/listKeys/action",
"Microsoft.Authorization/*",
"Microsoft.MachineLearningServices/workspaces/datasets/registered/profile/read",
"Microsoft.MachineLearningServices/workspaces/datasets/registered/preview/read",
"Microsoft.MachineLearningServices/workspaces/datasets/unregistered/profile/read",
"Microsoft.MachineLearningServices/workspaces/datasets/unregistered/preview/read",
"Microsoft.MachineLearningServices/workspaces/datasets/registered/schema/read",
"Microsoft.MachineLearningServices/workspaces/datasets/unregistered/schema/read",
"Microsoft.MachineLearningServices/workspaces/datastores/write",
"Microsoft.MachineLearningServices/workspaces/datastores/delete"
],
"AssignableScopes": [
"/subscriptions/<subscriptionId>"
]
}
MLflow 数据科学家
使用此角色执行所有 MLflow Azure 机器学习支持的操作:但以下操作除外:
- 创建计算资源。
- 将模型部署到生产 AKS 群集。
- 在生产环境中部署管道端点。
mlflow_data_scientist_custom_role.json:
{
"Name": "MLFlow Data Scientist Custom",
"IsCustom": true,
"Description": "Can perform azureml mlflow integrated functionalities that includes mlflow tracking, projects, model registry",
"Actions": [
"Microsoft.MachineLearningServices/workspaces/experiments/*",
"Microsoft.MachineLearningServices/workspaces/jobs/*",
"Microsoft.MachineLearningServices/workspaces/models/*"
],
"NotActions": [
"Microsoft.MachineLearningServices/workspaces/delete",
"Microsoft.MachineLearningServices/workspaces/write",
"Microsoft.MachineLearningServices/workspaces/computes/*/write",
"Microsoft.MachineLearningServices/workspaces/computes/*/delete",
"Microsoft.Authorization/*",
"Microsoft.MachineLearningServices/workspaces/computes/listKeys/action",
"Microsoft.MachineLearningServices/workspaces/listKeys/action",
"Microsoft.MachineLearningServices/workspaces/services/aks/write",
"Microsoft.MachineLearningServices/workspaces/services/aks/delete",
"Microsoft.MachineLearningServices/workspaces/endpoints/pipelines/write"
],
"AssignableScopes": [
"/subscriptions/<subscriptionId>"
]
}
MLOps
将此角色分配给服务主体(service principal),以实现 MLOps 流程的自动化。 例如,使用它针对已发布的管道提交运行:
mlops_custom_role.json :
{
"Name": "MLOps Custom",
"IsCustom": true,
"Description": "Can run pipelines against a published pipeline endpoint",
"Actions": [
"Microsoft.MachineLearningServices/workspaces/read",
"Microsoft.MachineLearningServices/workspaces/endpoints/pipelines/read",
"Microsoft.MachineLearningServices/workspaces/metadata/artifacts/read",
"Microsoft.MachineLearningServices/workspaces/metadata/snapshots/read",
"Microsoft.MachineLearningServices/workspaces/environments/read",
"Microsoft.MachineLearningServices/workspaces/metadata/secrets/read",
"Microsoft.MachineLearningServices/workspaces/modules/read",
"Microsoft.MachineLearningServices/workspaces/components/read",
"Microsoft.MachineLearningServices/workspaces/datasets/*/read",
"Microsoft.MachineLearningServices/workspaces/datastores/read",
"Microsoft.MachineLearningServices/workspaces/environments/write",
"Microsoft.MachineLearningServices/workspaces/experiments/runs/read",
"Microsoft.MachineLearningServices/workspaces/experiments/runs/write",
"Microsoft.MachineLearningServices/workspaces/experiments/runs/submit/action",
"Microsoft.MachineLearningServices/workspaces/experiments/jobs/read",
"Microsoft.MachineLearningServices/workspaces/experiments/jobs/write",
"Microsoft.MachineLearningServices/workspaces/metadata/artifacts/write",
"Microsoft.MachineLearningServices/workspaces/metadata/snapshots/write",
"Microsoft.MachineLearningServices/workspaces/environments/build/action",
],
"NotActions": [
"Microsoft.MachineLearningServices/workspaces/computes/write",
"Microsoft.MachineLearningServices/workspaces/write",
"Microsoft.MachineLearningServices/workspaces/computes/delete",
"Microsoft.MachineLearningServices/workspaces/delete",
"Microsoft.MachineLearningServices/workspaces/computes/listKeys/action",
"Microsoft.MachineLearningServices/workspaces/listKeys/action",
"Microsoft.Authorization/*"
],
"AssignableScopes": [
"/subscriptions/<subscriptionId>"
]
}
工作区管理员
使用此角色可在工作区范围内执行所有操作,但不包括以下情况:
- 创建一个新工作区
- 分配订阅或工作区级别配额
工作区管理员无法创建新角色。 而只能在其工作区的范围内分配现有内置角色或自定义角色:
workspace_admin_custom_role.json :
{
"Name": "Workspace Admin Custom",
"IsCustom": true,
"Description": "Can perform all operations except quota management and upgrades",
"Actions": [
"Microsoft.MachineLearningServices/workspaces/*/read",
"Microsoft.MachineLearningServices/workspaces/*/action",
"Microsoft.MachineLearningServices/workspaces/*/write",
"Microsoft.MachineLearningServices/workspaces/*/delete",
"Microsoft.Authorization/roleAssignments/*"
],
"NotActions": [
"Microsoft.MachineLearningServices/workspaces/write"
],
"AssignableScopes": [
"/subscriptions/<subscriptionId>"
]
}
数据标记
Azure 为仅限标记数据的数据标记提供内置角色。 以下自定义角色提供了数据标记项目的其他级别访问权限。
标记团队主管会允许你审阅和拒绝已标记的数据集并查看标记见解。 除此之外,此角色还允许执行标记者的任务。
labeling_team_lead_custom_role.json:
{
"Name": "Labeling Team Lead",
"IsCustom": true,
"Description": "Team lead for Labeling Projects",
"Actions": [
"Microsoft.MachineLearningServices/workspaces/read",
"Microsoft.MachineLearningServices/workspaces/labeling/labels/read",
"Microsoft.MachineLearningServices/workspaces/labeling/labels/write",
"Microsoft.MachineLearningServices/workspaces/labeling/labels/reject/action",
"Microsoft.MachineLearningServices/workspaces/labeling/labels/update/action",
"Microsoft.MachineLearningServices/workspaces/labeling/projects/read",
"Microsoft.MachineLearningServices/workspaces/labeling/projects/summary/read"
],
"NotActions": [
"Microsoft.MachineLearningServices/workspaces/labeling/projects/write",
"Microsoft.MachineLearningServices/workspaces/labeling/projects/delete",
"Microsoft.MachineLearningServices/workspaces/labeling/export/action"
],
"AssignableScopes": [
"/subscriptions/<subscriptionId>"
]
}
故障排除
使用 Azure RBAC 时请注意以下几点:
你在 Azure 中创建资源(例如工作区)时,并不会直接成为该资源的所有者。 您将从订阅中授予您权限的最高级别角色继承角色。 例如,如果你是网络管理员并且有权创建机器学习工作区,则会针对该工作区分配 网络管理员 角色,而不是“ 所有者” 角色。
若要在工作区中执行配额操作,需要订阅级别的权限。 此要求意味着只有订阅范围内具有写入权限的用户才能为托管计算资源设置订阅级别配额或工作区级别配额。
若要在工作室上进行部署,需要
Microsoft.Resources/deployments/write和Microsoft.MachineLearningServices/workspaces/onlineEndpoints/deployments/write。 对于 SDK/CLI 部署,你需要Microsoft.MachineLearningServices/workspaces/onlineEndpoints/deployments/write。 请与工作区或资源组所有者联系以获取其他权限。如果对同一 Microsoft Entra 用户分配了两个角色,并且这两个角色的 Actions 和 NotActions 存在冲突,那么如果一个角色中的 NotActions 所列出的操作在另一个角色中也被列为 Actions,这些操作可能不会生效。 若要详细了解 Azure 如何分析角色分配,请参阅 Azure RBAC 如何确定用户是否有权访问资源。
新的角色分配最多可能需要一小时才能在整个堆栈的缓存权限中生效。