你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

禁用 Microsoft Foundry 中的预览功能

限制 Microsoft Foundry 中的预览功能,使生产环境专注于正式版功能。 本文介绍两种方法:

  • Azure标签隐藏 Foundry 门户(当前门户和经典门户)中的预览界面。
  • 自定义 RBAC 角色 阻止 API 级别的特定预览操作。

使用标记进行门户级抑制,并在需要阻止特定操作或权限时使用自定义 RBAC 角色。

先决条件

  • Foundry 平台的资源和项目。
  • 在Azure的目标范围内添加或编辑标记的权限。 例如 参与者标记参与者
  • Azure订阅,有权在希望分配角色的范围创建自定义角色(例如所有者角色或用户访问管理员角色)。
  • 在分配访问权限的作用域中分配角色所需的权限(例如“基于角色的访问控制管理员”角色或“用户访问管理员”角色)。
  • 如果从命令行创建角色,则已安装并登录 Azure CLI。 有关详细信息,请参阅 install Azure CLI
  • 访问 Azure 门户

应用标记

在组织所治理的范围内应用预览功能抑制标记。

重要

使用准确的标签键和值:

  • 标记键: AZML_DISABLE_PREVIEW_FEATURE
  • 标记值: true

在符合治理需求的范围应用标记:

  • 组织范围的治理订阅
  • 资源组覆盖组中所有的资源。
  • 用于精细控制的 Foundry 资源

<resource-id> 替换为订阅、资源组或 Foundry 资源的完整资源 ID。

az tag update --resource-id <resource-id> --operation merge --tags AZML_DISABLE_PREVIEW_FEATURE=true

若要查找 Foundry 资源的资源 ID,请执行以下操作:

az resource show --name <resource-name> --resource-group <resource-group> --resource-type "Microsoft.CognitiveServices/accounts" --query id --output tsv

删除标记以重新启用预览功能

若要还原预览功能,请删除 AZML_DISABLE_PREVIEW_FEATURE 标记。

az tag update --resource-id <resource-id> --operation delete --tags AZML_DISABLE_PREVIEW_FEATURE=true

删除标记后,刷新 Foundry 门户或注销并重新登录。 预览功能在几分钟内再次出现。

验证两个门户体验中的抑制

保存标记后,允许几分钟进行传播,然后验证这两种体验中的行为。

  1. 打开 Microsoft Foundry
  2. 打开标记的项目。
  3. 验证是否隐藏了仅限预览的 UI 功能。
    • 在经典门户中,右上角的预览功能工具处于禁用状态。
    • 在新门户中,不会看到任何 预览 标签,因为预览中的功能将不再可见。
  4. 使用 New Foundry 在新的体验和经典体验之间切换,并验证相同的行为。

预期结果:预览功能隐藏在新的和经典 Foundry 门户体验中。

排查抑制问题

当抑制不按预期运行时,请使用下表。

症状 原因 分辨率
应用标记后仍会显示预览功能。 标记键或值不正确。 验证标记键是否为AZML_DISABLE_PREVIEW_FEATURE且值为true(区分大小写)。 再次保存标记。
标记已应用,但仅部分范围被抑制。 标记的应用范围比起预期更窄。 确认标记应用于预期的治理范围(订阅、资源组或资源)。 如果需要,请在更广泛的范围内应用它。
几分钟后,预览功能再次出现。 浏览器会话使用缓存状态。 注销并重新登录,或清除浏览器缓存并刷新 Foundry 门户。
无法添加或编辑标记。 您的帐户在该范围内缺少标签权限。 验证你在目标范围内是否具有参与者标记参与者角色。
在验证范围、标记和权限后,预览功能仍会显示。 可能存在传播延迟或产品缺陷。 等待几分钟进行传播。 如果问题仍然存在,请提交支持请求。

使用自定义 RBAC 角色阻止预览功能

你可以通过创建自定义Azure角色来阻止访问特定预览功能,该角色排除了相应的权限,然后将该角色分配给用户。

