In order to make it easier to switch between Azure OpenAI deployments and OpenAI, the labs use a connection string. Below are the pieces of information you will need to configure the AI services for the lab.
The application code has the following template in the appsettings.Local.json file for an AzureOpenAI setup:
"OpenAI": "Source=AzureOpenAI;Key=<key>;ChatDeploymentName=chat;TextEmbeddingsDeploymentName=text;Endpoint=https://<resource name>.openai.azure.com/"| Keyword | Value |
|---|---|
| Source | AzureOpenAI |
| ChatDeploymentName | This is the name of your GPT-4o model deployment. For the lab I used a deployment model named chat |
| TextEmbeddingsDeploymentName | This is the name of your text-embedding-ada-002 model deployment. For the lab I used a deployment model named text |
| Key | This is one of the two keys |
| Endpoint | This is the endpoint of your Azure OpenAI service |
More detail on these settings can be found at Retrieve key and endpoint and Deploy a model
The application code has the following template in the appsettings.Local.json file for an OpenAI setup:
"OpenAI": "Source=OpenAI;ChatModelId=gpt-4o-2024-08-06;TextEmbeddingsModelId=text-embedding-ada-002;ApiKey=<api key>"| Keyword | Value |
|---|---|
| Source | OpenAI |
| ChatModelId | gpt-4o-2024-08-06 |
| TextEmbeddingsModelId | text-embedding-ada-002 |
| ApiKey | Your API Key |
In order to create an API key:
-
Login to https://platform.openai.com
-
Go to the Dashboard
-
Go to the API Keys menu item, click on the Create new secret key
- Give you key a name and click Create secret key
- Make sure you copy the value in the Save your key dialog box (this is what is used in the connection string above)


