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
In this article, you learn how to add a new connection to [Azure AI Foundry](https://ai.azure.com/?cid=learnDocs) using the Azure Machine Learning SDK.
Connections are a way to authenticate and consume both Microsoft and other resources within your Azure AI Foundry projects. For example, connections can be used for prompt flow, training data, and deployments. [Connections can be created](../../how-to/connections-add.md) exclusively for one project or shared with all projects in the same Azure AI Foundry hub. For more information, see [How to add a new connection in Azure AI Foundry portal](../connections-add.md).
17
+
### Authenticating with Microsoft Entra ID
27
18
28
-
## Prerequisites
29
-
30
-
- An Azure subscription. If you don't have an Azure subscription, create a free account before you begin. Try the [free or paid version of Azure AI Foundry](https://azure.microsoft.com/free/) today.
31
-
- An Azure AI Foundry hub. For information on creating a hub, see [Create Azure AI Foundry Services with the SDK](./create-hub-project-sdk.md).
32
-
- A resource to create a connection to. For example, an AI Services resource. The examples in this article use placeholders that you must replace with your own values when running the code.
There are various authentication methods for the different connection types. When you use Microsoft Entra ID, in addition to creating the connection you might also need to grant Azure role-based access control permissions before the connection can be used. For more information, visit [Role-based access control](../../concepts/rbac-azure-ai-foundry.md#scenario-connections-using-microsoft-entra-id-authentication).
19
+
There are various authentication methods for the different connection types. When you use Microsoft Entra ID, in addition to creating the connection you might also need to grant Azure role-based access control permissions before the connection can be used. For more information, visit [Role-based access control](../concepts/rbac-azure-ai-foundry.md#scenario-connections-using-microsoft-entra-id-authentication).
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.
47
28
48
29
> [!TIP]
49
-
> To connect to Azure OpenAI and more AI services with one connection, you can use the [AI services connection](#azure-ai-services) instead.
30
+
> To connect to Azure OpenAI and more AI services with one connection, you can use the AI services connection instead.
50
31
51
32
```python
52
33
from azure.ai.ml.entities import AzureOpenAIConnection
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.
55
+
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.
75
56
76
57
```python
77
58
from azure.ai.ml.entities import AzureAIServicesConnection
The following example uses the [AzureAISearchConnection](/python/api/azure-ai-ml/azure.ai.ml.entities.azureaisearchconnection) class to create an Azure AI Search connection:
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:
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:
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