Use Application Configuration Service for Tanzu
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 article applies to: ❌ Basic/Standard tier ✔️ Enterprise tier
This article shows you how to use Application Configuration Service for VMware Tanzu® with Azure Spring Apps Enterprise Tier.
Application Configuration Service for Tanzu is one of the commercial VMware Tanzu components. It enables the management of Kubernetes-native ConfigMap resources that are populated from properties defined in one or more Git repositories.
With Application Configuration Service for Tanzu, you have a central place to manage external properties for applications across all environments.
Prerequisites
An already provisioned Azure Spring Apps Enterprise tier instance with Application Configuration Service for Tanzu enabled. For more information, see Quickstart: Build and deploy apps to Azure Spring Apps using the Enterprise tier.
Note
To use Application Configuration Service for Tanzu, you must enable it when you provision your Azure Spring Apps service instance. You cannot enable it after provisioning at this time.
Manage Application Configuration Service for Tanzu settings
Application Configuration Service for Tanzu supports Azure DevOps, GitHub, GitLab, and Bitbucket for storing your configuration files.
To manage the service settings, open the Settings section and add a new entry under the Repositories section.
The properties for each entry are described in the following table.
| Property | Required? | Description |
|---|---|---|
| Name | Yes | A unique name to label each Git repository. |
| Patterns | Yes | Patterns to search in Git repositories. For each pattern, use a format like {application} or {application}/{profile} instead of {application}-{profile}.yml, and separate the patterns with commas. For more information, see the Pattern section. |
| URI | Yes | A Git URI (for example, https://github.com/Azure-Samples/piggymetrics-config or git@github.com:Azure-Samples/piggymetrics-config) |
| Label | Yes | The branch name to search in the Git repository. |
| Search path | No | Optional search paths, separated by commas, for searching subdirectories of the Git repository. |
Pattern
Configuration will be pulled from Git backends using what is defined in a pattern. A pattern is a combination of {application}/{profile} as described in the following list.
- {application} - The name of an application for which the configuration is being retrieved. The value
applicationis considered the default application and includes configuration shared across multiple applications. Any other value specifies a specific application and will include properties for both the specified application and shared properties for the default application. - {profile} - Optional. The name of a profile for which properties may be retrieved. An empty value, or the value
default, includes properties that are shared across any and all profiles. Non-default values include properties for the specified profile and properties for the default profile.
Authentication
The following image shows the three types of repository authentication supported by Application Configuration Service for Tanzu.
Public repository.
You don't need extra Authentication configuration when using a public repository. Just select Public in the Authentication form.
Private repository with basic authentication.
The following table shows all the configurable properties used to set up a private Git repository with basic authentication.
Property Required? Description username Yes The username used to access the repository. password Yes The password used to access the repository. Private repository with SSH authentication.
The following table shows all configurable properties used to set up a private Git repository with SSH.
Property Required? Description Private key Yes The private key that identifies the Git user. Passphrase-encrypted private keys aren't supported. Host key No The host key of the Git server. If you've connected to the server via Git on the command line, the host key is in your .ssh/known_hosts file. Don't include the algorithm prefix, because it's specified in Host key algorithm.Host key algorithm No The algorithm for hostKey: one ofssh-dss,ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384, andecdsa-sha2-nistp521. (Required if supplyingHost key).Strict host key checking No Optional value that indicates whether the backend should be ignored if it encounters an error when using the provided Host key. Valid values aretrueandfalse. The default value istrue.
To validate access to the target URI, select Validate. After validation completes successfully, select Apply to update the configuration settings.
Refresh strategies
Use the following steps to refresh your application configuration after you update the configuration file in the Git repository.
Load the configuration to Application Configuration Service for Tanzu.
The refresh frequency is managed by Azure Spring Apps and fixed to 60 seconds.
Load the configuration to your application.
A Spring application holds the properties as the beans of the Spring Application Context via the Environment interface. The following list shows several ways to load the new configurations:
Restart the application. After restarting, the application will always load the new configuration.
Call the /actuator/refresh endpoint exposed on the config client via the Spring Actuator.
To use this method, add the following dependency to your configuration client’s pom.xml file.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>You can also enable the actuator endpoint by adding the following configurations:
management.endpoints.web.exposure.include=refresh, bus-refresh, beans, envAfter reloading the property sources by calling the /actuator/refresh endpoint, the attributes bound with
@Valuein the beans having the annotation@RefreshScopeare refreshed.@Service @Getter @Setter @RefreshScope public class MyService { @Value private Boolean activated; }Next, use curl with the application endpoint to refresh the new configuration.
curl -X POST http://{app-endpoint}/actuator/refresh
Configure Application Configuration Service for Tanzu settings using the portal
You can configure Application Configuration Service for Tanzu using the portal by following these steps:
Select Application Configuration Service.
Select Overview to view the running state and resources allocated to Application Configuration Service for Tanzu.

Select Settings and add a new entry in the Repositories section with the Git backend information.
Select Validate to validate access to the target URI. After validation completes successfully, select Apply to update the configuration settings.

Configure Application Configuration Service for Tanzu settings using the CLI
You can configure Application Configuration Service for Tanzu using the CLI, by following these steps:
az spring application-configuration-service git repo add \
--name <entry-name> \
--patterns <patterns> \
--uri <git-backend-uri> \
--label <git-branch-name>
Use Application Configuration Service for Tanzu with applications using the portal
When you use Application Configuration Service for Tanzu with a Git back end, keep the following items in mind.
To use the centralized configurations, you must bind the app to Application Configuration Service for Tanzu. After binding the app, you'll need to configure which pattern to be used by the app by following these steps:
Open the App binding tab.
Select Bind app and choose one app in the dropdown. Select Apply to bind.
Note
When you change the bind/unbind status, you must restart or redeploy the app to for the binding to take effect.
Select Apps, then select the pattern(s) to be used by the apps.
a. In the left navigation menu, select Apps to view the list all the apps.
b. Select the target app to configure patterns for from the
namecolumn.c. In the left navigation pane, select Configuration, then select General settings.
d. In the Config file patterns dropdown, choose one or more patterns from the list.
e. Select Save
Use Application Configuration Service for Tanzu with applications using the CLI
You can use Application Configuration Service for Tanzu with applications, by using this command:
az spring application-configuration-service bind --app <app-name>
az spring app deploy \
--name <app-name> \
--artifact-path <path-to-your-JAR-file> \
--config-file-pattern <config-file-pattern>
Next steps
Povratne informacije
Pošalјite i prikažite povratne informacije za