|
1 | 1 | ---
|
2 |
| -#services: cognitive-services |
3 |
| -manager: nitinme |
4 |
| -author: travisw |
5 |
| -ms.author: travisw |
| 2 | +author: eric-urban |
| 3 | +ms.author: eur |
6 | 4 | ms.service: azure-ai-openai
|
7 | 5 | ms.topic: include
|
8 |
| -ms.date: 08/29/2023 |
| 6 | +ms.date: 1/7/2025 |
9 | 7 | ---
|
10 | 8 |
|
11 |
| -## Retrieve required variables |
| 9 | +## Retrieve resource information |
12 | 10 |
|
13 |
| -To successfully make a call against Azure OpenAI, you need the following variables. This quickstart assumes you've uploaded your data to an Azure blob storage account and have an Azure AI Search index created. See [Add your data using Azure AI Foundry](../use-your-data-quickstart.md?pivots=programming-language-studio) |
| 11 | +You need to retrieve the following information to authenticate your application with your Azure OpenAI resource. This quickstart assumes you've uploaded your data to an Azure blob storage account and have an Azure AI Search index created. See [Add your data using Azure AI Foundry portal](../use-your-data-quickstart.md?pivots=programming-language-studio). |
| 12 | + |
| 13 | +#### [Microsoft Entra ID](#tab/keyless) |
14 | 14 |
|
15 | 15 | |Variable name | Value |
|
16 | 16 | |--------------------------|-------------|
|
17 |
| -| `AZURE_OPENAI_ENDPOINT` | This value can be found in the **Keys & Endpoint** section when examining your Azure OpenAI resource from the Azure portal. Alternatively, you can find the value in **Azure AI Foundry** > **Chat playground** > **Code view**. An example endpoint is: `https://my-resoruce.openai.azure.com`.| |
18 |
| -| `AZURE_OPENAI_API_KEY` | This value can be found in **Resource management** > **Keys & Endpoint** section when examining your Azure OpenAI resource from the Azure portal. You can use either `KEY1` or `KEY2`. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption. | |
19 |
| -| `AZURE_OPENAI_DEPLOYMENT_ID` | This value corresponds to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure AI Foundry portal.| |
| 17 | +| `AZURE_OPENAI_ENDPOINT` | This value can be found in the **Keys & Endpoint** section when examining your Azure OpenAI resource from the Azure portal. An example endpoint is: `https://my-resoruce.openai.azure.com`.| |
| 18 | +| `AZURE_OPENAI_DEPLOYMENT_ID` | This value corresponds to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal.| |
20 | 19 | | `AZURE_AI_SEARCH_ENDPOINT` | This value can be found in the **Overview** section when examining your Azure AI Search resource from the Azure portal. |
|
21 | 20 | | `AZURE_AI_SEARCH_API_KEY` | This value can be found in the **Settings** > **Keys** section when examining your Azure AI Search resource from the Azure portal. You can use either the primary admin key or secondary admin key. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption. |
|
22 | 21 | | `AZURE_AI_SEARCH_INDEX` | This value corresponds to the name of the index you created to store your data. You can find it in the **Overview** section when examining your Azure AI Search resource from the Azure portal. |
|
23 | 22 |
|
24 |
| -### Environment variables |
25 |
| - |
26 |
| -Create and assign persistent environment variables for your key and endpoint. |
27 |
| - |
28 |
| -[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)] |
29 |
| - |
30 |
| -# [Command Line](#tab/command-line) |
31 |
| - |
32 |
| -```CMD |
33 |
| -setx AZURE_OPENAI_ENDPOINT REPLACE_WITH_YOUR_AOAI_ENDPOINT_VALUE_HERE |
34 |
| -``` |
35 |
| -```CMD |
36 |
| -setx AZURE_OPENAI_API_KEY REPLACE_WITH_YOUR_AOAI_KEY_VALUE_HERE |
37 |
| -``` |
38 |
| -```CMD |
39 |
| -setx AZURE_OPENAI_DEPLOYMENT_ID REPLACE_WITH_YOUR_AOAI_DEPLOYMENT_VALUE_HERE |
40 |
| -``` |
41 |
| -```CMD |
42 |
| -setx AZURE_AI_SEARCH_ENDPOINT REPLACE_WITH_YOUR_AZURE_SEARCH_RESOURCE_VALUE_HERE |
43 |
| -``` |
44 |
| -```CMD |
45 |
| -setx AZURE_AI_SEARCH_API_KEY REPLACE_WITH_YOUR_AZURE_SEARCH_RESOURCE_KEY_VALUE_HERE |
46 |
| -``` |
47 |
| -```CMD |
48 |
| -setx AZURE_AI_SEARCH_INDEX REPLACE_WITH_YOUR_INDEX_NAME_HERE |
49 |
| -``` |
50 |
| - |
51 |
| - |
52 |
| -# [PowerShell](#tab/powershell) |
53 |
| - |
54 |
| -```powershell |
55 |
| -[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_ENDPOINT', 'REPLACE_WITH_YOUR_AOAI_ENDPOINT_VALUE_HERE', 'User') |
56 |
| -``` |
57 |
| - |
58 |
| -```powershell |
59 |
| -[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_API_KEY', 'REPLACE_WITH_YOUR_AOAI_KEY_VALUE_HERE', 'User') |
60 |
| -``` |
| 23 | +Learn more about [keyless authentication](/azure/ai-services/authentication) and [setting environment variables](/azure/ai-services/cognitive-services-environment-variables). |
61 | 24 |
|
62 |
| -```powershell |
63 |
| -[System.Environment]::SetEnvironmentVariable('AZURE_OPENAI_DEPLOYMENT_ID', 'REPLACE_WITH_YOUR_AOAI_DEPLOYMENT_VALUE_HERE', 'User') |
64 |
| -``` |
| 25 | +#### [API key](#tab/api-key) |
65 | 26 |
|
66 |
| -```powershell |
67 |
| -[System.Environment]::SetEnvironmentVariable('AZURE_AI_SEARCH_ENDPOINT', 'REPLACE_WITH_YOUR_AZURE_SEARCH_RESOURCE_VALUE_HERE', 'User') |
68 |
| -``` |
69 |
| - |
70 |
| -```powershell |
71 |
| -[System.Environment]::SetEnvironmentVariable('AZURE_AI_SEARCH_API_KEY', 'REPLACE_WITH_YOUR_AZURE_SEARCH_RESOURCE_KEY_VALUE_HERE', 'User') |
72 |
| -``` |
73 |
| - |
74 |
| -```powershell |
75 |
| -[System.Environment]::SetEnvironmentVariable('AZURE_AI_SEARCH_INDEX', 'REPLACE_WITH_YOUR_INDEX_NAME_HERE', 'User') |
76 |
| -``` |
| 27 | +|Variable name | Value | |
| 28 | +|--------------------------|-------------| |
| 29 | +| `AZURE_OPENAI_ENDPOINT` | This value can be found in the **Keys & Endpoint** section when examining your Azure OpenAI resource from the Azure portal. An example endpoint is: `https://my-resoruce.openai.azure.com`.| |
| 30 | +| `AZURE_OPENAI_API_KEY` | This value can be found in **Resource management** > **Keys & Endpoint** section when examining your Azure OpenAI resource from the Azure portal. You can use either `KEY1` or `KEY2`. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption. | |
| 31 | +| `AZURE_OPENAI_DEPLOYMENT_ID` | This value corresponds to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal.| |
| 32 | +| `AZURE_AI_SEARCH_ENDPOINT` | This value can be found in the **Overview** section when examining your Azure AI Search resource from the Azure portal. | |
| 33 | +| `AZURE_AI_SEARCH_API_KEY` | This value can be found in the **Settings** > **Keys** section when examining your Azure AI Search resource from the Azure portal. You can use either the primary admin key or secondary admin key. Always having two keys allows you to securely rotate and regenerate keys without causing a service disruption. | |
| 34 | +| `AZURE_AI_SEARCH_INDEX` | This value corresponds to the name of the index you created to store your data. You can find it in the **Overview** section when examining your Azure AI Search resource from the Azure portal. | |
77 | 35 |
|
78 |
| -# [Bash](#tab/bash) |
| 36 | +Learn more about [finding API keys](/azure/ai-services/cognitive-services-environment-variables) and [setting environment variables](/azure/ai-services/cognitive-services-environment-variables). |
79 | 37 |
|
80 |
| -```Bash |
81 |
| -export AZURE_OPENAI_ENDPOINT=REPLACE_WITH_YOUR_AOAI_ENDPOINT_VALUE_HERE |
82 |
| -``` |
83 |
| -```Bash |
84 |
| -export AZURE_OPENAI_API_KEY=REPLACE_WITH_YOUR_AOAI_KEY_VALUE_HERE |
85 |
| -``` |
86 |
| -```Bash |
87 |
| -export AZURE_OPENAI_DEPLOYMENT_ID=REPLACE_WITH_YOUR_AOAI_DEPLOYMENT_VALUE_HERE |
88 |
| -``` |
89 |
| -```Bash |
90 |
| -export AZURE_AI_SEARCH_ENDPOINT=REPLACE_WITH_YOUR_AZURE_SEARCH_RESOURCE_VALUE_HERE |
91 |
| -``` |
92 |
| -```Bash |
93 |
| -export AZURE_AI_SEARCH_API_KEY=REPLACE_WITH_YOUR_AZURE_SEARCH_RESOURCE_KEY_VALUE_HERE |
94 |
| -``` |
95 |
| -```Bash |
96 |
| -export AZURE_AI_SEARCH_INDEX=REPLACE_WITH_YOUR_INDEX_NAME_HERE |
97 |
| -``` |
| 38 | +[!INCLUDE [Azure key vault](~/reusable-content/ce-skilling/azure/includes/ai-services/security/azure-key-vault.md)] |
98 | 39 |
|
99 | 40 | ---
|
100 | 41 |
|
| 42 | + |
0 commit comments