CLI (v2) Azure 容器注册表连接 YAML 架构

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

注意

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

YAML 语法

密钥 类型 说明 允许的值 默认值
$schema 字符串 YAML 架构。 如果使用 Azure 机器学习 Visual Studio Code 扩展来创作 YAML 文件,请在该文件的顶部添加 $schema 以调用架构和资源完成。
name 字符串 必需。 连接名称。
description 字符串 连接描述。
tags 物体 连接标记字典。
type 字符串 必需。 连接类型。 container_registry container_registry
is_shared 布尔 如果中心内其他项目共享连接,则为 true;否则,为 false true
target 字符串 端点的 URL。
credentials 物体 基于凭据的身份验证,用于访问存储帐户。 可以使用 Microsoft Entra ID 或用户名和密码。
credentials.type 字符串 要使用的身份验证类型。 managed_identityusername_password
credentials.client_id 字符串 Microsoft Entra ID 客户端 ID。
credentials.resource_id 字符串 Microsoft Entra ID 资源 ID。
credentials_username 字符串 用于身份验证的用户名。
credentials_password 字符串 用于身份验证的密码。

注解

az ml connection虽然命令可用于管理Azure 机器学习和 Azure AI Foundry 连接。

示例

这些示例将以 YAML 文件的形式显示,并通过 CLI 使用。 例如 az ml connection create -f <file-name>.yaml

YAML:Microsoft Entra ID 托管标识

name: test_ws_conn_cr_managed
type: container_registry
target: https://test-feed.com
credentials:
  type: managed_identity
  client_id: client_id
  resource_id: resource_id

YAML:用户名和密码

name: test_ws_conn_cr_user_pass
type: container_registry
target: https://test-feed.com2
credentials:
  type: username_password
  username: contoso
  password: pass

后续步骤