由于无法修改内置角色,因此创建一个 自定义角色 ,该角色使用 notDataActions (或 notActions 用于跟踪等控制平面功能)来排除要阻止的权限。

下表汇总了可以阻止的预览功能以及要排除的权限类型。

预览功能 资源提供程序路径 权限类型 排除字段
代理服务 Microsoft.CognitiveServices/accounts/AIServices/agents/* 数据操作 notDataActions
内容理解 Microsoft.CognitiveServices/accounts/MultiModalIntelligence/* 数据操作 notDataActions
微调 Microsoft.CognitiveServices/accounts/OpenAI/fine-tunes/* 和相关路径 数据操作 notDataActions
评估 Microsoft.CognitiveServices/accounts/AIServices/evaluations/* 数据操作 notDataActions
内容安全 Microsoft.CognitiveServices/accounts/ContentSafety/* 数据操作 notDataActions
跟踪 Microsoft.Insights/* 控制平面操作 notActions

创建阻止预览功能的自定义角色

本部分介绍如何创建自定义角色定义并将其分配给用户。 该示例阻止代理服务,但可以替换本文 功能部分中 的任何数据操作。

步骤 1:定义角色 JSON

创建包含以下内容的 JSON 文件 custom-role.json 。 将 <subscription-id> 替换为Azure订阅 ID,并将要阻止的数据操作添加到 notDataActions

{
  "properties": {
    "roleName": "Foundry custom role (preview features blocked)",
    "description": "Custom role that excludes specific Foundry preview features.",
    "assignableScopes": [
      "/subscriptions/<subscription-id>"
    ],
    "permissions": [
      {
        "actions": [
          "Microsoft.CognitiveServices/*/read",
          "Microsoft.Authorization/*/read"
        ],
        "notActions": [],
        "dataActions": [
          "Microsoft.CognitiveServices/accounts/AIServices/*"
        ],
        "notDataActions": [
          "Microsoft.CognitiveServices/accounts/AIServices/agents/write",
          "Microsoft.CognitiveServices/accounts/AIServices/agents/read",
          "Microsoft.CognitiveServices/accounts/AIServices/agents/delete"
        ]
      }
    ]
  }
}

提示

如果你克隆了现有角色,或在 dataActions 中使用了通配符权限,请将预览功能的数据操作添加到 notDataActions 中,以便该角色将其排除在外。 对于跟踪,请改为使用 notActions,因为跟踪涉及控制平面操作。

步骤 2:创建角色

az role definition create --role-definition custom-role.json

步骤 3:分配角色

az role assignment create \
    --role "Foundry custom role (preview features blocked)" \
    --assignee "<user-email-or-object-id>" \
    --scope "/subscriptions/<subscription-id>"

步骤 4:验证角色分配

确认自定义角色排除预期权限。

列出用户的角色分配,并验证自定义角色是否显示:

az role assignment list --assignee "<user-email-or-object-id>" --output table

查看自定义角色定义,确认 notDataActions 是否包含预期的数据操作:

az role definition list --name "Foundry custom role (preview features blocked)" --output json

预览功能数据操作

以下每个部分列出了预览功能的权限。 在自定义角色定义中,将你想要阻止的数据操作添加到 notDataActions 中,但“跟踪”除外,因为它在 notActions 中使用的是控制平面操作。

代理服务

将这些数据操作添加到 notDataActions 自定义角色定义中:

  • Microsoft.CognitiveServices/accounts/AIServices/agents/write
  • Microsoft.CognitiveServices/accounts/AIServices/agents/read
  • Microsoft.CognitiveServices/accounts/AIServices/agents/delete

