You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/ai-foundry/how-to/develop/connections-add-sdk.md
+19-32Lines changed: 19 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,15 +42,13 @@ There are various authentication methods for the different connection types. Whe
42
42
43
43
## Azure OpenAI in Foundry Models
44
44
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.
46
46
47
47
> [!TIP]
48
48
> To connect to Azure OpenAI and more AI services with one connection, you can use the [AI services connection](#azure-ai-services) instead.
49
49
50
50
```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
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.
79
74
80
75
```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
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:
107
99
108
100
```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
111
102
112
103
name ="my_aisearch_demo_connection"
113
-
target ="https://XXXXXXXXX.search.windows.net"
104
+
target ="https://my.search.windows.net"
114
105
115
106
# Microsoft Entra ID
116
107
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
+
120
109
121
110
wps_connection = AzureAISearchConnection(
122
111
name=name,
@@ -132,11 +121,10 @@ The following example creates an Azure AI Content Safety connection:
132
121
133
122
```python
134
123
from azure.ai.ml.entities import AzureContentSafetyConnection, ApiKeyConfiguration
135
-
from azure.ai.ml.entities import UsernamePasswordConfiguration
The following example creates an Azure Blob Storage connection. This connection is authenticated with an account key or a SAS token:
161
+
The following example uses the [AzureBlobStoreConnection](/python/api/azure-ai-ml/azure.ai.ml.entities.azureblobstoreconnection) class to create an Azure Blob Storage connection. This connection is authenticated with an account key or a SAS token:
174
162
175
163
```python
176
164
from azure.ai.ml.entities import AzureBlobStoreConnection, SasTokenConfiguration,AccountKeyConfiguration
177
-
from azure.ai.ml.entities import UsernamePasswordConfiguration
178
165
179
166
180
167
name ="my_blobstore"
@@ -198,7 +185,7 @@ The following example creates Azure Data Lake Storage Gen 2 connection. This con
198
185
199
186
```python
200
187
from azure.ai.ml.entities import WorkspaceConnection
201
-
from azure.ai.ml.entities importUsernamePasswordConfiguration, ServicePrincipalConfiguration
188
+
from azure.ai.ml.entities import ServicePrincipalConfiguration
The following example creates a Microsoft OneLake connection. This connection is authenticated with a Service Principal:
212
+
The following example uses the [MicrosoftOneLakeWorkspaceConnection](/python/api/azure-ai-ml/azure.ai.ml.entities.microsoftonelakeconnection) class to create a Microsoft OneLake connection. This connection is authenticated with a Service Principal:
226
213
227
214
```python
228
215
from azure.ai.ml.entities import MicrosoftOneLakeWorkspaceConnection, OneLakeArtifact
The following example creates an OpenAI (not Azure OpenAI) connection:
261
+
The following example uses the [OpenAIConnection](/python/api/azure-ai-ml/azure.ai.ml.entities.openaiconnection) class to create an OpenAI (not Azure OpenAI) connection:
0 commit comments