Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.
The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.
This article applies to: ❎ Basic/Standard ✅ Enterprise
This quickstart shows you how to integrate Azure OpenAI with applications deployed on the Azure Spring Apps Enterprise plan.
Azure OpenAI enables your applications to take advantage of large-scale, generative AI models with deep understandings of language and code to enable new reasoning and comprehension capabilities.
The following video shows how Azure Spring Apps uses Azure OpenAI to build intelligent applications:
spring-cloud
extension, uninstall it to avoid configuration and version mismatches.
az extension add --upgrade --name spring
az extension remove --name spring-cloud
To add AI to the application, create an Azure OpenAI account and deploy language models. The following steps describe how to provision an Azure OpenAI account and deploy language models using the Azure CLI:
Use the following command to create an Azure OpenAI account:
az cognitiveservices account create \
--resource-group <resource-group-name> \
--name <open-ai-service-name> \
--location <region> \
--kind OpenAI \
--sku s0 \
--custom-domain <open-ai-service-name>
Use the following commands to create the model deployments for text-embedding-ada-002
and gpt-35-turbo-16k
in your Azure OpenAI service instance:
az cognitiveservices account deployment create \
--resource-group <resource-group-name> \
--name <open-ai-service-name> \
--deployment-name text-embedding-ada-002 \
--model-name text-embedding-ada-002 \
--model-version "2" \
--model-format OpenAI \
--sku-name "Standard" \
--sku-capacity 1
az cognitiveservices account deployment create \
--resource-group <resource-group-name> \
--name <open-ai-service-name> \
--deployment-name gpt-35-turbo-16k \
--model-name gpt-35-turbo-16k \
--model-version "0613" \
--model-format OpenAI \
--sku-name "Standard" \
--sku-capacity 1
Use the following steps to create, configure, and deploy the Assist Service application to Azure Spring Apps.
Use the following command to create the new AI service, assist-service
:
az spring app create \
--resource-group <resource-group-name> \
--name assist-service \
--service <Azure-Spring-Apps-service-instance-name> \
--instance-count 1 \
--memory 1Gi
Use the following command to configure Spring Cloud Gateway with the Assist Service route:
az spring gateway route-config create \
--resource-group <resource-group-name> \
--service <Azure-Spring-Apps-service-instance-name> \
--name assist-routes \
--app-name assist-service \
--routes-file azure-spring-apps-enterprise/resources/json/routes/assist-service.json
Use the following command to retrieve the REST API endpoint base URL for the Azure OpenAI service:
export SPRING_AI_AZURE_OPENAI_ENDPOINT=$(az cognitiveservices account show \
--name <open-ai-service-name> \
--resource-group <resource-group-name> \
| jq -r .properties.endpoint)
Use the following command to retrieve the primary API key:
export SPRING_AI_AZURE_OPENAI_APIKEY=$(az cognitiveservices account keys list \
--name <open-ai-service-name> \
--resource-group <resource-group-name> \
| jq -r .key1)
Use the following command to deploy the Assist Service application:
az spring app deploy
--resource-group <resource-group-name> \
--name assist-service \
--service <Azure-Spring-Apps-service-instance-name> \
--source-path apps/acme-assist \
--build-env BP_JVM_VERSION=17 \
--env \
SPRING_AI_AZURE_OPENAI_ENDPOINT=${SPRING_AI_AZURE_OPENAI_ENDPOINT} \
SPRING_AI_AZURE_OPENAI_APIKEY=${SPRING_AI_AZURE_OPENAI_APIKEY} \
SPRING_AI_AZURE_OPENAI_MODEL=gpt-35-turbo-16k \
SPRING_AI_AZURE_OPENAI_EMBEDDINGMODEL=text-embedding-ada-002
Now, test the Fitness Store application in the browser. Select ASK TO FITASSIST to converse with the Assist Service application.
In FitAssist, enter I need a bike for a commute to work and observe the output that was generated by the Assist Service application:
If you plan to continue working with subsequent quickstarts and tutorials, you might want to leave these resources in place. When no longer needed, delete the resource group, which deletes the resources in the resource group. To delete the resource group by using Azure CLI, use the following commands:
echo "Enter the Resource Group name:" &&
read resourceGroupName &&
az group delete --name $resourceGroupName &&
echo "Press [ENTER] to continue ..."
Continue on to any of the following optional quickstarts:
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Get started with Azure OpenAI Service - Training
Azure OpenAI Service enables engineers to build enterprise-grade generative AI solutions.
Certification
Microsoft Certified: Azure AI Engineer Associate - Certifications
Design and implement an Azure AI solution using Azure AI services, Azure AI Search, and Azure Open AI.
Documentation