Skip to content

Latest commit

 

History

History
79 lines (46 loc) · 3.67 KB

File metadata and controls

79 lines (46 loc) · 3.67 KB

04a - Using Azure Repos for Azure Spring Apps Configuration

This guide is part of the Azure Spring Apps training

Configure a Spring Cloud Config Server, that will be entirely managed and supported by Azure Spring Apps, to be used by Spring Boot microservices.


Create a Git repository for storing the application configuration

  1. Create a new Azure Repos repository. You can use a new project or an existing project, as long as your permissions on the project are sufficient to create, read, write, and generate credentials to repositories. The project should not be public.

  2. In the new private repository, add a new application.yml file which will store configuration data for all our microservices.

    Typically, each Spring Boot application includes such a file within the application binaries to contain application settings. A Spring Cloud Configuration Server allow such settings to be stored at a single location and served from a single source.

    For the moment, our application.yml will just store a message to check if the configuration is successful:

    application:
        message: Configured by Azure Spring Apps

    Commit and push the new file.

Obtain Repository URL and Credentials

Azure Spring Apps can access Git repositories that are public, secured by SSH, or secured using HTTP basic authentication. We will use that last option, as it is easier to create and manage with Azure Repos.

  1. In the Azure Repos portal for your project, click the "Clone" button:

    Clone Button

  2. Copy the clone URL from the textbox. This URL will typically be in the form:

        https://<organization name>@dev.azure.com/<organization name>/<project name>/_git/<repository name>
    

    Remove everything after https:// and before dev.azure.com, including the @. The resulting URL should be in the form:

        https://dev.azure.com/<organization name>/<project name>/_git/<repository name>
    

    Save this URL for use in the next section.

  3. Click "Generate Git Credentials". A username and password will appear. Save these for use in the next section.

Configure Azure Spring Apps to access the Git repository

  • Go to the Azure portal.
  • Go to the overview page of your Azure Spring Apps server and select "Config server" in the menu
  • Configure the repository we previously created:
    • Add the repository URL that you have saved from the previous section.

    • Click on Authentication and select HTTP Basic

    • The username is the username saved from the previous section

    • The password is the password saved from the previous section

  • Click on "Apply" and wait for the operation to succeed

Spring Cloud config server

Review

We have now created a private configuration repository. We have enabled Azure Spring Apps to create a configuration server with the configuration files from this repository.

In the next section, we will create an application that consumes this configuration, specifically the custom message we defined in application.yml.


⬅️ Previous guide: 03 - Configure application logs

⬅ GitHub version of this guide: # 04 - Configure a Spring Cloud Config server

➡️ Next guide: 05 - Build a Spring Boot microservice using Spring Cloud features