共用方式為


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 string YAML 結構描述。 如果您使用 Azure Machine Learning VS Code 擴充功能來撰寫 YAML 檔案,在檔案頂端包含 $schema 可讓您叫用結構描述和資源完成。
name string 必要。 工作區的名稱。
display_name 字串 在 Studio UI 中顯示工作區的名稱。 在資源群組內可以是非唯一的。
description 字串 工作區的描述。
tags object 工作區標籤的字典。
location 字串 工作區的位置。 如果省略,預設為資源群組位置。
resource_group 字串 必要。 包含工作區的資源群組。 如果資源群組不存在,將會建立新的資源群組。
hbi_workspace boolean 客戶數據是否具有高業務影響 (HBI),其中包含敏感性商務資訊。 如需詳細資訊,請參閱 待用數據加密。 false
storage_account 字串 現有 Azure 記憶體帳戶的完整資源識別碼,用來作為工作區的預設記憶體帳戶。 具有進階記憶體或階層命名空間的記憶體帳戶無法做為預設記憶體帳戶。 如果省略,將會建立新的儲存體帳戶。
container_registry 字串 現有 Azure 容器登錄的完整資源識別碼,用來作為工作區的預設容器登錄。 Azure 機器學習 使用 Azure Container Registry (ACR) 來管理用於定型和部署的容器映像。 如果省略,將會建立新的容器登錄。 建立是延遲載入的,因此容器登錄會在第一次需要用於定型或部署的作業時建立。
key_vault 字串 現有 Azure 金鑰保存庫的完整資源識別碼,用來作為工作區的預設密鑰保存庫。 如果省略,將會建立新的密鑰保存庫。
application_insights 字串 現有 Azure Application Insights 的完整資源標識符,用來作為工作區的預設 Application Insights。 如果省略,將會建立新的ApplicationInsights。
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 機器學習 工作區 受管理的網路隔離。 如需詳細資訊,請參閱工作區受管理的網路隔離

備註

命令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:允許因特網輸出的受控網路

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'

下一步