title | description | author | ms.service | ms.topic | ms.date | ms.custom | ms.author | zone_pivot_groups |
---|---|---|---|---|---|---|---|---|
Quickstart - Deploy your first web application to Azure Spring Apps |
Describes how to deploy a web application to Azure Spring Apps. |
KarlErickson |
azure-spring-apps |
quickstart |
10/31/2023 |
devx-track-java, devx-track-extended-java, devx-track-azurecli, mode-other, engagement-fy23, references_regions, devx-track-extended-azdevcli |
xiada |
spring-apps-plan-selection |
Note
The first 50 vCPU hours and 100 GB hours of memory are free each month. For more information, see Price Reduction - Azure Spring Apps does more, costs less! on the Apps on Azure Blog.
Note
Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
This quickstart shows how to deploy a Spring Boot web application to Azure Spring Apps. The sample project is a simple ToDo application to add tasks, mark when they're complete, and then delete them. The following screenshot shows the application:
:::image type="content" source="./media/quickstart-deploy-web-app/todo-app.png" alt-text="Screenshot of a sample web application in Azure Spring Apps." lightbox="./media/quickstart-deploy-web-app/todo-app.png":::
This application is a typical three-layers web application with the following layers:
- A frontend bounded React application.
- A backend Spring web application that uses Spring Data JPA to access a relational database.
- A relational database. For localhost, the application uses H2 Database Engine. For Azure Spring Apps, the application uses Azure Database for PostgreSQL. For more information about Azure Database for PostgreSQL, see Flexible Server documentation.
The following diagram shows the architecture of the system:
:::image type="content" source="media/quickstart-deploy-web-app/diagram.png" alt-text="Diagram that shows the architecture of a Spring web application." border="false":::
::: zone pivot="sc-consumption-plan,sc-standard"
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 provides 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.
::: zone-end
::: zone pivot="sc-enterprise"
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 provides 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.
::: zone-end
::: zone pivot="sc-consumption-plan,sc-standard"
- An Azure subscription. If you don't have a subscription, create a free account before you begin.
- An Azure subscription. If you don't have a subscription, create a free account before you begin.
- Git.
- Java Development Kit (JDK), version 17.
- An Azure subscription. If you don't have a subscription, create a free account before you begin.
- Git.
- Java Development Kit (JDK), version 17.
- Azure Developer CLI (AZD), version 1.2.0 or higher.
::: zone-end
::: zone pivot="sc-enterprise"
- An Azure subscription. If you don't have a subscription, create a free account before you begin.
- An Azure subscription. If you don't have a subscription, create a free account before you begin.
- Git.
- Java Development Kit (JDK), version 17.
- An Azure subscription. If you don't have a subscription, create a free account before you begin.
- Git.
- Java Development Kit (JDK), version 17.
- Azure CLI version 2.45.0 or higher. Use the following command to install the Azure Spring Apps extension:
az extension add --name spring
- If you're deploying an Azure Spring Apps Enterprise plan instance for the first time in the target subscription, see the Requirements section of Enterprise plan in Azure Marketplace.
::: zone-end
::: zone pivot="sc-enterprise"
[!INCLUDE deploy-enterprise-plan]
::: zone-end
::: zone pivot="sc-consumption-plan"
[!INCLUDE deploy-to-azure-spring-apps-consumption-plan]
::: zone-end
::: zone pivot="sc-standard"
[!INCLUDE deploy-standard-plan]
::: zone-end
Now you can access the deployed app to see whether it works.
::: zone pivot="sc-enterprise"
Use the following steps to validate:
-
After the deployment finishes, you can find the application URL from the deployment outputs:
:::image type="content" source="media/quickstart-deploy-web-app/web-app-url-standard.png" alt-text="Diagram that shows the enterprise app URL of the ARM deployment outputs." border="false" lightbox="media/quickstart-deploy-web-app/web-app-url-standard.png":::
-
Access the application with the output application URL. The page should appear as you saw in localhost.
-
Check the details for each resource deployment, which are useful for investigating any deployment issues.
Access the application with the output application URL. The page should appear as you saw in localhost.
Use the following steps to validate:
-
After the deployment finishes, you can access the app with this URL:
https://${AZURE_SPRING_APPS_NAME}-${APP_NAME}.azuremicroservices.io/
. The page should appear as you saw in localhost. -
To check the app's log to investigate any deployment issue, use the following command:
az spring app logs \ --service ${AZURE_SPRING_APPS_NAME} \ --name ${APP_NAME}
::: zone-end
::: zone pivot="sc-consumption-plan"
Use the following steps to validate:
-
After the deployment finishes, you can find the application URL from the deployment outputs:
:::image type="content" source="media/quickstart-deploy-web-app/web-app-url-consumption.png" alt-text="Diagram that shows the consumption app URL of the ARM deployment outputs." border="false" lightbox="media/quickstart-deploy-web-app/web-app-url-consumption.png":::
-
Access the application URL. The page should appear as you saw in localhost.
-
Check the details for each resource deployment, which are useful for investigating any deployment issues.
Access the application with the output application URL. The page should appear as you saw in localhost.
Access the application with the output endpoint. The page should appear as you saw in localhost.
::: zone-end
::: zone pivot="sc-standard"
Use the following steps to validate:
-
After the deployment finishes, find the application URL from the deployment outputs:
:::image type="content" source="media/quickstart-deploy-web-app/web-app-url-standard.png" alt-text="Diagram that shows the standard app URL of the ARM deployment outputs." border="false" lightbox="media/quickstart-deploy-web-app/web-app-url-standard.png":::
-
Access the application URL. The page should appear as you saw in localhost.
-
Check the details for each resource deployment, which are useful for investigating any deployment issues.
Access the application with the output application URL. The page should appear as you saw in localhost.
Access the application with the output endpoint. The page should appear as you saw in localhost.
::: zone-end
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.
::: zone pivot="sc-standard, sc-consumption-plan"
[!INCLUDE clean-up-resources-portal-or-azd]
::: zone-end
::: zone pivot="sc-enterprise"
[!INCLUDE clean-up-resources-via-resource-group]
[!INCLUDE clean-up-resources-via-resource-group]
Use the following command to delete the entire resource group, including the newly created service:
az group delete --name ${RESOURCE_GROUP}
::: zone-end
[!div class="nextstepaction"] Structured application log for Azure Spring Apps
[!div class="nextstepaction"] Map an existing custom domain to Azure Spring Apps
[!div class="nextstepaction"] Set up Azure Spring Apps CI/CD with GitHub Actions
[!div class="nextstepaction"] Automate application deployments to Azure Spring Apps
[!div class="nextstepaction"] Use managed identities for applications in Azure Spring Apps
[!div class="nextstepaction"] Quickstart: Create a service connection in Azure Spring Apps with the Azure CLI
::: zone pivot="sc-standard, sc-consumption-plan"
[!div class="nextstepaction"] Introduction to the sample app
::: zone-end
::: zone pivot="sc-enterprise"
[!div class="nextstepaction"] Introduction to the Fitness Store sample app
::: zone-end
For more information, see the following articles: