This project shows how to deploy the Spring Petclinic Microservices application with OpenAI to Azure Container Apps and integrate it with additional Azure services, also some samples for Azure Container Apps features.
Features • Gettting Started • Guidance
This template, the application code and configuration it contains, has been built to showcase Microsoft Azure specific services and tools. We strongly advise our customers not to make this code part of their production environments without implementing or enabling additional security features.
For a more comprehensive list of best practices and security recommendations for Intelligent Applications, visit Azure security best practices and patterns, Azure security baseline for Intelligent Recommendations
The following technologies are part of the project:
This project provides the following features:
You have a few options for getting started with this template.
All the steps of this lab have been tested in the GitHub CodeSpace. This is the preferred option for running this lab!
Once you've opened the project in Codespaces, in Dev Containers, or locally, you can deploy it to Azure.
Microsoft.Authorization/roleAssignments/write
permissions, such as Role Based Access Control Administrator, User Access Administrator, or Owner. If you don't have subscription-level permissions, you must be granted RBAC for an existing resource group and deploy to that existing group.Microsoft.Resources/deployments/write
permissions on the subscription level.Suggested: Both Contributor and User Access Administrator roles on the subscription.
Login to Azure
azd auth login
az login
Provision and deploy all the resources:
azd up
It will prompt you to provide an azd
environment name (like "java-ai"), select a subscription from your Azure account, and select a location where OpenAI is available (like "eastus2"). Then it will provision the resources in your account and deploy the latest code. If you get an error or timeout with deployment, changing the location can help, as there may be availability constraints for the OpenAI resource.
When azd has finished deploying, visit the api-gateway url and begin your experience on AI java apps.
INFO: Deploy finish succeed!
INFO: Api Gateway App url: https://api-gateway.<cluster>.<region>.azurecontainerapps.io
INFO: Spring Boot Admin url: https://springbootadmin-azure-java.ext.<cluster>.<region>.azurecontainerapps.io
When you've made any changes to the app code, you can just run:
azd deploy
for all services
azd deploy -n <service>
for single service
For running this lab you will need:
This template uses Azure OpenAI Service deployment mododules gpt-4o and text-embedding-ada-002 which may not be available in all Azure regions. Check for up-to-date region availability and select a region during deployment accordingly
The template uses Azure Database for MySQL - Flexible Server version 8.0 to store data. You may select a region suite for this service. Or create a database instance manually then Reuse existing service.
You can estimate the cost of this project's architecture with Azure's pricing calculator
This template has Managed Identity built in to eliminate the need for developers to manage these credentials.
Applications can use managed identities to obtain Microsoft Entra tokens without having to manage any credentials. Additionally, we have added a GitHub Action tool that scans the infrastructure-as-code files and generates a report containing any detected issues. To ensure best practices in your repo we recommend anyone creating solutions based on our templates ensure that the Github secret scanning setting is enabled in your repos.