CLI (v2) 工作區 YAML 結構描述

適用於:Azure CLI ml 延伸模組 v2 (目前)

您可以在 https://azuremlschemas.azureedge.net/latest/workspace.schema.json 中找到來源 JSON 結構描述。

注意

此文件中詳述的 YAML 語法是以最新版 ML CLI v2 延伸模組的 JSON 結構描述為基礎。 此語法只保證能與最新版的 ML CLI v2 延伸模組搭配使用。 您可以在 https://azuremlschemasprod.azureedge.net/ 找到舊版延伸模組的結構描述。

YAML 語法

索引鍵 類型 描述 允許的值 預設值
$schema 字串 YAML 結構描述。 如果您使用 Azure Machine Learning VS Code 擴充功能來撰寫 YAML 檔案,在檔案頂端包含 $schema 可讓您叫用結構描述和資源完成。
name 字串 必要。 工作區的名稱。
display_name 字串 工作室 UI 中工作區的顯示名稱。 在資源群組內可能不是唯一的。
description 字串 工作區的描述。
tags object 工作區的標籤字典。
location 字串 工作區的位置。 如果省略,則預設為資源群組位置。
resource_group 字串 必要。 工作區所在的資源群組。 如果資源群組不存在,則會建立新的資源群組。
hbi_workspace boolean 客戶資料是否為高度業務衝擊 (HBI),包含敏感性商務資訊。 如需詳細資訊,請參閱待用資料加密 false
storage_account 字串 現有 Azure 儲存體帳戶 (作為工作區的預設儲存體帳戶) 的完整資源識別碼。 具有進階儲存體或階層命名空間的儲存體帳戶不能作為預設儲存體帳戶。 如果省略,則會建立新的儲存體帳戶。
container_registry 字串 現有 Azure 容器登錄 (作為工作區的預設容器登錄) 的完整資源識別碼。 Azure Machine Learning 會使用 Azure Container Registry (ACR) 來管理用於定型和部署的容器映射。 如果省略,則會建立新的容器登錄。 建立是延後載入,因此,在定型或部署的作業第一次需要容器登錄時,才會建立容器登錄。
key_vault 字串 現有 Azure 金鑰保存庫 (作為工作區的預設金鑰保存庫) 的完整資源識別碼。 如果省略,則會建立新的金鑰保存庫。
application_insights 字串 現有 Azure 應用程式見解 (作為工作區的預設應用程式見解) 的完整資源識別碼。 如果省略,則會建立新的應用程式見解。
customer_managed_key object Azure Machine Learning 將中繼資料儲存在 Azure Cosmos DB 執行個體中。 資料預設以 Microsoft 受控金鑰來待用加密。 若要使用您自己的客戶自控金鑰來加密,請指定本節中的客戶自控金鑰資訊。 如需詳細資訊,請參閱 Azure Cosmos DB 的資料加密
customer_managed_key.key_vault 字串 客戶自控金鑰所在金鑰保存庫的完整資源識別碼。 此金鑰保存庫可能與 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 字串 如果工作區將使用 Private Link,是否允許公用端點存取。 如需詳細資訊,請參閱在 VNet 後方時啟用公用存取 enabled, disabled disabled
managed_network object Azure Machine Learning 工作區受管理的網路隔離。 如需詳細資訊,請參閱工作區受管理的網路隔離

備註

az ml workspace 命令可用來管理 Azure Machine Learning 工作區。

範例

範例 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:允許網際網路輸出的受控網路

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'

後續步驟