title | description | author | ms.author | ms.service | ms.topic | ms.date | ms.custom | zone_pivot_groups |
---|---|---|---|---|---|---|---|---|
Quickstart: Set up Spring Cloud Config Server for Azure Spring Apps |
Describes the setup of Azure Spring Apps Config Server for app deployment. |
KarlErickson |
karler |
azure-spring-apps |
quickstart |
06/27/2024 |
devx-track-java, devx-track-extended-java, fasttrack-edit, mode-other |
programming-languages-spring-apps |
[!INCLUDE deprecation-note]
This article applies to: ✔️ Basic/Standard ❌ Enterprise
Config Server is a centralized configuration service for distributed systems. It uses a pluggable repository layer that currently supports local storage, Git, and Subversion. In this quickstart, you set up the Config Server to get data from a Git repository.
::: zone pivot="programming-language-csharp"
- Completion of the previous quickstart in this series: Provision Azure Spring Apps service.
- Azure Spring Apps Config Server is only applicable to the Basic or Standard plan.
Set up your Config Server with the location of the Git repository for the project by running the following command. Replace <service-instance-name>
with the name of the service you created earlier. The default value for service instance name that you set in the preceding quickstart doesn't work with this command.
az spring config-server git set \
--name <service-instance-name> \
--uri https://github.com/Azure-Samples/azure-spring-apps-samples \
--search-paths steeltoe-sample/config
This command tells Config Server to find the configuration data in the steeltoe-sample/config folder of the sample app repository. Since the name of the app that gets the configuration data is planet-weather-provider
, the file that's used is planet-weather-provider.yml.
::: zone-end
::: zone pivot="programming-language-java"
- JDK 17
- An Azure subscription. If you don't have a subscription, create a free account before you begin.
- Optionally, Azure CLI version 2.45.0 or higher. Install the Azure Spring Apps extension with the following command:
az extension add --upgrade --name spring
- Optionally, the Azure Toolkit for IntelliJ.
The following procedure sets up the Config Server using the Azure portal to deploy the PetClinic sample.
-
Go to the service Overview page and select Config Server.
-
In the Default repository section, set URI to
https://github.com/azure-samples/spring-petclinic-microservices-config
. -
Select Validate. Validation checks the schema and accessibility of your git repo to make sure it's correct.
:::image type="content" source="media/quickstart-setup-config-server/portal-config.png" alt-text="Screenshot of Azure portal showing Config Server page." lightbox="media/quickstart-setup-config-server/portal-config.png":::
-
When validation is complete, select Apply to save your changes.
:::image type="content" source="media/quickstart-setup-config-server/validate-complete.png" alt-text="Screenshot of Azure portal showing Config Server page with Apply button highlighted." lightbox="media/quickstart-setup-config-server/validate-complete.png":::
Updating the configuration can take a few minutes. You should get a notification when the configuration is complete.
The following procedure uses the Azure CLI to set up Config Server to deploy the Pet Clinic sample.
Run the following command to set the Default repository.
az spring config-server git set \
--name <service-instance-name> \
--uri https://github.com/azure-samples/spring-petclinic-microservices-config
::: zone-end
Tip
For information on using a private repository for Config Server, see Configure a managed Spring Cloud Config Server in Azure Spring Apps.
The following procedure explains how to troubleshoot Config Server settings.
-
In the Azure portal, go to the service Overview page and select Logs.
-
In the Queries pane under Show the application logs that contain the "error" or "exception" terms, select Run.
:::image type="content" source="media/quickstart-setup-config-server/setup-config-server-query.png" alt-text="Screenshot of Azure portal showing Azure Spring Apps query." lightbox="media/quickstart-setup-config-server/setup-config-server-query.png":::
The following error in the logs indicates that the Spring Apps service can't locate properties from Config Server:
java.lang.illegalStateException
-
Go to the service Overview page.
-
Select Diagnose and solve problems.
-
Under Availability and Performance, select Troubleshoot.
:::image type="content" source="media/quickstart-setup-config-server/setup-config-server-diagnose.png" alt-text="Screenshot of Azure portal showing Diagnose and solve problems page." lightbox="media/quickstart-setup-config-server/setup-config-server-diagnose.png":::
Azure portal displays the Availability and Performance page, which provides various information about Config Server health status.
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 it, delete the resource group, which deletes the resources in the resource group. To delete the resource group, enter the following commands in the Azure CLI:
echo "Enter the Resource Group name:" &&
read resourceGroupName &&
az group delete --name $resourceGroupName &&
echo "Press [ENTER] to continue ..."
[!div class="nextstepaction"] Quickstart: Build and deploy apps to Azure Spring Apps