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

CLI (v2) 工作区 YAML 架构

适用于:Azure CLI ml 扩展 v2(当前版)

源 JSON 架构可在 https://azuremlschemas.azureedge.net/latest/workspace.schema.json 中找到。

注意

本文档中详细介绍的 YAML 语法基于最新版本的 ML CLI v2 扩展的 JSON 架构。 此语法必定仅适用于最新版本的 ML CLI v2 扩展。 可以在 https://azuremlschemasprod.azureedge.net/ 上查找早期扩展版本的架构。

YAML 语法

密钥 类型 说明 允许的值 默认值
$schema 字符串 YAML 架构。 如果使用 Azure 机器学习 VS Code 扩展来创作 YAML 文件,则可通过在文件顶部包含 $schema 来调用架构和资源完成操作。
name 字符串 必需。 工作区的名称。
display_name 字符串 工作区在 Studio UI 中的显示名称。 在资源组中可以不唯一。
description 字符串 工作区的说明。
tags object 工作区的标记字典。
location 字符串 工作区的位置。 如果省略此项,则默认为资源组位置。
resource_group 字符串 必需。 包含工作区的资源组。 如果资源组不存在,则将创建一个新的资源组。
hbi_workspace boolean 客户数据是否具有高业务影响 (HBI) ,包含敏感业务信息。 有关详细信息,请参阅数据静态加密 false
storage_account 字符串 要用作工作区默认存储帐户的现有 Azure 存储帐户的完全限定资源 ID。 具有高级存储或分层命名空间的存储帐户不能用作默认存储帐户。 如果省略此项,将创建一个新的存储帐户。
container_registry 字符串 要用作工作区默认容器注册表的现有 Azure 容器注册表的完全限定资源 ID。 Azure 机器学习使用 Azure 容器注册表 (ACR) 来管理用于训练和部署的容器映像。 如果省略此项,将创建一个新的容器注册表。 创建操作为延迟加载,以便在训练或部署操作首次需要时即创建容器注册表。
key_vault 字符串 要用作工作区默认密钥保管库的现有 Azure 密钥保管库的完全限定资源 ID。 如果省略此项,将创建一个新的密钥保管库。
application_insights 字符串 要用作工作区默认应用程序见解的现有 Azure 应用程序见解的完全限定资源 ID。 如果省略此项,将创建新的应用程序见解。
customer_managed_key object Azure 机器学习在 Azure Cosmos DB 实例中存储元数据。 默认情况下,数据使用 Microsoft 托管的密钥进行静态加密。 要使用自己的客户托管密钥进行加密,请在此部分中指定客户托管密钥的信息。 有关详细信息,请参阅 Azure Cosmos DB 的数据加密
customer_managed_key.key_vault 字符串 包含客户托管密钥的密钥保管库完全限定资源 ID。 此密钥保管库可不同于 key_vault 中指定的默认工作区密钥保管库。
customer_managed_key.key_uri 字符串 用于数据静态加密的客户托管密钥 URI。 URI 格式为 https://<keyvault-dns-name>/keys/<key-name>/<key-version>
image_build_compute 字符串 容器注册表位于 VNet 后面时用于构建环境 Docker 映像的计算目标名称。 有关详细信息,请参阅 VNet 后面的安全工作区资源
public_network_access 字符串 如果工作区将使用专用链接,是否允许公共终结点访问。 有关详细信息,请参阅在 VNet 后面时启用公共访问 enabled, disabled disabled
managed_network object Azure 机器学习工作区托管网络隔离。 有关详细信息,请参阅工作区托管网络隔离

备注

az ml workspace 命令可用于管理 Azure 机器学习工作区。

示例

示例 GitHub 存储库中提供了示例。 下面显示了几个示例。

YAML:基本

$schema: https://azuremlschemas.azureedge.net/latest/workspace.schema.json
name: mlw-basic-prod
location: eastus
display_name: Basic workspace-example
description: This example shows a YML configuration for a basic workspace. In case you use this configuration to deploy a new workspace, since no existing dependent resources are specified, these will be automatically created.
hbi_workspace: false
tags:
  purpose: demonstration

YAML:与现有资源配合使用

$schema: https://azuremlschemas.azureedge.net/latest/workspace.schema.json
name: mlw-basicex-prod
location: eastus
display_name: Bring your own dependent resources-example
description: This configuration specifies a workspace configuration with existing dependent resources
storage_account: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Storage/storageAccounts/<STORAGE_ACCOUNT>
container_registry: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.ContainerRegistry/registries/<CONTAINER_REGISTRY>
key_vault: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.KeyVault/vaults/<KEY_VAULT>
application_insights: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.insights/components/<APP_INSIGHTS>
tags:
  purpose: demonstration

YAML:客户托管密钥

$schema: https://azuremlschemas.azureedge.net/latest/workspace.schema.json
name: mlw-cmkexample-prod
location: eastus
display_name: Customer managed key encryption-example
description: This configurations shows how to create a workspace that uses customer-managed keys for encryption.
customer_managed_key: 
  key_vault: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.KeyVault/vaults/<KEY_VAULT>
  key_uri: https://<KEY_VAULT>.vault.azure.net/keys/<KEY_NAME>/<KEY_VERSION>
tags:
  purpose: demonstration
$schema: https://azuremlschemas.azureedge.net/latest/workspace.schema.json
name: mlw-privatelink-prod
location: eastus
display_name: Private Link endpoint workspace-example
description: When using private link, you must set the image_build_compute property to a cluster name to use for Docker image environment building. You can also specify whether the workspace should be accessible over the internet.
image_build_compute: cpu-compute
public_network_access: Disabled
tags:
  purpose: demonstration

YAML:高业务影响

$schema: https://azuremlschemas.azureedge.net/latest/workspace.schema.json
name: mlw-hbiexample-prod
location: eastus
display_name: High business impact-example
description: This configuration shows how to configure a workspace with the hbi flag enabled. This flag specifies whether to reduce telemetry collection and enable additional encryption when high-business-impact data is used.
hbi_workspace: true
tags:
  purpose: demonstration

YAML:允许 Internet 出站的托管网络

name: myworkspace_aio
managed_network:
  isolation_mode: allow_internet_outbound
  outbound_rules:
  - name: added-perule
    type: private_endpoint
    destination:
      service_resource_id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount1
      spark_enabled: true
      subresource_target: blob
  - name: added-perule2
    type: private_endpoint
    destination:
      service_resource_id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount2
      spark_enabled: true
      subresource_target: file

YAML:仅允许已批准的出站的托管网络

name: myworkspace_dep
managed_network:
  isolation_mode: allow_only_approved_outbound
  outbound_rules:
  - name: added-servicetagrule
    type: service_tag
    destination:
      port_ranges: 80, 8080
      protocol: TCP
      service_tag: DataFactory
  - name: added-perule
    type: private_endpoint
    destination:
      service_resource_id: /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyGroup/providers/Microsoft.Storage/storageAccounts/MyAccount2
      spark_enabled: true
      subresource_target: blob
  - name: added-fqdnrule
    type: fqdn
    destination: 'test2.com'

后续步骤