Редактиране

Споделяне чрез


Quickstart: Deploy your first application to Azure Spring Apps

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 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

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.

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 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.

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 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.

  2. On the Resource group page, select Delete. Enter the name of your resource group in the text box to confirm deletion, then select Delete.

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.

  2. On the Resource group page, select Delete. Enter the name of your resource group in the text box to confirm deletion, then select Delete.

7. Next steps

For more information, see the following articles: