你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
本文介绍如何管理对 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 AI 管理员角色
2024-11-19 之前,为工作区创建的系统分配托管标识会自动获得包含该工作区的资源组的参与者角色。 在此日期之后创建的工作区将系统分配的托管标识分配给 Azure AI 管理员 角色。 此角色的作用域更窄,仅包含托管标识执行其任务所需的最低权限。
Azure AI 管理员角色具有以下权限:
{
"permissions": [
{
"actions": [
"Microsoft.Authorization/*/read",
"Microsoft.CognitiveServices/*",
"Microsoft.ContainerRegistry/registries/*",
"Microsoft.DocumentDb/databaseAccounts/*",
"Microsoft.Features/features/read",
"Microsoft.Features/providers/features/read",
"Microsoft.Features/providers/features/register/action",
"Microsoft.Insights/alertRules/*",
"Microsoft.Insights/components/*",
"Microsoft.Insights/diagnosticSettings/*",
"Microsoft.Insights/generateLiveToken/read",
"Microsoft.Insights/logDefinitions/read",
"Microsoft.Insights/metricAlerts/*",
"Microsoft.Insights/metricdefinitions/read",
"Microsoft.Insights/metrics/read",
"Microsoft.Insights/scheduledqueryrules/*",
"Microsoft.Insights/topology/read",
"Microsoft.Insights/transactions/read",
"Microsoft.Insights/webtests/*",
"Microsoft.KeyVault/*",
"Microsoft.MachineLearningServices/workspaces/*",
"Microsoft.Network/virtualNetworks/subnets/joinViaServiceEndpoint/action",
"Microsoft.ResourceHealth/availabilityStatuses/read",
"Microsoft.Resources/deployments/*",
"Microsoft.Resources/deployments/operations/read",
"Microsoft.Resources/subscriptions/operationresults/read",
"Microsoft.Resources/subscriptions/read",
"Microsoft.Resources/subscriptions/resourcegroups/deployments/*",
"Microsoft.Resources/subscriptions/resourceGroups/read",
"Microsoft.Resources/subscriptions/resourceGroups/write",
"Microsoft.Storage/storageAccounts/*",
"Microsoft.Support/*",
"Microsoft.Search/searchServices/write",
"Microsoft.Search/searchServices/read",
"Microsoft.Search/searchServices/delete",
"Microsoft.Search/searchServices/indexes/*",
"Microsoft.Search/searchServices/listAdminKeys/action",
"Microsoft.Search/searchServices/privateEndpointConnections/*",
"Microsoft.DataFactory/factories/*"
],
"notActions": [],
"dataActions": [],
"notDataActions": []
}
]
}
将现有的系统托管标识转换为 Azure AI 管理员角色
提示
将 2024 年 11 月 19 日之前创建的工作区转换为使用 Azure AI 管理员角色。 Azure AI 管理员角色的范围比参与者角色更窄,并遵循最低特权原则。
若要转换在 2024 年 11 月 19 日之前创建的工作区,请使用以下方法之一:
Azure REST API:向工作区的 Azure REST API 发送
PATCH请求。 将请求正文设置为{"properties":{"allowRoleAssignmentOnRG":true}}. 以下示例展示了使用curl的PATCH请求。 将<your-subscription>、<resource-group-name>、<workspace-name>和<YOUR-ACCESS-TOKEN>替换为你的场景对应的值。 有关使用 REST API 的详细信息,请参阅 Azure REST API 文档。curl -X PATCH \ "https://management.azure.com/subscriptions/<your-subscription>/resourceGroups/<resource-group-name>/providers/Microsoft.MachineLearningServices/workspaces/<workspace-name>?api-version=2024-07-01-preview" \ -H "Authorization: Bearer <YOUR-ACCESS-TOKEN>" \ -H "Content-Type: application/json" \ --data '{"properties":{"allowRoleAssignmentOnRG":true}}'参考: Microsoft.MachineLearningServices/workspaces (2024-07-01-preview)
Azure CLI:使用
az ml workspace update命令并指定--allow-roleassignment-on-rg true参数。 以下示例更新名为myworkspace的工作区。 此命令需要 Azure 机器学习 CLI 扩展版本 2.27.0 或更高版本。az ml workspace update --name myworkspace --allow-roleassignment-on-rg trueAzure Python SDK:将 Workspace 对象的
allow_roleassignment_on_rg属性设置为True,然后执行更新操作。 以下示例更新名为myworkspace的工作区。 此操作需要 Azure 机器学习 SDK 版本 1.17.0 版或更高版本。ws = ml_client.workspaces.get(name="myworkspace") ws.allow_roleassignment_on_rg = True ws = ml_client.workspaces.begin_update(workspace=ws).result()
管理工作区访问权限
如果你是工作区的所有者,则可以为工作区添加和删除角色。 还可以将角色分配给用户。 使用以下链接了解如何管理访问权限:
例如,使用 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 组有助于避免达到角色分配的订阅限制。
要使用 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 之间有所不同。
重要说明
此表中以 / 开头的所有路径都是相对于 的Microsoft.MachineLearningServices/
| 活动 | 订阅级作用域 | 资源组级作用域 | 工作区级作用域 |
|---|---|---|---|
| 创建新工作区 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
将此角色分配给服务主体,以自动化你的 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 用户有两个角色分配,且其“操作”和“非操作”部分存在冲突,那么一个角色的“非操作”中列出的操作如果也在另一个角色的“操作”中列出,可能不会生效。 若要详细了解 Azure 如何分析角色分配,请参阅 Azure RBAC 如何确定用户是否有权访问资源。
新的角色分配最多可能需要一小时才能在整个堆栈的缓存权限中生效。
还原为参与者角色
如果创建新工作区并遇到了 Azure AI 管理员为工作区托管标识分配新的默认角色分配的错误,请执行以下步骤还原为参与者角色:
重要说明
除非遇到问题,否则不要还原为“参与者”角色。 如果还原工作区解决了你遇到的问题,请记录支持事件,说明还原解决的问题,以便产品团队进一步调查。
如果要将参与者角色还原为新工作区 的默认值 ,请使用 Azure 订阅详细信息打开 支持请求 ,并请求将订阅更改为将参与者角色用作新工作区系统分配的托管标识的默认角色。
删除工作区托管标识的角色分配。 此角色分配的范围是包含工作区的 资源组 ,因此必须从资源组中删除该角色。
提示
工作区的系统分配托管标识与工作区名称相同。
在 Azure 门户中,转到包含工作区的 资源组 。 依次选择“访问控制(IAM)”、“角色分配”。 在角色分配列表中,找到托管标识的角色分配。 选择它,然后选择“删除”。
有关删除角色分配的信息,请参阅 “删除角色分配”。
在“资源组”上为“参与者”角色创建新的角色分配。 添加此角色分配时,选择工作区的托管身份作为分配对象。 系统分配的托管标识的名称与工作区名称相同。
- 在 Azure 门户中,转到包含工作区的 资源组 。 依次选择“访问控制(IAM)”、“添加角色分配”
- 在“角色”选项卡上,选择“参与者”。
- 在成员选项卡中,选择托管标识,+ 添加成员,并将托管标识下拉列表设置为Azure 机器学习工作区。 如果工作区是中心工作区,请改为选择 Azure AI 中心。 在“选择”字段中,输入工作区的名称。 从列表中选择工作区,然后选择“选择”。
- 在“查看 + 分配”选项卡上,选择“查看 + 分配”。