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 article shows you how to use the Azure Spring Apps task for Azure Pipelines to deploy applications.
Continuous integration and continuous delivery tools let you quickly deploy updates to existing applications with minimal effort and risk. Azure DevOps helps you organize and control these key jobs.
The following video describes end-to-end automation using tools of your choice, including Azure Pipelines.
First, create an Azure Resource Manager service connection to your Azure DevOps project. For instructions, see Connect to Microsoft Azure. Be sure to select the same subscription you're using for your Azure Spring Apps service instance.
You can now build and deploy your projects using a series of tasks. The following Azure Pipelines template defines variables, a .NET Core task to build the application, and an Azure Spring Apps task to deploy the application.
variables:
workingDirectory: './steeltoe-sample'
planetMainEntry: 'Microsoft.Azure.SpringCloud.Sample.PlanetWeatherProvider.dll'
solarMainEntry: 'Microsoft.Azure.SpringCloud.Sample.SolarSystemWeather.dll'
planetAppName: 'planet-weather-provider'
solarAppName: 'solar-system-weather'
serviceName: '<your service name>'
steps:
# Restore, build, publish and package the zipped planet app
- task: DotNetCoreCLI@2
inputs:
command: 'publish'
publishWebProjects: false
arguments: '--configuration Release'
zipAfterPublish: false
modifyOutputPath: false
workingDirectory: $(workingDirectory)
# Deploy the planet app
- task: AzureSpringCloud@0
inputs:
azureSubscription: '<Service Connection Name>'
Action: 'Deploy'
AzureSpringCloud: $(serviceName)
AppName: 'testapp'
DeploymentType: 'Artifacts'
UseStagingDeployment: false
DeploymentName: 'default'
Package: $(workingDirectory)/src/$(planetAppName)/publish-deploy-planet.zip
RuntimeVersion: 'NetCore_31'
DotNetCoreMainEntryPath: $(planetMainEntry)
# Deploy the solar app
- task: AzureSpringCloud@0
inputs:
azureSubscription: '<Service Connection Name>'
Action: 'Deploy'
AzureSpringCloud: $(serviceName)
AppName: 'testapp'
DeploymentType: 'Artifacts'
UseStagingDeployment: false
DeploymentName: 'default'
Package: $(workingDirectory)/src/$(solarAppName)/publish-deploy-solar.zip
RuntimeVersion: 'NetCore_31'
DotNetCoreMainEntryPath: $(solarMainEntry)
First, use the following steps to set up an existing Azure Spring Apps instance for use with Azure DevOps.
Next, create an Azure Resource Manager service connection to your Azure DevOps project. For instructions, see Connect to Microsoft Azure. Be sure to select the same subscription you're using for your Azure Spring Apps service instance.
You can now build and deploy your projects using a series of tasks. The following sections show you various options for deploying your app using Azure DevOps.
To deploy using a pipeline, follow these steps:
Select Pipelines, then create a new pipeline with a Maven template.
Edit the azure-pipelines.yml file to set the mavenPomFile
field to complete/pom.xml.
Select Show assistant on the right side, then select the Azure Spring Apps template.
Select the service connection you created for your Azure Subscription, then select your Azure Spring Apps instance and app instance.
Disable Use Staging Deployment.
Set Package or folder to complete/target/spring-boot-complete-0.0.1-SNAPSHOT.jar.
Select Add to add this task to your pipeline.
Your pipeline settings should match the following image.
You can also build and deploy your projects using following pipeline template. This example first defines a Maven task to build the application, followed by a second task that deploys the JAR file using the Azure Spring Apps task for Azure Pipelines.
steps:
- task: Maven@3
inputs:
mavenPomFile: 'complete/pom.xml'
- task: AzureSpringCloud@0
inputs:
azureSubscription: '<your service connection name>'
Action: 'Deploy'
AzureSpringCloud: <your Azure Spring Apps service>
AppName: <app-name>
DeploymentType: 'Artifacts'
UseStagingDeployment: false
DeploymentName: 'default'
Package: ./target/your-result-jar.jar
Select Save and run, then wait for job to finish.
The deployment shown in the previous section receives application traffic immediately upon deployment. This enables you to test the application in the production environment before it receives any customer traffic.
To build the application the same way as shown previously and deploy it to a staging deployment, use the following template. In this example, the staging deployment must already exist. For an alternative approach, see Blue-green deployment strategies.
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
- task: AzureSpringCloud@0
inputs:
azureSubscription: '<your service connection name>'
Action: 'Deploy'
AzureSpringCloud: <your Azure Spring Apps service>
AppName: <app-name>
DeploymentType: 'Artifacts'
UseStagingDeployment: true
Package: ./target/your-result-jar.jar
- task: AzureSpringCloud@0
inputs:
azureSubscription: '<your service connection name>'
Action: 'Set Production'
AzureSpringCloud: <your Azure Spring Apps service>
AppName: <app-name>
UseStagingDeployment: true
The following steps show you how to enable a blue-green deployment from the Releases section.
Select Pipelines and create a new pipeline for your Maven build and publish artifact.
mavenPomFile
field to complete/pom.xml.Select Releases, then Create release.
Add a new pipeline, and select Empty job to create a job.
Under Stages select the line 1 job, 0 task
Select Pipeline, then select Add an artifact.
Select 1 job, 1 task under Stages.
Navigate to the Azure Spring Apps Deploy task in Stage 1, then select the ellipsis next to Package or folder.
Select spring-boot-complete-0.0.1-SNAPSHOT.jar in the dialog, then select OK.
Select the + to add another Azure Spring Apps task to the job.
Change the action to Set Production Deployment.
Select Save, then Create release to automatically start the deployment.
To verify your app's current release status, select View release. After this task is finished, visit the Azure portal to verify your app status.
To deploy directly to Azure without a separate build step, use the following pipeline template.
- task: AzureSpringCloud@0
inputs:
azureSubscription: '<your service connection name>'
Action: 'Deploy'
AzureSpringCloud: <your Azure Spring Apps service>
AppName: <app-name>
DeploymentType: 'Artifacts'
UseStagingDeployment: false
DeploymentName: 'default'
Package: $(Build.SourcesDirectory)
To deploy directly from an existing container image, use the following pipeline template.
- task: AzureSpringCloud@0
inputs:
azureSubscription: '<your service connection name>'
Action: 'Deploy'
AzureSpringCloud: '<your Azure Spring Apps service>'
AppName: '<app-name>'
DeploymentType: 'CustomContainer'
UseStagingDeployment: false
DeploymentName: 'default'
ContainerRegistry: 'docker.io' # or your Azure Container Registry, e.g: 'contoso.azurecr.io'
RegistryUsername: '$(username)'
RegistryPassword: '$(password)'
ContainerImage: '<your image tag>'
If you're using the Azure Spring Apps Enterprise plan, you can also specify which builder to use for deploy actions using the builder
option, as shown in the following example. For more information, see Use Tanzu Build Service.
- task: AzureSpringCloud@0
inputs:
azureSubscription: '<your-service-connection-name>'
Action: 'Deploy'
AzureSpringCloud: '<your-Azure-Spring-Apps-service-instance-name>'
AppName: '<app-name>'
UseStagingDeployment: false
DeploymentName: 'default'
Package: './target/your-result-jar.jar'
Builder: '<your-Tanzu-Build-Service-Builder-resource>'
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
Deploy a Spring Boot app to Azure Container Apps - Training
In this module, you learn how to deploy a Spring Boot app to Azure Container Apps. You deploy a Spring Boot application to Azure Container Apps and maintain it using the built-in Java stack.
Certification
Microsoft Certified: Azure Developer Associate - Certifications
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.