Azure Spring Cloud task

Azure DevOps Services

Use this task to deploy applications to Azure Spring Cloud and to manage Azure Spring Cloud deployments.

Arguments

Note

Some arguments are only applicable for certain settings of the Action argument. The Action column below specifies the pertinent actions for each argument. Any argument listed as Required is only required for the pertinent Action(s).

Argument Action                  Description
Action
Action
All (Required) The action to be performed by this task.
One of: Deploy, Set Production, Delete Staging Deployment
Default value: Deploy
ConnectedServiceName
Azure Subscription
All (Required) The name of the Azure Resource Manager service connection.
Argument alias: azureSubscription
AzureSpringCloud
Azure Spring Cloud
All (Required) The name or resource ID of the Azure Spring Cloud instance.
AppName
App Name
All (Required) The name of the Azure Spring Cloud app to deploy. The app must exist prior to task execution.
UseStagingDeployment
Use Staging Deployment.
Deploy
Set Production
(Required) If set to true, apply the task to whichever deployment is set as the staging deployment at time of execution. If omitted, the DeploymentName parameter must be set.
Default value: true
DeploymentName
Deployment Name
Deploy
Set production
(Required if UseStagingDeployment is false) The name of the deployment to which the action will apply. If not using blue-green deployments, set this field to default.
CreateNewDeployment
Create new deployment
Deploy (Optional) If set to true and the deployment specified by DeploymentName does not exist at execution time, it will be created.
Default value: false
Package
Package or folder
Deploy (Required) The file path to the package containing the application to be deployed (.jar file for Java, .zip for .NET Core) or to a folder containing the application source to be built. Build variables or release variables are supported.
Default value: $(System.DefaultWorkingDirectory)/**/*.jar
RuntimeVersion
Runtime Version
Deploy (Optional) The runtime stack for the application.
One of: Java_8, Java_11, NetCore_31,
Default value: Java_11
EnvironmentVariables
Environment Variables
Deploy (Optional) Environment variables to be entered using the syntax '-key value'. Values containing spaces should be enclosed in double quotes.
Example: -CUSTOMER_NAME Contoso -WEBSITE_TIME_ZONE "Eastern Standard Time"
JvmOptions
JVM Options
Deploy (Optional) A string containing JVM Options.
Example: -XX:+UseG1GC -XX:MaxRAMPercentage=70 -Dazure.keyvault.enabled=true -Dazure.keyvault.uri=https://myvault.vault.azure.net/
DotNetCoreMainEntryPath
.NET Core entry path
Deploy (Optional) A string containing the path to the .NET executable relative to zip root.
Version
Version
Deploy (Optional) The deployment version. If not set, the version is left unchanged.

Examples

The following examples demonstrate common usage scenarios. For more information, see Automate application deployments to Azure Spring Cloud.

Deleting a staging deployment

The "Delete Staging Deployment" action allows you to delete the deployment not receiving production traffic. This frees up resources used by that deployment and makes room for a new staging deployment:

variables:
  azureSubscription: Contoso

steps:
- task: AzureSpringCloud@0
  continueOnError: true # Don't fail the pipeline if a staging deployment doesn't already exist.
  inputs:
    continueOnError: true
    inputs:
    azureSubscription: $(azureSubscription)
    Action: 'Delete Staging Deployment'
    AppName: customer-api
    AzureSpringCloud: contoso-dev-az-spr-cld

Deploying

To production

The following example deploys to the default production deployment in Azure Spring Cloud. This is the only possible deployment scenario when using the Basic SKU:

variables:
  azureSubscription: Contoso

steps:
- task: AzureSpringCloud@0
    inputs:
    azureSubscription: $(azureSubscription)
    Action: 'Deploy'
    AzureSpringCloud: contoso-dev-az-spr-cld
    AppName: customer-api
    UseStagingDeployment: false
    DeploymentName: default
    Package: '$(System.DefaultWorkingDirectory)/**/*customer-api*.jar'

Blue-green

The following example deploys to a pre-existing staging deployment. This deployment will not receive production traffic until it is set as a production deployment.

variables:
  azureSubscription: Contoso

steps:
- task: AzureSpringCloud@0
    inputs:
    azureSubscription: $(azureSubscription)
    Action: 'Deploy'
    AzureSpringCloud: contoso-dev-az-spr-cld
    AppName: customer-api
    UseStagingDeployment: true
    Package: '$(System.DefaultWorkingDirectory)/**/*customer-api*.jar'

For more on blue-green deployments, including an alternative approach, see Blue-green deployment strategies.

Setting production deployment

The following example will set the current staging deployment as production, effectively swapping which deployment will receive production traffic.

variables:
  azureSubscription: Contoso

steps:
- task: AzureSpringCloud@0
    inputs:
    azureSubscription: $(azureSubscription)
    Action: 'Set Production'
    AzureSpringCloud: contoso-dev-az-spr-cld
    AppName: customer-api
    UseStagingDeployment: true