Skip to content

Commit d90c514

Browse files
authored
Merge pull request #278644 from wchigit/ai-sample
[Service Connector] Integrate with AI services sample code
2 parents 14c099f + 475337e commit d90c514

26 files changed

+1137
-75
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
title: Integrate Azure AI services with service connector
3+
description: In this document, learn how to integrate Azure AI Services into your application with Service Connector
4+
author: wchigit
5+
ms.author: wchi
6+
ms.service: service-connector
7+
ms.topic: how-to
8+
ms.date: 06/14/2024
9+
ms.collection: ce-skilling-ai-copilot
10+
---
11+
12+
# Integrate Azure AI services with Service Connector
13+
14+
This page shows supported authentication methods and clients, and shows sample code you can use to connect Azure AI Services to other cloud services using Service Connector. You might still be able to connect to Azure AI Services using other methods. This page also shows default environment variable names and values you get when you create the service connection.
15+
16+
## Supported compute services
17+
18+
Service Connector can be used to connect the following compute services to Azure AI Services:
19+
20+
- Azure App Service
21+
- Azure Functions
22+
- Azure Container Apps
23+
- Azure Spring Apps
24+
25+
## Supported authentication types and client types
26+
27+
The table below shows which combinations of authentication methods and clients are supported for connecting your compute service to Azure AI Services using Service Connector. A “Yes” indicates that the combination is supported, while a “No” indicates that it is not supported.
28+
29+
30+
| Client type | System-assigned managed identity | User-assigned managed identity | Secret/connection string | Service principal |
31+
|-------------|:--------------------------------:|:------------------------------:|:------------------------:|:-----------------:|
32+
| .NET | Yes | Yes | Yes | Yes |
33+
| Java | Yes | Yes | Yes | Yes |
34+
| Node.js | Yes | Yes | Yes | Yes |
35+
| Python | Yes | Yes | Yes | Yes |
36+
| None | Yes | Yes | Yes | Yes |
37+
38+
This table indicates that all combinations of client types and authentication methods in the table are supported. All client types can use any of the authentication methods to connect to Azure AI Services using Service Connector.
39+
40+
## Default environment variable names or application properties and sample code
41+
42+
Use the connection details below to connect compute services to Azure AI Services. For more information about naming conventions, check the [Service Connector internals](concept-service-connector-internals.md#configuration-naming-convention) article.
43+
44+
### System-assigned managed identity
45+
46+
| Default environment variable name | Description | Sample value |
47+
| --------------------------------- | ---------------------------- | ------------------------------------------------ |
48+
| AZURE_AISERVICES_OPENAI_BASE | Azure OpenAI endpoint | `https://<your-Azure-AI-Services-endpoint>.openai.azure.com/` |
49+
| AZURE_AISERVICES_COGNITIVESERVICES_ENDPOINT | Azure Cognitive Services token provider service | `https://<your-Azure-AI-Services-endpoint>.cognitiveservices.azure.com/` |
50+
| AZURE_AISERVICES_SPEECH_ENDPOINT | Speech to Text (Standard) API endpoint | `https://<location>.stt.speech.microsoft.com` |
51+
52+
#### Sample code
53+
Refer to the steps and code below to connect to Azure AI Services using a system-assigned managed identity.
54+
[!INCLUDE [code sample for app config](./includes/code-ai-services-microsoft-entra-id.md)]
55+
56+
### User-assigned managed identity
57+
58+
| Default environment variable name | Description | Sample value |
59+
| --------------------------------- | -------------------------- | ----------------------------------------------- |
60+
| AZURE_AISERVICES_OPENAI_BASE | Azure OpenAI endpoint | `https://<your-Azure-AI-Services-endpoint>.openai.azure.com/` |
61+
| AZURE_AISERVICES_COGNITIVESERVICES_ENDPOINT | Azure Cognitive Services token provider service | `https://<your-Azure-AI-Services-endpoint>.cognitiveservices.azure.com/` |
62+
| AZURE_AISERVICES_SPEECH_ENDPOINT | Speech to Text (Standard) API endpoint | `https://<location>.stt.speech.microsoft.com` |
63+
| AZURE_AISERVICES_CLIENTID | Your client ID | `<client-ID>` |
64+
65+
#### Sample code
66+
Refer to the steps and code below to connect to Azure AI Services using a user-assigned managed identity.
67+
[!INCLUDE [code sample for azure AI Services](./includes/code-ai-services-microsoft-entra-id.md)]
68+
69+
### Connection string
70+
71+
> [!div class="mx-tdBreakAll"]
72+
> | Default environment variable name | Description | Sample value |
73+
> | --------------------------------- | ------------| ------------ |
74+
> | AZURE_AISERVICES_OPENAI_BASE | Azure OpenAI endpoint | `https://<your-Azure-AI-Services-endpoint>.openai.azure.com/` |
75+
> | AZURE_AISERVICES_COGNITIVESERVICES_ENDPOINT | Azure Cognitive Services token provider service | `https://<your-Azure-AI-Services-endpoint>.cognitiveservices.azure.com/` |
76+
> | AZURE_AISERVICES_SPEECH_ENDPOINT | Speech to Text (Standard) API endpoint | `https://<location>.stt.speech.microsoft.com` |
77+
> | AZURE_AISERVICES_KEY | Azure AI Services API key | `<api-key>` |
78+
79+
#### Sample Code
80+
Refer to the steps and code below to connect to Azure AI Services using a connection string.
81+
[!INCLUDE [code sample for azure AI Services](./includes/code-ai-services-secret.md)]
82+
83+
84+
### Service principal
85+
86+
| Default environment variable name | Description | Sample value |
87+
| ----------------------------------- | -------------------------- | ---------------------------------------------- |
88+
| AZURE_AISERVICES_OPENAI_BASE | Azure OpenAI endpoint | `https://<your-Azure-AI-Services-endpoint>.openai.azure.com/` |
89+
| AZURE_AISERVICES_COGNITIVESERVICES_ENDPOINT | Azure Cognitive Services token provider service | `https://<your-Azure-AI-Services-endpoint>.cognitiveservices.azure.com/` |
90+
| AZURE_AISERVICES_SPEECH_ENDPOINT | Speech to Text (Standard) API endpoint | `https://<location>.stt.speech.microsoft.com` |
91+
| AZURE_AISERVICES_CLIENTID | Your client ID | `<client-ID>` |
92+
| AZURE_AISERVICES_CLIENTSECRET | Your client secret | `<client-secret>` |
93+
| AZURE_AISERVICES_TENANTID | Your tenant ID | `<tenant-ID>` |
94+
95+
#### Sample code
96+
Refer to the steps and code below to connect to Azure AI Services using a service principaL.
97+
[!INCLUDE [code sample for azure AI Services](./includes/code-ai-services-microsoft-entra-id.md)]
98+
99+
## Next steps
100+
101+
Follow the tutorial listed below to learn more about Service Connector.
102+
103+
> [!div class="nextstepaction"]
104+
> [Learn about Service Connector concepts](./concept-service-connector-internals.md)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: Integrate an Azure AI multi-service resource with service connector
3+
description: In this document, learn how to integrate an Azure AI multi-service resource into your application with Service Connector
4+
author: wchigit
5+
ms.author: wchi
6+
ms.service: service-connector
7+
ms.topic: how-to
8+
ms.date: 06/14/2024
9+
ms.collection: ce-skilling-ai-copilot
10+
---
11+
12+
# Integrate an Azure AI multi-service resource with Service Connector
13+
14+
This page shows supported authentication methods and clients, and shows sample code you can use to connect an Azure AI multi-service resource to other cloud services using Service Connector. You might still be able to connect to an Azure AI multi-service resource using other methods. This page also shows default environment variable names and values you get when you create the service connection.
15+
16+
## Supported compute services
17+
18+
Service Connector can be used to connect the following compute services to an Azure AI multi-service resource:
19+
20+
- Azure App Service
21+
- Azure Functions
22+
- Azure Container Apps
23+
- Azure Spring Apps
24+
25+
## Supported authentication types and client types
26+
27+
The table below shows which combinations of authentication methods and clients are supported for connecting your compute service to an Azure AI multi-service resource using Service Connector. A “Yes” indicates that the combination is supported, while a “No” indicates that it is not supported.
28+
29+
30+
| Client type | System-assigned managed identity | User-assigned managed identity | Secret/connection string | Service principal |
31+
|-------------|:--------------------------------:|:------------------------------:|:------------------------:|:-----------------:|
32+
| .NET | Yes | Yes | Yes | Yes |
33+
| Java | Yes | Yes | Yes | Yes |
34+
| Node.js | Yes | Yes | Yes | Yes |
35+
| Python | Yes | Yes | Yes | Yes |
36+
| None | Yes | Yes | Yes | Yes |
37+
38+
This table indicates that all combinations of client types and authentication methods in the table are supported. All client types can use any of the authentication methods to connect to an Azure AI multi-service resource using Service Connector.
39+
40+
## Default environment variable names or application properties and sample code
41+
42+
Use the connection details below to connect compute services to an Azure AI multi-service resource. For more information about naming conventions, check the [Service Connector internals](concept-service-connector-internals.md#configuration-naming-convention) article.
43+
44+
### System-assigned managed identity
45+
46+
| Default environment variable name | Description | Sample value |
47+
| --------------------------------- | ---------------------------- | ------------------------------------------------ |
48+
| AZURE_COGNITIVESERVICES_ENDPOINT | Azure Cognitive Services token provider service | `https://<cognitive-service-name>.cognitiveservices.azure.com/` |
49+
50+
#### Sample code
51+
Refer to the steps and code below to connect to an Azure AI multi-service resource using a system-assigned managed identity.
52+
[!INCLUDE [code sample for an Azure AI multi-service resource](./includes/code-cognitive-microsoft-entra-id.md)]
53+
54+
### User-assigned managed identity
55+
56+
| Default environment variable name | Description | Sample value |
57+
| --------------------------------- | -------------------------- | ----------------------------------------------- |
58+
| AZURE_COGNITIVESERVICES_ENDPOINT | Azure Cognitive Services token provider service | `https://<cognitive-service-name>.cognitiveservices.azure.com/` |
59+
| AZURE_COGNITIVESERVICES_CLIENTID | Your client ID | `<client-ID>` |
60+
61+
#### Sample code
62+
Refer to the steps and code below to connect to an Azure AI multi-service resource using a user-assigned managed identity.
63+
[!INCLUDE [code sample for an Azure AI multi-service resource](./includes/code-cognitive-microsoft-entra-id.md)]
64+
65+
### Connection string
66+
67+
> [!div class="mx-tdBreakAll"]
68+
> | Default environment variable name | Description | Sample value |
69+
> | --------------------------------- | ------------| ------------ |
70+
> | AZURE_COGNITIVESERVICES_ENDPOINT | Azure Cognitive Services token provider service | `https://<cognitive-service-name>.cognitiveservices.azure.com/` |
71+
> | AZURE_COGNITIVESERVICES_KEY | API key of an Azure AI multi-service resource | `<api-key>` |
72+
73+
#### Sample Code
74+
Refer to the steps and code below to connect to an Azure AI multi-service resource using a connection string.
75+
[!INCLUDE [code sample for an Azure AI multi-service resource](./includes/code-cognitive-secret.md)]
76+
77+
78+
### Service principal
79+
80+
| Default environment variable name | Description | Sample value |
81+
| ----------------------------------- | -------------------------- | ---------------------------------------------- |
82+
| AZURE_COGNITIVESERVICES_ENDPOINT | Azure Cognitive Services token provider service | `https://<cognitive-service-name>.cognitiveservices.azure.com/` |
83+
| AZURE_COGNITIVESERVICES_CLIENTID | Your client ID | `<client-ID>` |
84+
| AZURE_COGNITIVESERVICES_CLIENTSECRET | Your client secret | `<client-secret>` |
85+
| AZURE_COGNITIVESERVICES_TENANTID | Your tenant ID | `<tenant-ID>` |
86+
87+
#### Sample code
88+
Refer to the steps and code below to connect to an Azure AI multi-service resource using a service principaL.
89+
[!INCLUDE [code sample for an Azure AI multi-service resource](./includes/code-cognitive-microsoft-entra-id.md)]
90+
91+
## Next steps
92+
93+
Follow the tutorial listed below to learn more about Service Connector.
94+
95+
> [!div class="nextstepaction"]
96+
> [Learn about Service Connector concepts](./concept-service-connector-internals.md)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: Integrate Azure OpenAI Service with service connector
3+
description: In this document, learn how to integrate Azure OpenAI Service into your application with Service Connector
4+
author: wchigit
5+
ms.author: wchi
6+
ms.service: service-connector
7+
ms.topic: how-to
8+
ms.date: 06/14/2024
9+
ms.collection: ce-skilling-ai-copilot
10+
---
11+
12+
# Integrate Azure OpenAI Service with Service Connector
13+
14+
This page shows supported authentication methods and clients, and shows sample code you can use to connect Azure OpenAI Service to other cloud services using Service Connector. You might still be able to connect to Azure OpenAI Service using other methods. This page also shows default environment variable names and values you get when you create the service connection.
15+
16+
## Supported compute services
17+
18+
Service Connector can be used to connect the following compute services to Azure OpenAI Service:
19+
20+
- Azure App Service
21+
- Azure Functions
22+
- Azure Container Apps
23+
- Azure Spring Apps
24+
25+
## Supported authentication types and client types
26+
27+
The table below shows which combinations of authentication methods and clients are supported for connecting your compute service to Azure OpenAI Service using Service Connector. A “Yes” indicates that the combination is supported, while a “No” indicates that it is not supported.
28+
29+
30+
| Client type | System-assigned managed identity | User-assigned managed identity | Secret/connection string | Service principal |
31+
|-------------|:--------------------------------:|:------------------------------:|:------------------------:|:-----------------:|
32+
| .NET | Yes | Yes | Yes | Yes |
33+
| Java | Yes | Yes | Yes | Yes |
34+
| Node.js | Yes | Yes | Yes | Yes |
35+
| Python | Yes | Yes | Yes | Yes |
36+
| None | Yes | Yes | Yes | Yes |
37+
38+
This table indicates that all combinations of client types and authentication methods in the table are supported. All client types can use any of the authentication methods to connect to Azure OpenAI Service using Service Connector.
39+
40+
## Default environment variable names or application properties and sample code
41+
42+
Use the connection details below to connect compute services to Azure OpenAI Service. For more information about naming conventions, check the [Service Connector internals](concept-service-connector-internals.md#configuration-naming-convention) article.
43+
44+
### System-assigned managed identity
45+
46+
| Default environment variable name | Description | Sample value |
47+
| --------------------------------- | ---------------------------- | ------------------------------------------------ |
48+
| AZURE_OPENAI_BASE | Azure OpenAI Service endpoint | `https://<Azure-OpenAI-name>.openai.azure.com/` |
49+
50+
#### Sample code
51+
Refer to the steps and code below to connect to Azure OpenAI Service using a system-assigned managed identity.
52+
[!INCLUDE [code sample for app config](./includes/code-openai-microsoft-entra-id.md)]
53+
54+
### User-assigned managed identity
55+
56+
| Default environment variable name | Description | Sample value |
57+
| --------------------------------- | -------------------------- | ----------------------------------------------- |
58+
| AZURE_OPENAI_BASE | Azure OpenAI Service Endpoint | `https://<Azure-OpenAI-name>.openai.azure.com/` |
59+
| AZURE_OPENAI_CLIENTID | Your client ID | `<client-ID>` |
60+
61+
#### Sample code
62+
Refer to the steps and code below to connect to Azure OpenAI Service using a user-assigned managed identity.
63+
[!INCLUDE [code sample for azure openai service](./includes/code-openai-microsoft-entra-id.md)]
64+
65+
### Connection string
66+
67+
> [!div class="mx-tdBreakAll"]
68+
> | Default environment variable name | Description | Sample value |
69+
> | --------------------------------- | ------------| ------------ |
70+
> | AZURE_OPENAI_BASE | Azure OpenAI Service Endpoint | `https://<Azure-OpenAI-name>.openai.azure.com/` |
71+
> | AZURE_OPENAI_KEY | Azure OpenAI Service API key | `<api-key>` |
72+
73+
#### Sample Code
74+
Refer to the steps and code below to connect to Azure OpenAI Service using a connection string.
75+
[!INCLUDE [code sample for azure openai service](./includes/code-openai-secret.md)]
76+
77+
78+
### Service principal
79+
80+
| Default environment variable name | Description | Sample value |
81+
| ----------------------------------- | -------------------------- | ---------------------------------------------- |
82+
| AZURE_OPENAI_BASE | Azure OpenAI Service Endpoint | `https://<Azure-OpenAI-name>.openai.azure.com/` |
83+
| AZURE_OPENAI_CLIENTID | Your client ID | `<client-ID>` |
84+
| AZURE_OPENAI_CLIENTSECRET | Your client secret | `<client-secret>` |
85+
| AZURE_OPENAI_TENANTID | Your tenant ID | `<tenant-ID>` |
86+
87+
#### Sample code
88+
Refer to the steps and code below to connect to Azure OpenAI Service using a service principaL.
89+
[!INCLUDE [code sample for azure openai service](./includes/code-openai-microsoft-entra-id.md)]
90+
91+
## Next steps
92+
93+
Follow the tutorial listed below to learn more about Service Connector.
94+
95+
> [!div class="nextstepaction"]
96+
> [Learn about Service Connector concepts](./concept-service-connector-internals.md)

0 commit comments

Comments
 (0)