共用方式為


CLI (v2) 連結的虛擬機 YAML 架構

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

您可以在 找到 https://azuremlschemas.azureedge.net/latest/vmCompute.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 可讓您叫用結構描述和資源完成。
type string 必要。 計算的類型。 virtualmachine
name 字串 必要。 計算的名稱。
description 字串 計算的描述。
resource_id 字串 必要。 要連結至工作區作為計算目標之 Azure 虛擬機的完整資源識別碼。
ssh_settings object 線上到虛擬機的 SSH 設定。
ssh_settings.admin_username 字串 可用來透過 SSH 連線到虛擬機的系統管理員用戶帳戶名稱。
ssh_settings.admin_password 字串 系統管理員用戶帳戶的密碼。 其中一個 admin_passwordssh_private_key_file 是必要的。
ssh_settings.ssh_private_key_file 字串 系統管理員用戶帳戶 SSH 私鑰檔案的本機路徑。 其中一個 admin_passwordssh_private_key_file 是必要的。
ssh_settings.ssh_port 整數 虛擬機上的SSH埠。 22

備註

az ml compute命令可用來管理連結至 Azure 機器學習 工作區的 虛擬機器 (VM)。

範例

範例 GitHub 存放庫中有範例可用。 以下顯示其中幾個。

YAML:基本

$schema: https://azuremlschemas.azureedge.net/latest/vmCompute.schema.json 
name: vm-example
type: virtualmachine
resource_id: /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.Compute/virtualMachines/<VM_NAME>
ssh_settings:
  admin_username: <admin_username>
  admin_password: <admin_password>

下一步