@@ -6,7 +6,7 @@ manager: scottpolly
6
6
ms.service : azure-ai-foundry
7
7
ms.custom : build-2024, devx-track-azurecli
8
8
ms.topic : how-to
9
- ms.date : 11/21/2024
9
+ ms.date : 02/13/2025
10
10
ms.reviewer : dantaylo
11
11
ms.author : sgilley
12
12
author : sdgilley
@@ -78,18 +78,26 @@ az ml workspace create --kind hub --resource-group {my_resource_group} --name {m
78
78
79
79
## Create an AI Services connection
80
80
81
- After creating your own AI Services, you can connect it to your hub:
81
+ After creating your own AI Services, you can connect it to your hub.
82
82
83
83
# [ Python SDK] ( #tab/python )
84
84
85
+ First, create a connection to ml_client that includes your hub as the workspace_name:
86
+
87
+ [ !notebook-python[ ] ( ~/azureml-examples-main/sdk/python/resources/connections/connections.ipynb?name=details )]
88
+ [ !notebook-python[ ] ( ~/azureml-examples-main/sdk/python/resources/connections/connections.ipynb?name=ml_client )]
89
+
90
+ Then use ml_client to create the connection to your AI Services:
91
+
85
92
``` python
86
93
from azure.ai.ml.entities import AzureAIServicesConnection
87
94
88
- # constrict an AI Services connection
89
- my_connection_name = " myaiservivce"
90
- my_endpoint = " demo.endpoint" # this could also be called target
95
+ # construct an AI Services connection
96
+ my_connection_name = " myaiservivce" # any name you want
97
+ aiservices_resource_name = < resource_name> # copy from Azure AI Foundry portal
98
+ my_endpoint = " <endpoint>" # copy from Azure AI Foundry portal
91
99
my_api_keys = None # leave blank for Authentication type = AAD
92
- my_ai_services_resource_id = " " # ARM id required
100
+ resource_id = f " /subscriptions/ { subscription_id } /resourceGroups/ { resource_group } /providers/Microsoft.CognitiveServices/accounts/ { aiservices_resource_name } "
93
101
94
102
my_connection = AzureAIServicesConnection(name = my_connection_name,
95
103
endpoint = my_endpoint,
@@ -113,18 +121,22 @@ You can use either an API key or credential-less YAML configuration file. For mo
113
121
``` yml
114
122
name : myazai_ei
115
123
type : azure_ai_services
116
- endpoint : https://contoso.cognitiveservices.azure.com/
124
+ endpoint : <endpoint for your AI Services>
117
125
api_key : XXXXXXXXXXXXXXX
126
+ ai_services_resource_id : <fully_qualified_resource_id>
118
127
` ` `
119
128
120
129
- Credential-less
121
130
122
131
` ` ` yml
123
132
name : myazai_apk
124
133
type : azure_ai_services
125
- endpoint : https://contoso.cognitiveservices.azure.com/
134
+ endpoint : <endpoint for your AI Services>
135
+ ai_services_resource_id : <fully_qualified_resource_id>
126
136
` ` `
127
137
138
+ The <fully_qualified_resource_id> is the resource ID of your AI Services resource. It is in the format ` /subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.CognitiveServices/accounts/{aiservices_resource_name}`.
139
+
128
140
---
129
141
130
142
# # Create an Azure AI Foundry hub using existing dependency resources
0 commit comments