Skip to content

Commit 1ffcce8

Browse files
authored
Merge pull request #268571 from jiec-msft/mason/show-acs-configs
Add doc to check configuration files pulled by ACS
2 parents 5b19c98 + 5ee0ab9 commit 1ffcce8

File tree

3 files changed

+93
-11
lines changed

3 files changed

+93
-11
lines changed

articles/spring-apps/enterprise/how-to-enterprise-application-configuration-service.md

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: KarlErickson
66
ms.author: xiading
77
ms.service: spring-apps
88
ms.topic: how-to
9-
ms.date: 02/28/2024
9+
ms.date: 03/27/2024
1010
ms.custom: devx-track-java, devx-track-extended-java, engagement-fy23, devx-track-azurecli
1111
---
1212

@@ -65,13 +65,13 @@ The **Refresh Interval** specifies the frequency (in seconds) for checking updat
6565

6666
The following table describes the properties for each repository entry:
6767

68-
| Property | Required? | Description |
69-
|---------------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
70-
| `Name` | Yes | A unique name to label each Git repository. |
71-
| `Patterns` | Yes | Patterns to search in Git repositories. For each pattern, use a format such as *{application}* or *{application}/{profile}* rather than *{application}-{profile}.yml*. Separate the patterns with commas. For more information, see the [Pattern](./how-to-enterprise-application-configuration-service.md#pattern) section of this article. |
72-
| `URI` | Yes | A Git URI (for example, `https://github.com/Azure-Samples/piggymetrics-config` or `[email protected]:Azure-Samples/piggymetrics-config`) |
73-
| `Label` | Yes | The branch name to search in the Git repository. |
74-
| `Search path` | No | Optional search paths, separated by commas, for searching subdirectories of the Git repository. |
68+
| Property | Required? | Description |
69+
|---------------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
70+
| `Name` | Yes | A unique name to label each Git repository. |
71+
| `Patterns` | Yes | The patterns to search for in Git repositories. For each pattern, use a format such as *{application}* or *{application}/{profile}* rather than *{application}-{profile}.yml*. Separate the patterns with commas. For more information, see the [Pattern](#pattern) section of this article. |
72+
| `URI` | Yes | A Git URI (for example, `https://github.com/Azure-Samples/piggymetrics-config` or `[email protected]:Azure-Samples/piggymetrics-config`) |
73+
| `Label` | Yes | The branch name to search for in the Git repository. |
74+
| `Search path` | No | Optional search paths, separated by commas, for searching subdirectories of the Git repository. |
7575

7676
### Pattern
7777

@@ -155,7 +155,7 @@ The Application Configuration Service also supports polyglot apps like dotNET, G
155155
When you modify and commit your configurations in a Git repository, several steps are involved before these changes are reflected in your applications. This process, though automated, involves the following distinct stages and components, each with its own timing and behavior:
156156

157157
- Polling by Application Configuration Service: The Application Configuration Service regularly polls the backend Git repositories to detect any changes. This polling occurs at a set frequency, defined by the refresh interval. When a change is detected, Application Configuration Service updates the Kubernetes `ConfigMap`.
158-
- ConfigMap update and interaction with kubelet cache: In Azure Spring Apps, this `ConfigMap` is mounted as a data volume to the relevant application. However, there's a natural delay in this process due to the frequency at which the kubelet refreshes its cache to recognize changes in `ConfigMap`.
158+
- `ConfigMap` update and interaction with kubelet cache: In Azure Spring Apps, this `ConfigMap` is mounted as a data volume to the relevant application. However, there's a natural delay in this process due to the frequency at which the kubelet refreshes its cache to recognize changes in `ConfigMap`.
159159
- Application reads updated configuration: Your application running in the Azure Spring Apps environment can access the updated configuration values. The existing beans in the Spring Context aren't automatically refreshed to use the updated configurations.
160160

161161
These stages are summarized in the following diagram:
@@ -375,6 +375,88 @@ az spring application-configuration-service delete \
375375

376376
---
377377

378+
## Examine configuration file in ConfigMap
379+
380+
The following section shows you how to examine the content of the configuration file pulled by Application Configuration Service from upstream Git repositories in the related Kubernetes `ConfigMap`. For more information, see the [Refresh strategies](#refresh-strategies) section of this article.
381+
382+
### Assign an Azure role
383+
384+
First, you must have the Azure role `Azure Spring Apps Application Configuration Service Config File Pattern Reader Role` assigned to you.
385+
386+
#### [Azure portal](#tab/azure-Portal)
387+
388+
Use the following steps to assign an Azure role:
389+
390+
1. Open the [Azure portal](https://portal.azure.com) and go to your Azure Spring Apps service instance.
391+
392+
1. In the navigation pane, select **Access Control (IAM)**.
393+
394+
1. On the **Access Control (IAM)** page, select **Add**, and then select **Add role assignment**.
395+
396+
:::image type="content" source="media/how-to-enterprise-application-configuration-service/add-role-assignment.png" alt-text="Screenshot of the Azure portal that shows the Access Control (IAM) page for an Azure Spring Apps instance with the Add role assignment option highlighted." lightbox="media/how-to-enterprise-application-configuration-service/add-role-assignment.png":::
397+
398+
1. On the **Add role assignment** page, in the **Name** list, search for and select the target role, and then select **Next**.
399+
400+
:::image type="content" source="media/how-to-enterprise-application-configuration-service\application-configuration-service-config-pattern-file-reader-role.png" alt-text="Screenshot of the Azure portal that shows the Add role assignment page for an Azure Spring Apps instance with the Azure Spring Apps Application Configuration Service Config File Pattern Reader Role name highlighted." lightbox="media/how-to-enterprise-application-configuration-service\application-configuration-service-config-pattern-file-reader-role.png":::
401+
402+
1. Select **Members** and then search for and select your username.
403+
404+
1. Select **Review + assign**.
405+
406+
#### [Azure CLI](#tab/azure-CLI)
407+
408+
Use the following command to assign an Azure role:
409+
410+
```azurecli
411+
az role assignment create \
412+
--role "Azure Spring Apps Application Configuration Service Config File Pattern Reader Role" \
413+
--scope "<service-instance-resource-id>" \
414+
--assignee "<your-identity>"
415+
```
416+
417+
---
418+
419+
### Examine configuration file with Azure CLI
420+
421+
Use the following command to view the content of the configuration file by [Pattern](#pattern):
422+
423+
```azurecli
424+
az spring application-configuration-service config show \
425+
--resource-group <resource-group-name> \
426+
--service <Azure-Spring-Apps-instance-name> \
427+
--config-file-pattern <pattern>
428+
```
429+
430+
This command produces JSON output similar to the following example:
431+
432+
```json
433+
{
434+
"configurationFiles": {
435+
"application.properties": [
436+
"example.property.application.name: example-service",
437+
"example.property.cloud: Azure"
438+
]
439+
}
440+
}
441+
```
442+
443+
You can also use this command with the `--export-path {/path/to/target/folder}` parameter to export the configuration file to the specified folder. It supports both relative paths and absolute paths. If you don't specify the path, the command uses the path of the current directory by default.
444+
445+
## Examine configuration file in the app
446+
447+
After you bind the app to the Application Configuration Service and set the [Pattern](#pattern) for the app deployment, as described in the [Use Application Configuration Service with applications](#use-application-configuration-service-with-applications) section of this article, the `ConfigMap` containing the configuration file for the pattern should be mounted to the application container. Use the following steps to check the configuration files in each instance of the app deployment:
448+
449+
1. Connect to one of the application instances. For more information, see [Connect to an app instance for troubleshooting](./how-to-connect-to-app-instance-for-troubleshooting.md).
450+
451+
1. Use the `echo $AZURE_SPRING_APPS_CONFIG_FILE_PATH` command to find the folders containing the configuration files. A list of locations shows up separated by commas, as shown in the following example:
452+
453+
```output
454+
$ echo $AZURE_SPRING_APPS_CONFIG_FILE_PATH
455+
/etc/azure-spring-cloud/configmap/acs-default-payment-default-e9d46,/etc/azure-spring-cloud/configmap/acs-default-catalog-default-616f4
456+
```
457+
458+
1. Check the content of the configuration file using commands such as `cat`.
459+
378460
## Check logs
379461

380462
The following sections show you how to view application logs by using either the Azure CLI or the Azure portal.
@@ -470,8 +552,8 @@ If the latest changes aren't reflected in the applications, check the following
470552
- Confirm that the branch of the desired config file changes is updated.
471553
- Confirm that the pattern configured in the Application Configuration Service matches the updated config files.
472554
- Confirm that the application is bound to the Application Configuration Service.
473-
- Confirm that the `ConfigMap` of the app is updated. If it isn't updated, raise a ticket.
474-
- Confirm that the `ConfigMap` is mounted to the application as a file by using `web shell`. If the file isn't updated, wait for the Kubernetes refresh interval (1 minute), or force a refresh by restarting the application.
555+
- Confirm that the `ConfigMap` containing the configuration file for the [Pattern](#pattern) used by the application is updated, as described in the [Examine configuration file in ConfigMap](#examine-configuration-file-in-configmap) section of this article. If it isn't updated, raise a ticket.
556+
- Confirm that the `ConfigMap` is mounted to the application as a file, as described in the [Examine configuration file in the app](#examine-configuration-file-in-the-app) section of this article. If the file isn't updated, wait for the Kubernetes refresh interval (1 minute), or force a refresh by restarting the application.
475557
476558
After checking these items, the applications should be able to read the updated configurations. If the applications still aren't updated, raise a ticket.
477559
Loading
Loading

0 commit comments

Comments
 (0)