Skip to content

Commit 5523a81

Browse files
committed
fixes
1 parent 9cf79d5 commit 5523a81

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

articles/ai-foundry/how-to/develop/connections-add-sdk.md

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ There are various authentication methods for the different connection types. Whe
4242

4343
## Azure OpenAI in Foundry Models
4444

45-
The following example creates an Azure OpenAI in Azure AI Foundry Models connection.
45+
The following example uses the [AzureOpenAIConnection](/python/api/azure-ai-ml/azure.ai.ml.entities.azureopenaiconnection) class to create an Azure OpenAI in Azure AI Foundry Models connection.
4646

4747
> [!TIP]
4848
> To connect to Azure OpenAI and more AI services with one connection, you can use the [AI services connection](#azure-ai-services) instead.
4949
5050
```python
51-
from azure.ai.ml.entities import AzureOpenAIConnection, ApiKeyConfiguration
52-
from azure.ai.ml.entities import UsernamePasswordConfiguration
53-
51+
from azure.ai.ml.entities import AzureOpenAIConnection
5452
name = "XXXXXXXXX"
5553

5654
target = "https://XXXXXXXXX.cognitiveservices.azure.com/"
@@ -59,9 +57,6 @@ resource_id= "Azure-resource-id"
5957

6058
# Microsoft Entra ID
6159
credentials = None
62-
# Uncomment the following if you need to use API key instead
63-
# api_key= "my-key"
64-
# credentials = ApiKeyConfiguration(key=api_key)
6560

6661
wps_connection = AzureOpenAIConnection(
6762
name=name,
@@ -75,22 +70,19 @@ ml_client.connections.create_or_update(wps_connection)
7570

7671
## Azure AI services
7772

78-
The following example creates an Azure AI services connection. This example creates one connection for the AI services documented in the [Connect to Azure AI services](../../../ai-services/connect-services-ai-foundry-portal.md) article. The same connection also supports Azure OpenAI.
73+
The following example uses the [AzureAIServicesConnection](/python/api/azure-ai-ml/azure.ai.ml.entities.azureaiservicesconnection) class to create an Azure AI services connection. This example creates one connection for the AI services documented in the [Connect to Azure AI services](../../../ai-services/connect-services-ai-foundry-portal.md) article. The same connection also supports Azure OpenAI.
7974

8075
```python
81-
from azure.ai.ml.entities import AzureAIServicesConnection, ApiKeyConfiguration
82-
from azure.ai.ml.entities import UsernamePasswordConfiguration
76+
from azure.ai.ml.entities import AzureAIServicesConnection
8377

8478
name = "my-ai-services"
8579

86-
target = "https://XXXXXXXXX.cognitiveservices.azure.com/"
80+
target = "https://my.cognitiveservices.azure.com/"
8781
resource_id=""
8882

8983
# Microsoft Entra ID
9084
credentials = None
91-
# Uncomment the following if you need to use API key instead
92-
# api_key= "my-key"
93-
# credentials = ApiKeyConfiguration(key=api_key)
85+
9486

9587
wps_connection = AzureAIServicesConnection(
9688
name=name,
@@ -103,20 +95,17 @@ ml_client.connections.create_or_update(wps_connection)
10395

10496
## Azure AI Search
10597

106-
The following example creates an Azure AI Search connection:
98+
The following example uses the [AzureAISearchConnection](/python/api/azure-ai-ml/azure.ai.ml.entities.azureaisearchconnection) class to create an Azure AI Search connection:
10799

108100
```python
109-
from azure.ai.ml.entities import AzureAISearchConnection, ApiKeyConfiguration
110-
from azure.ai.ml.entities import UsernamePasswordConfiguration
101+
from azure.ai.ml.entities import AzureAISearchConnection
111102

112103
name = "my_aisearch_demo_connection"
113-
target = "https://XXXXXXXXX.search.windows.net"
104+
target = "https://my.search.windows.net"
114105

115106
# Microsoft Entra ID
116107
credentials = None
117-
# Uncomment the following if you need to use API key instead
118-
# api_key= "my-key"
119-
# credentials = ApiKeyConfiguration(key=api_key)
108+
120109

121110
wps_connection = AzureAISearchConnection(
122111
name=name,
@@ -132,11 +121,10 @@ The following example creates an Azure AI Content Safety connection:
132121

133122
```python
134123
from azure.ai.ml.entities import AzureContentSafetyConnection, ApiKeyConfiguration
135-
from azure.ai.ml.entities import UsernamePasswordConfiguration
136124

137125
name = "my_content_safety"
138126

139-
target = "https://XXXXXXXXX.cognitiveservices.azure.com/"
127+
target = "https://my.cognitiveservices.azure.com/"
140128
api_key = "XXXXXXXXX"
141129

142130
wps_connection = AzureContentSafetyConnection(
@@ -157,7 +145,7 @@ from azure.ai.ml.entities import ServerlessConnection
157145

158146
name = "my_maas_apk"
159147

160-
endpoint = "https://XXXXXXXXX.eastus2.inference.ai.azure.com/"
148+
endpoint = "https://my.eastus2.inference.ai.azure.com/"
161149
api_key = "XXXXXXXXX"
162150
wps_connection = ServerlessConnection(
163151
name=name,
@@ -174,7 +162,6 @@ The following example creates an Azure Blob Storage connection. This connection
174162

175163
```python
176164
from azure.ai.ml.entities import AzureBlobStoreConnection, SasTokenConfiguration,AccountKeyConfiguration
177-
from azure.ai.ml.entities import UsernamePasswordConfiguration
178165

179166

180167
name = "my_blobstore"
@@ -198,7 +185,7 @@ The following example creates Azure Data Lake Storage Gen 2 connection. This con
198185

199186
```python
200187
from azure.ai.ml.entities import WorkspaceConnection
201-
from azure.ai.ml.entities import UsernamePasswordConfiguration, ServicePrincipalConfiguration
188+
from azure.ai.ml.entities import ServicePrincipalConfiguration
202189

203190
sp_config = ServicePrincipalConfiguration(
204191
tenant_id="XXXXXXXXXXXX",
@@ -292,7 +279,7 @@ The following example creates custom connection:
292279

293280
```python
294281
from azure.ai.ml.entities import WorkspaceConnection
295-
from azure.ai.ml.entities import UsernamePasswordConfiguration, ApiKeyConfiguration
282+
from azure.ai.ml.entities import ApiKeyConfiguration
296283

297284

298285
name = "my_custom"

0 commit comments

Comments
 (0)