Quickstart: Deploy your first application to Azure Spring Apps

Select an Azure Spring Apps plan

Note

The Basic, Standard, and Enterprise plans entered a retirement period on March 17, 2025. For more information, see the Azure Spring Apps retirement announcement.

The Standard consumption and dedicated plan entered a retirement period on September 30, 2024, with a complete shutdown by the end of March 2025. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.

This article explains how to deploy a small application to run on Azure Spring Apps.

The application code used in this tutorial is a simple app. When you complete this example, the application is accessible online, and you can manage it through the Azure portal.

This article provides the following options for deploying to Azure Spring Apps:

  • The Azure portal option is the easiest and the fastest way to create resources and deploy applications with a single click. This option is suitable for Spring developers who want to quickly deploy applications to Azure cloud services.
  • The Azure portal + Maven plugin option is a more conventional way to create resources and deploy applications step by step. This option is suitable for Spring developers using Azure cloud services for the first time.
  • The Azure Developer CLI option is a more efficient way to automatically create resources and deploy applications through simple commands. The Azure Developer CLI uses a template to provision the Azure resources needed and to deploy the application code. This option is suitable for Spring developers who are familiar with Azure cloud services.
  • The Azure portal option is the easiest and the fastest way to create resources and deploy applications with a single click. This option is suitable for Spring developers who want to quickly deploy applications to Azure cloud services.
  • The Azure portal + Maven plugin option is a more conventional way to create resources and deploy applications step by step. This option is suitable for Spring developers using Azure cloud services for the first time.
  • The Azure CLI option uses a powerful command line tool to manage Azure resources. This option is suitable for Spring developers who are familiar with Azure cloud services.
  • The IntelliJ option uses a powerful Java IDE to easily manage Azure resources. This option is suitable for Spring developers who are familiar with Azure cloud services and IntelliJ IDEA.
  • The Visual Studio Code option uses a lightweight but powerful source code editor, which can easily manage Azure resources. This option is suitable for Spring developers who are familiar with Azure cloud services and Visual Studio Code.

1. Prerequisites

2. Prepare the Spring project

The Deploy to Azure button in the next section launches an Azure portal experience that downloads a JAR package from the spring-cloud-azure-tools releases page on GitHub. No local preparation steps are needed.

3. Prepare the cloud environment

This section describes how to create an Azure Spring Apps service instance and prepare the Azure cloud environment.

This section uses a Deploy to Azure button to launch a deployment experience in the Azure portal. This experience uses an ARM template to create Azure resources.

3.1. Sign in to the Azure portal

Go to the Azure portal and enter your credentials to sign in to the portal. The default view is your service dashboard.

3.2. Create Azure resources

Use the following steps to create all the Azure resources that the app depends on:

  1. Select the following Deploy to Azure button to launch the deployment experience in the Azure portal:

    Button to deploy the Resource Manager template to Azure.

  2. Fill out the form on the Basics tab. Use the following table as a guide for completing the form:

    Setting Suggested value Description
    Subscription Your subscription name. The Azure subscription that you want to use for your server. If you have multiple subscriptions, choose the subscription in which you'd like to be billed for the resource.
    Resource group myresourcegroup A new resource group name or an existing one from your subscription.
    Region The region closest to your users. The region is used to create the resource group.
  3. Select Review and Create to review your selections. Then, select Create to deploy the app to Azure Spring Apps.

  4. On the toolbar, select the Notifications icon (a bell) to monitor the deployment process. After the deployment finishes, you can select Pin to dashboard, which creates a tile for this service on your Azure portal dashboard as a shortcut to the service's Overview page. Select Go to resource to open the service's Overview page.

    Screenshot of the Azure portal that shows the Overview page with the custom deployment notifications pane open.

4. Deploy the app to Azure Spring Apps

The Deploy to Azure button in the previous section launches an Azure portal experience that includes application deployment, so nothing else is needed.

2. Prepare the Spring project

The Deploy to Azure button in the next section launches an Azure portal experience that downloads a JAR package from the spring-cloud-azure-tools releases page on GitHub. No local preparation steps are needed.

3. Prepare the cloud environment

This section describes how to create an Azure Spring Apps service instance and prepare the Azure cloud environment.

This section uses a Deploy to Azure button to launch a deployment experience in the Azure portal. This experience uses an ARM template to create Azure resources.

3.1. Sign in to the Azure portal

Go to the Azure portal and enter your credentials to sign in to the portal. The default view is your service dashboard.

3.2. Create Azure resources

Use the following steps to create all the Azure resources that the app depends on:

  1. Select the following Deploy to Azure button to launch the deployment experience in the Azure portal:

    Button to deploy the Resource Manager template to Azure.

  2. Fill out the form on the Basics tab. Use the following table as a guide for completing the form:

    Setting Suggested value Description
    Subscription Your subscription name. The Azure subscription that you want to use for your server. If you have multiple subscriptions, choose the subscription in which you'd like to be billed for the resource.
    Resource group myresourcegroup A new resource group name or an existing one from your subscription.
    Region The region closest to your users. The region is used to create the resource group.
  3. Select Review and Create to review your selections. Then, select Create to deploy the app to Azure Spring Apps.

  4. On the toolbar, select the Notifications icon (a bell) to monitor the deployment process. After the deployment finishes, you can select Pin to dashboard, which creates a tile for this service on your Azure portal dashboard as a shortcut to the service's Overview page. Select Go to resource to open the service's Overview page.

    Screenshot of the Azure portal that shows the Overview page with the custom deployment notifications pane open.

