Skip to content

Commit 0f427e0

Browse files
authored
Merge pull request #281446 from MicrosoftDocs/main
7/22/2024 AM Publish
2 parents e339355 + a3f679d commit 0f427e0

File tree

334 files changed

+2048
-1672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+2048
-1672
lines changed

.openpublishing.redirection.app-service.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,12 @@
552552
},
553553
{
554554
"source_path_from_root": "/articles/app-service/containers/configure-language-java.md",
555-
"redirect_url": "/azure/app-service/configure-language-java?pivots=platform-linux",
555+
"redirect_url": "/azure/app-service/configure-language-java-deploy-run?pivots=platform-linux",
556+
"redirect_document_id": false
557+
},
558+
{
559+
"source_path_from_root": "/articles/app-service/configure-language-java.md",
560+
"redirect_url": "/azure/app-service/configure-language-java-deploy-run",
556561
"redirect_document_id": false
557562
},
558563
{

articles/app-service/configure-authentication-user-identities.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ For all language frameworks, App Service makes the claims in the incoming token
2020
|------------------------------|-----------------------------------------------------------------------|
2121
| `X-MS-CLIENT-PRINCIPAL` | A Base64 encoded JSON representation of available claims. For more information, see [Decoding the client principal header](#decoding-the-client-principal-header). |
2222
| `X-MS-CLIENT-PRINCIPAL-ID` | An identifier for the caller set by the identity provider. |
23-
| `X-MS-CLIENT-PRINCIPAL-NAME` | A human-readable name for the caller set by the identity provider, e.g. Email Address, User Principal Name. |
23+
| `X-MS-CLIENT-PRINCIPAL-NAME` | A human-readable name for the caller set by the identity provider, such as email address or user principal name. |
2424
| `X-MS-CLIENT-PRINCIPAL-IDP` | The name of the identity provider used by App Service Authentication. |
2525

2626
Provider tokens are also exposed through similar headers. For example, Microsoft Entra also sets `X-MS-TOKEN-AAD-ACCESS-TOKEN` and `X-MS-TOKEN-AAD-ID-TOKEN` as appropriate.
2727

2828
> [!NOTE]
29-
> Different language frameworks may present these headers to the app code in different formats, such as lowercase or title case.
29+
> Different language frameworks might present these headers to the app code in different formats, such as lowercase or title case.
3030
31-
Code that is written in any language or framework can get the information that it needs from these headers. [Decoding the client principal header](#decoding-the-client-principal-header) covers this process. For some frameworks, the platform also provides extra options that may be more convenient.
31+
Code that is written in any language or framework can get the information that it needs from these headers. [Decoding the client principal header](#decoding-the-client-principal-header) covers this process. For some frameworks, the platform also provides extra options that might be more convenient.
3232

3333
### Decoding the client principal header
3434

35-
`X-MS-CLIENT-PRINCIPAL` contains the full set of available claims as Base64 encoded JSON. These claims go through a default claims-mapping process, so some may have different names than you would see if processing the token directly. The decoded payload is structured as follows:
35+
`X-MS-CLIENT-PRINCIPAL` contains the full set of available claims as Base64 encoded JSON. These claims go through a default claims-mapping process, so some might have different names than you would see if processing the token directly. The decoded payload is structured as follows:
3636

3737
```json
3838
{
@@ -52,12 +52,12 @@ Code that is written in any language or framework can get the information that i
5252
|------------|------------------|---------------------------------------|
5353
| `auth_typ` | string | The name of the identity provider used by App Service Authentication. |
5454
| `claims` | array of objects | An array of objects representing the available claims. Each object contains `typ` and `val` properties. |
55-
| `typ` | string | The name of the claim. This may have been subject to default claims mapping and could be different from the corresponding claim contained in a token. |
55+
| `typ` | string | The name of the claim. It might be subject to default claims mapping and could be different from the corresponding claim contained in a token. |
5656
| `val` | string | The value of the claim. |
5757
| `name_typ` | string | The name claim type, which is typically a URI providing scheme information about the `name` claim if one is defined. |
5858
| `role_typ` | string | The role claim type, which is typically a URI providing scheme information about the `role` claim if one is defined. |
5959

60-
To process this header, your app will need to decode the payload and iterate through the `claims` array to find the claims of interest. It may be convenient to convert these into a representation used by the app's language framework. Here's an example of this process in C# that constructs a [ClaimsPrincipal](/dotnet/api/system.security.claims.claimsprincipal) type for the app to use:
60+
To process this header, your app needs to decode the payload and iterate through the `claims` array to find the claims of interest. It might be convenient to convert them into a representation used by the app's language framework. Here's an example of this process in C# that constructs a [ClaimsPrincipal](/dotnet/api/system.security.claims.claimsprincipal) type for the app to use:
6161

6262
```csharp
6363
using System;
@@ -123,7 +123,7 @@ public static class ClaimsPrincipalParser
123123

124124
### Framework-specific alternatives
125125

126-
For ASP.NET 4.6 apps, App Service populates [ClaimsPrincipal.Current](/dotnet/api/system.security.claims.claimsprincipal.current) with the authenticated user's claims, so you can follow the standard .NET code pattern, including the `[Authorize]` attribute. Similarly, for PHP apps, App Service populates the `_SERVER['REMOTE_USER']` variable. For Java apps, the claims are [accessible from the Tomcat servlet](configure-language-java.md#authenticate-users-easy-auth).
126+
For ASP.NET 4.6 apps, App Service populates [ClaimsPrincipal.Current](/dotnet/api/system.security.claims.claimsprincipal.current) with the authenticated user's claims, so you can follow the standard .NET code pattern, including the `[Authorize]` attribute. Similarly, for PHP apps, App Service populates the `_SERVER['REMOTE_USER']` variable. For Java apps, the claims are [accessible from the Tomcat servlet](configure-language-java-security.md#authenticate-users-easy-auth).
127127

128128
For [Azure Functions](../azure-functions/functions-overview.md), `ClaimsPrincipal.Current` isn't populated for .NET code, but you can still find the user claims in the request headers, or get the `ClaimsPrincipal` object from the request context or even through a binding parameter. For more information, see [Working with client identities in Azure Functions](../azure-functions/functions-bindings-http-webhook-trigger.md#working-with-client-identities).
129129

articles/app-service/configure-common.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Other language stacks, likewise, get the app settings as environment variables a
3434
- [Node.js](configure-language-nodejs.md#access-environment-variables)
3535
- [PHP](configure-language-php.md#access-environment-variables)
3636
- [Python](configure-language-python.md#access-app-settings-as-environment-variables)
37-
- [Java](configure-language-java.md#configure-data-sources)
37+
- [Java](configure-language-java-data-sources.md)
3838
- [Custom containers](configure-custom-container.md#configure-environment-variables)
3939

4040
App settings are always encrypted when stored (encrypted-at-rest).
@@ -216,7 +216,7 @@ At runtime, connection strings are available as environment variables, prefixed
216216
* Notification Hub: `NOTIFICATIONHUBCONNSTR_`
217217
* Service Bus: `SERVICEBUSCONNSTR_`
218218
* Event Hub: `EVENTHUBCONNSTR_`
219-
* Document Db: `DOCDBCONNSTR_`
219+
* Document DB: `DOCDBCONNSTR_`
220220
* Redis Cache: `REDISCACHECONNSTR_`
221221

222222
>[!Note]
@@ -229,7 +229,7 @@ For example, a MySQL connection string named *connectionstring1* can be accessed
229229
- [Node.js](configure-language-nodejs.md#access-environment-variables)
230230
- [PHP](configure-language-php.md#access-environment-variables)
231231
- [Python](configure-language-python.md#access-environment-variables)
232-
- [Java](configure-language-java.md#configure-data-sources)
232+
- [Java](configure-language-java-data-sources.md)
233233
- [Custom containers](configure-custom-container.md#configure-environment-variables)
234234

235235
Connection strings are always encrypted when stored (encrypted-at-rest).
@@ -413,7 +413,7 @@ It's not possible to edit connection strings in bulk by using a JSON file with A
413413
- [Node.js](configure-language-nodejs.md)
414414
- [PHP](configure-language-php.md)
415415
- [Python](configure-language-python.md)
416-
- [Java](configure-language-java.md)
416+
- [Java](configure-language-java-deploy-run.md)
417417

418418
<a name="alwayson"></a>
419419

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
---
2+
title: Configure APM platforms for Tomcat, JBoss, or Java SE apps
3+
description: Learn how to configure APM platforms, such as Application Insights, NewRelic, and AppDynamics, for Tomcat, JBoss, or Java SE app on Azure App Service.
4+
keywords: azure app service, web app, windows, oss, java, tomcat, jboss, spring boot, quarkus
5+
ms.devlang: java
6+
ms.topic: article
7+
ms.date: 07/17/2024
8+
ms.custom: devx-track-java, devx-track-azurecli, devx-track-extended-java, linux-related-content
9+
zone_pivot_groups: app-service-java-hosting
10+
adobe-target: true
11+
author: cephalin
12+
ms.author: cephalin
13+
---
14+
15+
# Configure APM platforms for Tomcat, JBoss, or Java SE apps in Azure App Service
16+
17+
This article shows how to connect Java applications deployed on Azure App Service with Azure Monitor Application Insights, NewRelic, and AppDynamics application performance monitoring (APM) platforms.
18+
19+
[!INCLUDE [java-variants](includes/configure-language-java/java-variants.md)]
20+
21+
## Configure Application Insights
22+
23+
Azure Monitor Application Insights is a cloud native application monitoring service that enables customers to observe failures, bottlenecks, and usage patterns to improve application performance and reduce mean time to resolution (MTTR). With a few clicks or CLI commands, you can enable monitoring for your Node.js or Java apps, autocollecting logs, metrics, and distributed traces, eliminating the need for including an SDK in your app. For more information about the available app settings for configuring the agent, see the [Application Insights documentation](../azure-monitor/app/java-standalone-config.md).
24+
25+
# [Azure portal](#tab/portal)
26+
27+
To enable Application Insights from the Azure portal, go to **Application Insights** on the left-side menu and select **Turn on Application Insights**. By default, a new application insights resource of the same name as your web app is used. You can choose to use an existing application insights resource, or change the name. Select **Apply** at the bottom.
28+
29+
# [Azure CLI](#tab/cli)
30+
31+
To enable via the Azure CLI, you need to create an Application Insights resource and set a couple app settings on the Azure portal to connect Application Insights to your web app.
32+
33+
1. Enable the Applications Insights extension
34+
35+
```azurecli
36+
az extension add -n application-insights
37+
```
38+
39+
2. Create an Application Insights resource using the following CLI command. Replace the placeholders with your desired resource name and group.
40+
41+
```azurecli
42+
az monitor app-insights component create --app <resource-name> -g <resource-group> --location westus2 --kind web --application-type web
43+
```
44+
45+
Note the values for `connectionString` and `instrumentationKey`, you'll need these values in the next step.
46+
47+
> [!NOTE]
48+
> To retrieve a list of other locations, run `az account list-locations`.
49+
50+
3. Set the instrumentation key, connection string, and monitoring agent version as app settings on the web app. Replace `<instrumentationKey>` and `<connectionString>` with the values from the previous step.
51+
52+
# [Windows](#tab/windows)
53+
54+
```azurecli
55+
az webapp config appsettings set -n <webapp-name> -g <resource-group> --settings "APPINSIGHTS_INSTRUMENTATIONKEY=<instrumentationKey>" "APPLICATIONINSIGHTS_CONNECTION_STRING=<connectionString>" "ApplicationInsightsAgent_EXTENSION_VERSION=~3" "XDT_MicrosoftApplicationInsights_Mode=default" "XDT_MicrosoftApplicationInsights_Java=1"
56+
```
57+
58+
# [Linux](#tab/linux)
59+
60+
```azurecli
61+
az webapp config appsettings set -n <webapp-name> -g <resource-group> --settings "APPINSIGHTS_INSTRUMENTATIONKEY=<instrumentationKey>" "APPLICATIONINSIGHTS_CONNECTION_STRING=<connectionString>" "ApplicationInsightsAgent_EXTENSION_VERSION=~3" "XDT_MicrosoftApplicationInsights_Mode=default"
62+
```
63+
64+
---
65+
66+
---
67+
68+
## Configure New Relic
69+
70+
# [Windows](#tab/windows)
71+
72+
1. Create a NewRelic account at [NewRelic.com](https://newrelic.com/signup)
73+
2. Download the Java agent from NewRelic. It has a file name similar to *newrelic-java-x.x.x.zip*.
74+
3. Copy your license key, you need it to configure the agent later.
75+
4. [SSH into your App Service instance](configure-linux-open-ssh-session.md) and create a new directory */home/site/wwwroot/apm*.
76+
5. Upload the unpacked NewRelic Java agent files into a directory under */home/site/wwwroot/apm*. The files for your agent should be in */home/site/wwwroot/apm/newrelic*.
77+
6. Modify the YAML file at */home/site/wwwroot/apm/newrelic/newrelic.yml* and replace the placeholder license value with your own license key.
78+
7. In the Azure portal, browse to your application in App Service and create a new Application Setting.
79+
80+
::: zone pivot="java-javase"
81+
82+
Create an environment variable named `JAVA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/newrelic/newrelic.jar`.
83+
84+
::: zone-end
85+
86+
::: zone pivot="java-tomcat"
87+
88+
Create an environment variable named `CATALINA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/newrelic/newrelic.jar`.
89+
90+
::: zone-end
91+
92+
::: zone pivot="java-jboss"
93+
94+
For **JBoss EAP**, `[TODO]`.
95+
96+
::: zone-end
97+
98+
# [Linux](#tab/linux)
99+
100+
1. Create a NewRelic account at [NewRelic.com](https://newrelic.com/signup)
101+
2. Download the Java agent from NewRelic. It has a file name similar to *newrelic-java-x.x.x.zip*.
102+
3. Copy your license key, you need it to configure the agent later.
103+
4. [SSH into your App Service instance](configure-linux-open-ssh-session.md) and create a new directory */home/site/wwwroot/apm*.
104+
5. Upload the unpacked NewRelic Java agent files into a directory under */home/site/wwwroot/apm*. The files for your agent should be in */home/site/wwwroot/apm/newrelic*.
105+
6. Modify the YAML file at */home/site/wwwroot/apm/newrelic/newrelic.yml* and replace the placeholder license value with your own license key.
106+
7. In the Azure portal, browse to your application in App Service and create a new Application Setting.
107+
108+
::: zone pivot="java-javase"
109+
110+
Create an environment variable named `JAVA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/newrelic/newrelic.jar`.
111+
112+
::: zone-end
113+
114+
::: zone pivot="java-tomcat"
115+
116+
Create an environment variable named `CATALINA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/newrelic/newrelic.jar`.
117+
118+
::: zone-end
119+
120+
::: zone pivot="java-jboss"
121+
122+
For **JBoss EAP**, `[TODO]`.
123+
124+
::: zone-end
125+
126+
---
127+
128+
> [!NOTE]
129+
> If you already have an environment variable for `JAVA_OPTS` or `CATALINA_OPTS`, append the `-javaagent:/...` option to the end of the current value.
130+
131+
## Configure AppDynamics
132+
133+
# [Windows](#tab/windows)
134+
135+
1. Create an AppDynamics account at [AppDynamics.com](https://www.appdynamics.com/community/register/)
136+
2. Download the Java agent from the AppDynamics website. The file name is similar to *AppServerAgent-x.x.x.xxxxx.zip*
137+
3. Use the [Kudu console](https://github.com/projectkudu/kudu/wiki/Kudu-console) to create a new directory */home/site/wwwroot/apm*.
138+
4. Upload the Java agent files into a directory under */home/site/wwwroot/apm*. The files for your agent should be in */home/site/wwwroot/apm/appdynamics*.
139+
5. In the Azure portal, browse to your application in App Service and create a new Application Setting.
140+
141+
::: zone pivot="java-javase"
142+
143+
Create an environment variable named `JAVA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/appdynamics/javaagent.jar -Dappdynamics.agent.applicationName=<app-name>` where `<app-name>` is your App Service name. If you already have an environment variable for `JAVA_OPTS`, append the `-javaagent:/...` option to the end of the current value.
144+
145+
::: zone-end
146+
147+
::: zone pivot="java-tomcat"
148+
149+
Create an environment variable named `CATALINA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/appdynamics/javaagent.jar -Dappdynamics.agent.applicationName=<app-name>` where `<app-name>` is your App Service name. If you already have an environment variable for `CATALINA_OPTS`, append the `-javaagent:/...` option to the end of the current value.
150+
151+
::: zone-end
152+
153+
::: zone pivot="java-jboss"
154+
155+
For **JBoss EAP**, `[TODO]`.
156+
157+
::: zone-end
158+
159+
# [Linux](#tab/linux)
160+
161+
1. Create an AppDynamics account at [AppDynamics.com](https://www.appdynamics.com/community/register/)
162+
2. Download the Java agent from the AppDynamics website. The file name is similar to *AppServerAgent-x.x.x.xxxxx.zip*
163+
3. [SSH into your App Service instance](configure-linux-open-ssh-session.md) and create a new directory */home/site/wwwroot/apm*.
164+
4. Upload the Java agent files into a directory under */home/site/wwwroot/apm*. The files for your agent should be in */home/site/wwwroot/apm/appdynamics*.
165+
5. In the Azure portal, browse to your application in App Service and create a new Application Setting.
166+
167+
::: zone pivot="java-javase"
168+
169+
Create an environment variable named `JAVA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/appdynamics/javaagent.jar -Dappdynamics.agent.applicationName=<app-name>` where `<app-name>` is your App Service name. If you already have an environment variable for `JAVA_OPTS`, append the `-javaagent:/...` option to the end of the current value.
170+
171+
::: zone-end
172+
173+
::: zone pivot="java-tomcat"
174+
175+
Create an environment variable named `CATALINA_OPTS` with the value `-javaagent:/home/site/wwwroot/apm/appdynamics/javaagent.jar -Dappdynamics.agent.applicationName=<app-name>` where `<app-name>` is your App Service name. If you already have an environment variable for `CATALINA_OPTS`, append the `-javaagent:/...` option to the end of the current value.
176+
177+
::: zone-end
178+
179+
::: zone pivot="java-jboss"
180+
181+
For **JBoss EAP**, `[TODO]`.
182+
183+
::: zone-end
184+
185+
---
186+
187+
## Configure Datadog
188+
189+
# [Windows](#tab/windows)
190+
* The configuration options are different depending on which Datadog site your organization is using. See the official [Datadog Integration for Azure Documentation](https://docs.datadoghq.com/integrations/azure/)
191+
192+
# [Linux](#tab/linux)
193+
* The configuration options are different depending on which Datadog site your organization is using. See the official [Datadog Integration for Azure Documentation](https://docs.datadoghq.com/integrations/azure/)
194+
195+
---
196+
197+
## Configure Dynatrace
198+
199+
# [Windows](#tab/windows)
200+
* Dynatrace provides an [Azure Native Dynatrace Service](https://www.dynatrace.com/monitoring/technologies/azure-monitoring/). To monitor Azure App Services using Dynatrace, see the official [Dynatrace for Azure documentation](https://docs.datadoghq.com/integrations/azure/)
201+
202+
# [Linux](#tab/linux)
203+
* Dynatrace provides an [Azure Native Dynatrace Service](https://www.dynatrace.com/monitoring/technologies/azure-monitoring/). To monitor Azure App Services using Dynatrace, see the official [Dynatrace for Azure documentation](https://docs.datadoghq.com/integrations/azure/)
204+
205+
---
206+
207+
## Next steps
208+
209+
Visit the [Azure for Java Developers](/java/azure/) center to find Azure quickstarts, tutorials, and Java reference documentation.
210+
211+
- [App Service Linux FAQ](faq-app-service-linux.yml)
212+
- [Environment variables and app settings reference](reference-app-settings.md)

0 commit comments

Comments
 (0)