若要使用单个条目阻止所有代理服务操作,请使用通配符 Microsoft.CognitiveServices/accounts/AIServices/agents/*

内容理解

将这些数据操作添加到 notDataActions 自定义角色定义中:

  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/analyzers/read
  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/analyzers/write
  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/analyzers/delete
  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/classifiers/read
  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/classifiers/write
  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/classifiers/delete
  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/batchAnalysisJobs/*

如果团队在 Foundry 中标记文档,请同时阻止标记数据操作。 在 Azure 门户自定义角色编辑器中,搜索 labelingProjectsMicrosoft.CognitiveServices 资源提供程序下查找可用的操作,例如:

  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/labelingProjects/read
  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/labelingProjects/write
  • Microsoft.CognitiveServices/accounts/MultiModalIntelligence/labelingProjects/delete

注意

核实 Azure 门户中的具体 labelingProjects 数据操作,因为可用操作可能会随功能的变化而更改。

微调

微调在 Microsoft.CognitiveServices/accounts/OpenAI/ 下使用多个数据操作路径。 在自定义角色定义中,将您要阻止的每个路径添加到 notDataActions

  • Microsoft.CognitiveServices/accounts/OpenAI/fine-tunes/*
  • Microsoft.CognitiveServices/accounts/OpenAI/files/*
  • Microsoft.CognitiveServices/accounts/OpenAI/uploads/*
  • Microsoft.CognitiveServices/accounts/OpenAI/stored-completions/*
  • Microsoft.CognitiveServices/accounts/OpenAI/evals/*
  • Microsoft.CognitiveServices/accounts/OpenAI/models/*

(可选)如果你的团队运行 RLHF 任务,则进一步添加:

  • Microsoft.CognitiveServices/accounts/OpenAI/1p-jobs/*

重要

列出的每个路径都是单独的数据操作范围。 fine-tunes/*通配符仅匹配下面的fine-tunes/操作。 若要完全阻止微调,请包含列出的所有路径。

跟踪

重要

跟踪功能使用的是 Azure Monitor,这是一项控制平面服务。 本节中列出的权限是 操作,而不是数据操作。 将它们添加到 notActions 自定义角色定义中(而不是 notDataActions)。

将这些操作添加到 notActions 自定义角色定义中:

  • Microsoft.Insights/alertRules/read
  • Microsoft.Insights/diagnosticSettings/read
  • Microsoft.Insights/logDefinitions/read
  • Microsoft.Insights/metricdefinitions/read
  • Microsoft.Insights/metrics/read

阻止这些读取操作可阻止用户在 Foundry 门户中查看“跟踪”窗格。 需要“跟踪”访问权限的用户需要一个单独的角色,该角色需包含 Microsoft.Insights 读取操作,例如在关联的 Application Insights 资源上分配“读取者”角色。

评估

将这些数据操作添加到 notDataActions 自定义角色定义中:

  • Microsoft.CognitiveServices/accounts/AIServices/evaluations/write
  • Microsoft.CognitiveServices/accounts/AIServices/evaluations/read
  • Microsoft.CognitiveServices/accounts/AIServices/evaluations/delete

内容安全

将这些数据操作添加到 notDataActions 自定义角色定义中:

  • Microsoft.CognitiveServices/accounts/ContentSafety/*

若要仅阻止特定的内容安全操作而不是所有操作,请在Azure门户自定义角色编辑器中搜索 ContentSafety,然后选择要排除的单个数据操作。

排查 RBAC 问题

症状 原因 分辨率
用户仍然可以访问阻止的功能。 角色分配可能尚未完成传播,或者该用户还拥有授予被阻止权限的其他角色。 等待几分钟进行传播。 使用 az role assignment list --assignee "<user>" 检查用户的所有角色分配。 移除任何授予被阻止数据操作的冲突角色。
自定义角色创建失败,并出现“无效的数据操作”。 数据操作路径可能拼写错误,或者资源提供程序可能未注册。 验证Azure门户自定义角色编辑器中的数据操作路径。 确保 Microsoft.CognitiveServices 资源提供程序已经在您的订阅中注册。
添加到 notDataActions后不会阻止跟踪权限。 跟踪使用控制平面操作(Microsoft.Insights),而不是数据操作。 Microsoft.Insights 条目从 notDataActions 移动到角色定义中的 notActions