4. Deploy the app to Azure Spring Apps

The Deploy to Azure button in the previous section launches an Azure portal experience that includes application deployment, so nothing else is needed.

2. Prepare the Spring project

Use the following steps to prepare the project:

  1. Use the following command to clone the Spring Boot sample project for Azure from GitHub.

    git clone https://github.com/spring-guides/gs-spring-boot-for-azure.git
    
  2. Use the following command to move to the project folder:

    cd gs-spring-boot-for-azure/complete
    
  3. Use the following Maven command to build the project:

    ./mvnw clean package
    
  4. Run the sample project locally by using the following command:

    ./mvnw spring-boot:run
    

3. Prepare the cloud environment

This section describes how to create an Azure Spring Apps service instance and prepare the Azure cloud environment.

3.1. Provide names for each resource

Create variables to hold the resource names by using the following commands. Be sure to replace the placeholders with your own values.

export LOCATION="<region>"
export RESOURCE_GROUP="<resource-group-name>"
export SERVICE_NAME="<Azure-Spring-Apps-instance-name>"
export APP_NAME="demo"

3.2. Create a new resource group

Use the following steps to create a new resource group:

  1. Use the following command to sign in to the Azure CLI:

    az login
    
  2. Use the following command to set the default location:

    az configure --defaults location=${LOCATION}
    
  3. Use the following command to list all available subscriptions to determine the subscription ID to use:

    az account list --output table
    
  4. Use the following command to set the default subscription:

    az account set --subscription <subscription-ID>
    
  5. Use the following command to create a resource group:

    az group create --resource-group ${RESOURCE_GROUP}
    
  6. Use the following command to set the newly created resource group as the default resource group:

    az configure --defaults group=${RESOURCE_GROUP}
    

3.3. Install extension and register namespace

Use the following commands to install the Azure Spring Apps extension for the Azure CLI and register the namespace: Microsoft.SaaS:

az extension add --name spring --upgrade
az provider register --namespace Microsoft.SaaS

3.4. Create an Azure Spring Apps instance

Use the following steps to create the service instance:

  1. Use the following command to accept the legal terms and privacy statements for the Enterprise plan:

    Note

    This step is necessary only if your subscription has never been used to create an Enterprise plan instance of Azure Spring Apps.

    az term accept \
        --publisher vmware-inc \
        --product azure-spring-cloud-vmware-tanzu-2 \
        --plan asa-ent-hr-mtr
    
  2. Use the following command to create an Azure Spring Apps service instance:

    az spring create \
        --name ${SERVICE_NAME} \
        --sku Enterprise
    

3.5. Create an app in your Azure Spring Apps instance

An App is an abstraction of one business app. For more information, see App and deployment in Azure Spring Apps. Apps run in an Azure Spring Apps service instance, as shown in the following diagram.

Diagram that shows the relationship between apps and an Azure Spring Apps service instance.

Use the following command to create the app on Azure Spring Apps:

az spring app create \
    --service ${SERVICE_NAME} \
    --name ${APP_NAME} \
    --assign-endpoint true

4. Deploy the app to Azure Spring Apps

Use the following command to deploy the .jar file for the app:

az spring app deploy \
    --service ${SERVICE_NAME} \
    --name ${APP_NAME} \
    --artifact-path target/demo-0.0.1-SNAPSHOT.jar

Deploying the application can take a few minutes.

5. Validate the app

This section describes how to validate your application.

After the deployment finishes, find the application URL from the deployment outputs. Use the following steps to validate:

  1. Access the application URL from the Outputs page of the Deployment. When you open the app, you get the response Hello World.

    Screenshot of the Azure portal that shows the Outputs page of the Deployment.

  2. Check the details for each resource deployment, which are useful for investigating any deployment issues.

After the deployment finishes, use the following steps to find the application URL from the deployment outputs:

  1. Access the application URL from the Outputs page of the Deployment. When you open the app, you get the response Hello World.

    Screenshot of the Azure portal that shows the Outputs page of the Deployment.

  2. Check the details for each resource deployment, which are useful for investigating any deployment issues.

After the deployment finishes, use the following steps to check the app's logs to investigate any deployment issue:

  1. Access the application with the output application URL. When you open the app, you get the response Hello World.

  2. Use the following command to check the app's log to investigate any deployment issue:

    az spring app logs \
        --service ${SERVICE_NAME} \
        --name ${APP_NAME}
    

6. Clean up resources

If you plan to continue working with subsequent quickstarts and tutorials, you might want to leave these resources in place. When you no longer need the resources, you can clean up unnecessary resources to avoid Azure charges.

Use the following command to delete the resource group by using the Azure CLI:

az group delete --name ${RESOURCE_GROUP}

Use the following steps to delete the entire resource group, including the newly created service instance:

  1. Locate your resource group in the Azure portal. On the navigation menu, select Resource groups, and then select the name of your resource group.

7. Next steps

For more information, see the following articles: