CLI (v2) Azure AI Services connection YAML schema

APPLIES TO: Azure CLI ml extension v2 (current)

Note

The YAML syntax detailed in this document is based on the JSON schema for the latest version of the ML CLI v2 extension. This syntax is guaranteed only to work with the latest version of the ML CLI v2 extension. You can find the schemas for older extension versions at https://azuremlschemasprod.azureedge.net/.

YAML syntax

Key Type Description Allowed values Default value
$schema string The YAML schema. If you use the Azure Machine Learning Visual Studio Code extension to author the YAML file, include $schema at the top of your file to invoke schema and resource completions.
name string Required. The connection name.
description string The connection description.
tags object The connection tag dictionary.
type string Required. The connection type. azure_ai_services azure_ai_services
is_shared boolean true if the connection is shared across other projects in the hub; otherwise, false. true
endpoint string Required. The URL of the endpoint.
api_key string The API key used to authenticate the connection. If not provided, the connection is authenticated via Microsoft Entra ID (credential-less authentication).
ai_services_resource_id string Required. The fully qualified Azure resource ID of the Azure AI Services resource.

Remarks

There are two ways to create connections to Azure AI Services:

  • One connection for all Azure AI Services except Azure AI Search.
  • One connection for each individual Azure AI Service.

The schema described in this article is for one connection for all Azure AI Services except Azure AI Search.

While the az ml connection commands can be used to manage both Azure Machine Learning and Azure AI Foundry connections, the Azure AI Services connection is specific to Azure AI Foundry.

Examples

These examples would be in the form of YAML files and used from the CLI. For example, az ml connection create -f <file-name>.yaml.

YAML: API key

#AzureAIServiceConnection.yml

name: myazai_ei
type: azure_ai_services
endpoint: https://contoso.cognitiveservices.azure.com/
api_key: XXXXXXXXXXXXXXX

YAML: Microsoft Entra ID

#AzureAIServiceConnection.yml

name: myazai_apk
type: azure_ai_services
endpoint: https://contoso.cognitiveservices.azure.com/

Next steps