Create an Azure OpenAI account (Optional)
Before you can add AI capabilities to your application, you need to create an Azure OpenAI account and deploy the language models that you want to use.
If you’ve already successfully run the
create-azure-resources.sh
script discussed in the installation instructions, or if you already have validAZURE-OPENAI-ENDPOINT
andAZURE-OPENAI-API-KEY
values for an existing Azure OpenAI instance, you can skip this section.
The following step-by-step guidance will show you how to create an Azure OpenAI account using the Azure CLI. If you’d like to learn more about creating these accounts, see the following documentation: Create and deploy an Azure OpenAI Service resource
Step by step guidance
-
To create an Azure OpenAI account, run the following commands. Note that the account name you use here must be globally unique, so adjust it accordingly if the randomly generated name is already in use.
Azure OpenAI Service is not supported in all regions, you may refer to Azure OpenAI global standard model availability for more details.
You may use these regions for your lab: australiaeast, brazilsouth, southindia, japaneast, swedencentral, eastus, eastus2 and westus.
AI_LOCATION=<ai-location> OPEN_AI_SERVICE_NAME=open-ai-account-$UNIQUEID az cognitiveservices account create \ --resource-group $RESOURCE_GROUP \ --name $OPEN_AI_SERVICE_NAME \ --location $AI_LOCATION \ --kind OpenAI \ --sku s0 \ --custom-domain $OPEN_AI_SERVICE_NAME
-
After creating your Azure OpenAI instance, you need to deploy the language models you want. Use the following command to deploy the
gpt-4o
model:az cognitiveservices account deployment create \ --resource-group $RESOURCE_GROUP \ --name $OPEN_AI_SERVICE_NAME \ --deployment-name gpt-4o \ --model-name gpt-4o \ --model-version 2024-08-06 \ --model-format OpenAI \ --sku-name "GlobalStandard" \ --sku-capacity 10
In Azure OpenAI, model availability varies by region. To verify model and version availability in the region you’re deploying to, check the Azure OpenAI documentation.
-
Go to your Azure OpenAI instance in the Azure portal to get the endpoint and api-key values, which you’ll use later in this lab.
Ask the subscription administrator for help if you see errors like this:
{"error":{"code":"BadRequest","message":"Failed to list key. disableLocalAuth is set to be true"}}
.