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.
Create an Azure Resource Manager service connection
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.
Build and deploy apps
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.
Set up an Azure Spring Apps instance and an Azure DevOps project
First, use the following steps to set up an existing Azure Spring Apps instance for use with Azure DevOps.
Go to your Azure Spring Apps instance, then create a new app.
Go to the Azure DevOps portal, then create a new project under your chosen organization. If you don't have an Azure DevOps organization, you can create one for free.
Create an Azure Resource Manager service connection
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.
Build and deploy apps
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.
Deploy using a pipeline
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.
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.
Edit the pipeline file
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.
To deploy directly from an existing container image, use the following pipeline template.
YAML
- 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>'
Deploy and specify a builder (Enterprise plan only)
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.
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.
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.