Breyta

Deila með


Quickstart: Deploy an event-driven 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 applies to: ✔️ Standard consumption and dedicated (Preview) ✔️ Basic/Standard ✔️ Enterprise

This article explains how to deploy a Spring Boot event-driven application to Azure Spring Apps.

The sample project is an event-driven application that subscribes to a Service Bus queue named lower-case, and then handles the message and sends another message to another queue named upper-case. To make the app simple, message processing just converts the message to uppercase. The following diagram depicts this process:

Diagram showing the Azure Spring Apps event-driven app architecture.

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

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 ASA-Samples-Web-Application releases page on GitHub. No local preparation steps are needed.

3. Prepare the cloud environment

The main resources you need to run this sample are an Azure Spring Apps instance, an Azure Key Vault, and an Azure Service Bus instance. Use the following steps to create these resources.

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 ASA-Samples-Web-Application releases page on GitHub. No local preparation steps are needed.

3. Prepare the cloud environment

The main resources you need to run this sample are an Azure Spring Apps instance, an Azure Key Vault instance, and an Azure Service Bus instance. Use the following steps to create these resources.

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 ASA-Samples-Web-Application releases page on GitHub. No local preparation steps are needed.

3. Prepare the cloud environment

The main resources you need to run this sample are an Azure Spring Apps instance and an Azure Service Bus instance. The following sections describe how to create these resources.

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

Use the following steps to confirm that the event-driven app works correctly. You can validate the app by sending a message to the lower-case queue, then confirm that there's a message in the upper-case queue.

  1. Send a message to the lower-case queue with Service Bus Explorer. For more information, see the Send a message to a queue or topic section of Use Service Bus Explorer to run data operations on Service Bus.

  2. Confirm that there's a new message sent to the upper-case queue. For more information, see the Peek a message section of Use Service Bus Explorer to run data operations on Service Bus.

  1. Go to the Azure Spring Apps instance Overview page and select Logs to check the app's logs.

    Screenshot of the Azure portal that shows the Azure Spring Apps Logs page.

  1. Send a message to the lower-case queue with Service Bus Explorer. For more information, see the Send a message to a queue or topic section of Use Service Bus Explorer to run data operations on Service Bus.

  2. Confirm that there's a new message sent to the upper-case queue. For more information, see the Peek a message section of Use Service Bus Explorer to run data operations on Service Bus.

  1. Go to the Azure Spring Apps instance Overview page and select Logs to check the app's logs.

    Screenshot of the Azure portal that shows the Azure Spring Apps Logs page.

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

6. Clean up resources

Be sure to delete the resources you created in this article when you no longer need them. You can delete the Azure resource group, which includes all the resources in the resource group.

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

  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:

  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: