Skip to content

Commit 75ef4a0

Browse files
authored
Merge pull request #92065 from jpconnock/spring-env-variables
Showing how to review app env variables
2 parents bfa9d0f + 12c05b7 commit 75ef4a0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

articles/spring-cloud/spring-cloud-troubleshoot.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,46 @@ You may also check _Service Registry_ client logs in _Azure Log Analytics_. For
149149

150150
Visit [this getting started article](https://docs.microsoft.com/azure/azure-monitor/log-query/get-started-portal) to get started with _Azure Log Analytics_. Query the logs using [Kusto Query Language](https://docs.microsoft.com/azure/kusto/query/).
151151

152+
### I want to inspect my application's environment variables
153+
154+
Environment variables inform the Azure Spring Cloud framework, ensuring that Azure understands where and how to configure the services that comprise your application. Ensuring that your environment variables are correct is a necessary first step in troubleshooting potential problems. You can use the Spring Boot Actuator endpoint to review your environment variables.
155+
156+
[!WARNING]
157+
> This procedure may expose your environment variables. Do not proceed if your test endpoint is publicly accessible or if you've assigned a domain name to your application.
158+
159+
1. Navigate to this URL: `https://<your application test endpoint>/actuator/health`.
160+
- A response similar to `{"status":"UP"}` indicates that the endpoint has been enabled.
161+
- If the response is negative, include the following dependency in your `POM.xml`:
162+
163+
```xml
164+
<dependency>
165+
<groupId>org.springframework.boot</groupId>
166+
<artifactId>spring-boot-starter-actuator</artifactId>
167+
</dependency>
168+
```
169+
170+
1. With the Spring Boot Actuator endpoint enabled, go to the Azure portal and find the configuration page of your application. Add an environment variable with the name `MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE' and the value `*`.
171+
172+
1. Restart your application.
173+
174+
1. Navigate to `https://<the test endpoint of your app>/actuator/env` and inspect the response. It should look like this:
175+
176+
```json
177+
{
178+
"activeProfiles": [],
179+
"propertySources": {,
180+
"name": "server.ports",
181+
"properties": {
182+
"local.server.port": {
183+
"value": 1025
184+
}
185+
}
186+
}
187+
}
188+
```
189+
190+
Find the child node named `systemEnvironment`. This node contains your application's environment variables.
191+
152192
### I cannot find metrics or logs for my application
153193

154194
Go to _App management_ to make sure the application is _Running_ and _UP_.

0 commit comments

Comments
 (0)