Skip to content

Commit eb46d2e

Browse files
committed
Merging changes synced from https://github.com/MicrosoftDocs/azure-docs-pr (branch live)
2 parents 919a9d0 + 63c7ef9 commit eb46d2e

12 files changed

+283
-222
lines changed

.openpublishing.redirection.azure-monitor.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5531,6 +5531,11 @@
55315531
"source_path_from_root": "/articles/azure-monitor/app/export-data-model.md",
55325532
"redirect_url": "/azure/azure-monitor/app/export-telemetry",
55335533
"redirect_document_id": false
5534+
},
5535+
{
5536+
"source_path_from_root": "/articles/azure-monitor/app/custom-endpoints.md",
5537+
"redirect_url": "/azure/azure-monitor/app/create-new-resource",
5538+
"redirect_document_id": false
55345539
}
55355540
]
55365541
}

articles/azure-government/compare-azure-government-global-azure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ Application Insights (part of Azure Monitor) enables the same features in both A
290290

291291
**Visual Studio** - In Azure Government, you can enable monitoring on your ASP.NET, ASP.NET Core, Java, and Node.js based applications running on Azure App Service. For more information, see [Application monitoring for Azure App Service overview](../azure-monitor/app/azure-web-apps.md). In Visual Studio, go to Tools|Options|Accounts|Registered Azure Clouds|Add New Azure Cloud and select Azure US Government as the Discovery endpoint. After that, adding an account in File|Account Settings will prompt you for which cloud you want to add from.
292292

293-
**SDK endpoint modifications** - In order to send data from Application Insights to an Azure Government region, you'll need to modify the default endpoint addresses that are used by the Application Insights SDKs. Each SDK requires slightly different modifications, as described in [Application Insights overriding default endpoints](../azure-monitor/app/custom-endpoints.md).
293+
**SDK endpoint modifications** - In order to send data from Application Insights to an Azure Government region, you'll need to modify the default endpoint addresses that are used by the Application Insights SDKs. Each SDK requires slightly different modifications, as described in [Application Insights overriding default endpoints](../azure-monitor/app/create-new-resource.md#application-insights-overriding-default-endpoints).
294294

295295
**Firewall exceptions** - Application Insights uses several IP addresses. You might need to know these addresses if the app that you're monitoring is hosted behind a firewall. For more information, see [IP addresses used by Azure Monitor](../azure-monitor/app/ip-addresses.md) from where you can download Azure Government IP addresses.
296296

articles/azure-monitor/alerts/itsmc-definition.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ When you create or edit an Azure alert rule, use an action group, which has an I
131131
> * The short description field in the alert rule definition is limited to 40 characters when you send it by using the ITSM action.
132132
>
133133
> * In case you have policies for inbound traffic for your ServiceNow instances, add ActionGroup service tag to allowList.
134+
>
135+
> * Notice that when you are defining a query in Log Search alerts you need to have in the query result the Configuration items names with one of the label names "Computer", "Resource", "_ResourceId" or "ResourceId”. This mapping will enable to map the configuration items to the ITSM payload
134136
135137
## Next steps
136138

articles/azure-monitor/alerts/itsmc-troubleshoot-overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ The following sections identify common symptoms, possible causes, and resolution
111111

112112
**Resolution**:
113113
* Check if the alert is a log alert. If it isn't a log alert, configuration items are not supported.
114-
* If the search results do not have a Computer or Resource column, add them to the query.
114+
* If the search results do not have a Computer or Resource column, add them to the query. When you are defining a query in Log Search alerts you need to have in the query result the Configuration items names with one of the label names "Computer", "Resource", "_ResourceId" or "ResourceId”. This mapping will enable to map the configuration items to the ITSM payload
115115
* Check that the values in the Computer and Resource columns are identical to the values in the CMDB. If they are not, add a new entry to the CMDB with the matching values.

articles/azure-monitor/app/create-new-resource.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,194 @@ az monitor app-insights component create --app demoApp --location eastus --kind
153153

154154
For the full Azure CLI documentation for this command, and to learn how to retrieve the instrumentation key consult the [Azure CLI documentation](/cli/azure/monitor/app-insights/component#az-monitor-app-insights-component-create).
155155

156+
## Application Insights overriding default endpoints
157+
158+
> [!WARNING]
159+
> Endpoint modification is not recommended. [Transition to connection strings](migrate-from-instrumentation-keys-to-connection-strings.md#migrate-from-application-insights-instrumentation-keys-to-connection-strings) to simplify configuration and eliminate the need for endpoint modification.
160+
161+
To send data from Application Insights to certain regions, you'll need to override the default endpoint addresses. Each SDK requires slightly different modifications, all of which are described in this article. These changes require adjusting the sample code and replacing the placeholder values for `QuickPulse_Endpoint_Address`, `TelemetryChannel_Endpoint_Address`, and `Profile_Query_Endpoint_address` with the actual endpoint addresses for your specific region. The end of this article contains links to the endpoint addresses for regions where this configuration is required.
162+
163+
[!INCLUDE [azure-monitor-log-analytics-rebrand](../../../includes/azure-monitor-instrumentation-key-deprecation.md)]
164+
165+
166+
---
167+
168+
### SDK code changes
169+
170+
# [.NET](#tab/net)
171+
172+
> [!NOTE]
173+
> The applicationinsights.config file is automatically overwritten anytime a SDK upgrade is performed. After performing an SDK upgrade be sure to re-enter the region specific endpoint values.
174+
175+
```xml
176+
<ApplicationInsights>
177+
...
178+
<TelemetryModules>
179+
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse.QuickPulseTelemetryModule, Microsoft.AI.PerfCounterCollector">
180+
<QuickPulseServiceEndpoint>Custom_QuickPulse_Endpoint_Address</QuickPulseServiceEndpoint>
181+
</Add>
182+
</TelemetryModules>
183+
...
184+
<TelemetrySinks>
185+
<Add Name = "default">
186+
<TelemetryChannel>
187+
<EndpointAddress>TelemetryChannel_Endpoint_Address</EndpointAddress>
188+
</TelemetryChannel>
189+
</Add>
190+
</TelemetrySinks>
191+
...
192+
<ApplicationIdProvider Type="Microsoft.ApplicationInsights.Extensibility.Implementation.ApplicationId.ApplicationInsightsApplicationIdProvider, Microsoft.ApplicationInsights">
193+
<ProfileQueryEndpoint>Profile_Query_Endpoint_address</ProfileQueryEndpoint>
194+
</ApplicationIdProvider>
195+
...
196+
</ApplicationInsights>
197+
```
198+
199+
# [.NET Core](#tab/netcore)
200+
201+
Modify the appsettings.json file in your project as follows to adjust the main endpoint:
202+
203+
```json
204+
"ApplicationInsights": {
205+
"InstrumentationKey": "instrumentationkey",
206+
"TelemetryChannel": {
207+
"EndpointAddress": "TelemetryChannel_Endpoint_Address"
208+
}
209+
}
210+
```
211+
212+
The values for Live Metrics and the Profile Query Endpoint can only be set via code. To override the default values for all endpoint values via code, make the following changes in the `ConfigureServices` method of the `Startup.cs` file:
213+
214+
```csharp
215+
using Microsoft.ApplicationInsights.Extensibility.Implementation.ApplicationId;
216+
using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse; //Place at top of Startup.cs file
217+
218+
services.ConfigureTelemetryModule<QuickPulseTelemetryModule>((module, o) => module.QuickPulseServiceEndpoint="QuickPulse_Endpoint_Address");
219+
220+
services.AddSingleton<IApplicationIdProvider, ApplicationInsightsApplicationIdProvider>(_ => new ApplicationInsightsApplicationIdProvider() { ProfileQueryEndpoint = "Profile_Query_Endpoint_address" });
221+
222+
services.AddSingleton<ITelemetryChannel>(_ => new ServerTelemetryChannel() { EndpointAddress = "TelemetryChannel_Endpoint_Address" });
223+
224+
//Place in the ConfigureServices method. Place this before services.AddApplicationInsightsTelemetry("instrumentation key"); if it's present
225+
```
226+
227+
# [Azure Functions](#tab/functions)
228+
229+
For Azure Functions it is now recommended to use [connection strings](./sdk-connection-string.md?tabs=net) set in the Function's Application settings. To access Application settings for your function from within the functions pane select **Settings** > **Configuration** > **Application settings**.
230+
231+
Name: `APPLICATIONINSIGHTS_CONNECTION_STRING`
232+
Value: `Connection String Value`
233+
234+
# [Java](#tab/java)
235+
236+
Modify the applicationinsights.xml file to change the default endpoint address.
237+
238+
```xml
239+
<?xml version="1.0" encoding="utf-8"?>
240+
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
241+
<InstrumentationKey>ffffeeee-dddd-cccc-bbbb-aaaa99998888</InstrumentationKey>
242+
<TelemetryModules>
243+
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebRequestTrackingTelemetryModule"/>
244+
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebSessionTrackingTelemetryModule"/>
245+
<Add type="com.microsoft.applicationinsights.web.extensibility.modules.WebUserTrackingTelemetryModule"/>
246+
</TelemetryModules>
247+
<TelemetryInitializers>
248+
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationIdTelemetryInitializer"/>
249+
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebOperationNameTelemetryInitializer"/>
250+
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebSessionTelemetryInitializer"/>
251+
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserTelemetryInitializer"/>
252+
<Add type="com.microsoft.applicationinsights.web.extensibility.initializers.WebUserAgentTelemetryInitializer"/>
253+
</TelemetryInitializers>
254+
<!--Add the following Channel value to modify the Endpoint address-->
255+
<Channel type="com.microsoft.applicationinsights.channel.concrete.inprocess.InProcessTelemetryChannel">
256+
<EndpointAddress>TelemetryChannel_Endpoint_Address</EndpointAddress>
257+
</Channel>
258+
</ApplicationInsights>
259+
```
260+
261+
### Spring Boot
262+
263+
Modify the `application.properties` file and add:
264+
265+
```yaml
266+
azure.application-insights.channel.in-process.endpoint-address= TelemetryChannel_Endpoint_Address
267+
```
268+
269+
# [Node.js](#tab/nodejs)
270+
271+
```javascript
272+
var appInsights = require("applicationinsights");
273+
appInsights.setup('INSTRUMENTATION_KEY');
274+
appInsights.defaultClient.config.endpointUrl = "TelemetryChannel_Endpoint_Address"; // ingestion
275+
appInsights.defaultClient.config.profileQueryEndpoint = "Profile_Query_Endpoint_address"; // appid/profile lookup
276+
appInsights.defaultClient.config.quickPulseHost = "QuickPulse_Endpoint_Address"; //live metrics
277+
appInsights.Configuration.start();
278+
```
279+
280+
The endpoints can also be configured through environment variables:
281+
282+
```
283+
Instrumentation Key: "APPINSIGHTS_INSTRUMENTATIONKEY"
284+
Profile Endpoint: "Profile_Query_Endpoint_address"
285+
Live Metrics Endpoint: "QuickPulse_Endpoint_Address"
286+
```
287+
288+
# [JavaScript](#tab/js)
289+
290+
The current Snippet (listed below) is version "5", the version is encoded in the snippet as sv:"#" and the [current version is also available on GitHub](https://go.microsoft.com/fwlink/?linkid=2156318).
291+
292+
```html
293+
<script type="text/javascript">
294+
!function(T,l,y){var S=T.location,k="script",D="instrumentationKey",C="ingestionendpoint",I="disableExceptionTracking",E="ai.device.",b="toLowerCase",w="crossOrigin",N="POST",e="appInsightsSDK",t=y.name||"appInsights";(y.name||T[e])&&(T[e]=t);var n=T[t]||function(d){var g=!1,f=!1,m={initialize:!0,queue:[],sv:"5",version:2,config:d};function v(e,t){var n={},a="Browser";return n[E+"id"]=a[b](),n[E+"type"]=a,n["ai.operation.name"]=S&&S.pathname||"_unknown_",n["ai.internal.sdkVersion"]="javascript:snippet_"+(m.sv||m.version),{time:function(){var e=new Date;function t(e){var t=""+e;return 1===t.length&&(t="0"+t),t}return e.getUTCFullYear()+"-"+t(1+e.getUTCMonth())+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+"."+((e.getUTCMilliseconds()/1e3).toFixed(3)+"").slice(2,5)+"Z"}(),iKey:e,name:"Microsoft.ApplicationInsights."+e.replace(/-/g,"")+"."+t,sampleRate:100,tags:n,data:{baseData:{ver:2}}}}var h=d.url||y.src;if(h){function a(e){var t,n,a,i,r,o,s,c,u,p,l;g=!0,m.queue=[],f||(f=!0,t=h,s=function(){var e={},t=d.connectionString;if(t)for(var n=t.split(";"),a=0;a<n.length;a++){var i=n[a].split("=");2===i.length&&(e[i[0][b]()]=i[1])}if(!e[C]){var r=e.endpointsuffix,o=r?e.location:null;e[C]="https://"+(o?o+".":"")+"dc."+(r||"services.visualstudio.com")}return e}(),c=s[D]||d[D]||"",u=s[C],p=u?u+"/v2/track":d.endpointUrl,(l=[]).push((n="SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)",a=t,i=p,(o=(r=v(c,"Exception")).data).baseType="ExceptionData",o.baseData.exceptions=[{typeName:"SDKLoadFailed",message:n.replace(/\./g,"-"),hasFullStack:!1,stack:n+"\nSnippet failed to load ["+a+"] -- Telemetry is disabled\nHelp Link: https://go.microsoft.com/fwlink/?linkid=2128109\nHost: "+(S&&S.pathname||"_unknown_")+"\nEndpoint: "+i,parsedStack:[]}],r)),l.push(function(e,t,n,a){var i=v(c,"Message"),r=i.data;r.baseType="MessageData";var o=r.baseData;return o.message='AI (Internal): 99 message:"'+("SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details) ("+n+")").replace(/\"/g,"")+'"',o.properties={endpoint:a},i}(0,0,t,p)),function(e,t){if(JSON){var n=T.fetch;if(n&&!y.useXhr)n(t,{method:N,body:JSON.stringify(e),mode:"cors"});else if(XMLHttpRequest){var a=new XMLHttpRequest;a.open(N,t),a.setRequestHeader("Content-type","application/json"),a.send(JSON.stringify(e))}}}(l,p))}function i(e,t){f||setTimeout(function(){!t&&m.core||a()},500)}var e=function(){var n=l.createElement(k);n.src=h;var e=y[w];return!e&&""!==e||"undefined"==n[w]||(n[w]=e),n.onload=i,n.onerror=a,n.onreadystatechange=function(e,t){"loaded"!==n.readyState&&"complete"!==n.readyState||i(0,t)},n}();y.ld<0?l.getElementsByTagName("head")[0].appendChild(e):setTimeout(function(){l.getElementsByTagName(k)[0].parentNode.appendChild(e)},y.ld||0)}try{m.cookie=l.cookie}catch(p){}function t(e){for(;e.length;)!function(t){m[t]=function(){var e=arguments;g||m.queue.push(function(){m[t].apply(m,e)})}}(e.pop())}var n="track",r="TrackPage",o="TrackEvent";t([n+"Event",n+"PageView",n+"Exception",n+"Trace",n+"DependencyData",n+"Metric",n+"PageViewPerformance","start"+r,"stop"+r,"start"+o,"stop"+o,"addTelemetryInitializer","setAuthenticatedUserContext","clearAuthenticatedUserContext","flush"]),m.SeverityLevel={Verbose:0,Information:1,Warning:2,Error:3,Critical:4};var s=(d.extensionConfig||{}).ApplicationInsightsAnalytics||{};if(!0!==d[I]&&!0!==s[I]){var c="onerror";t(["_"+c]);var u=T[c];T[c]=function(e,t,n,a,i){var r=u&&u(e,t,n,a,i);return!0!==r&&m["_"+c]({message:e,url:t,lineNumber:n,columnNumber:a,error:i}),r},d.autoExceptionInstrumented=!0}return m}(y.cfg);function a(){y.onInit&&y.onInit(n)}(T[t]=n).queue&&0===n.queue.length?(n.queue.push(a),n.trackPageView({})):a()}(window,document,{
295+
src: "https://js.monitor.azure.com/scripts/b/ai.2.min.js", // The SDK URL Source
296+
// name: "appInsights", // Global SDK Instance name defaults to "appInsights" when not supplied
297+
// ld: 0, // Defines the load delay (in ms) before attempting to load the sdk. -1 = block page load and add to head. (default) = 0ms load after timeout,
298+
// useXhr: 1, // Use XHR instead of fetch to report failures (if available),
299+
crossOrigin: "anonymous", // When supplied this will add the provided value as the cross origin attribute on the script tag
300+
// onInit: null, // Once the application insights instance has loaded and initialized this callback function will be called with 1 argument -- the sdk instance (DO NOT ADD anything to the sdk.queue -- As they won't get called)
301+
cfg: { // Application Insights Configuration
302+
instrumentationKey:"INSTRUMENTATION_KEY",
303+
endpointUrl: "TelemetryChannel_Endpoint_Address"
304+
}});
305+
</script>
306+
```
307+
308+
> [!NOTE]
309+
> For readability and to reduce possible JavaScript errors, all of the possible configuration options are listed on a new line in snippet code above, if you don't want to change the value of a commented line it can be removed.
310+
311+
# [Python](#tab/python)
312+
313+
For guidance on modifying the ingestion endpoint for the opencensus-python SDK consult the [opencensus-python repo.](https://github.com/census-instrumentation/opencensus-python/blob/af284a92b80bcbaf5db53e7e0813f96691b4c696/contrib/opencensus-ext-azure/opencensus/ext/azure/common/__init__.py)
314+
315+
---
316+
317+
### Regions that require endpoint modification
318+
319+
Currently the only regions that require endpoint modifications are [Azure Government](../../azure-government/compare-azure-government-global-azure.md#application-insights) and [Azure China](/azure/china/resources-developer-guide).
320+
321+
|Region | Endpoint Name | Value |
322+
|-----------------|:------------|:-------------|
323+
| Azure China | Telemetry Channel | `https://dc.applicationinsights.azure.cn/v2/track` |
324+
| Azure China | QuickPulse (Live Metrics) |`https://live.applicationinsights.azure.cn/QuickPulseService.svc` |
325+
| Azure China | Profile Query |`https://dc.applicationinsights.azure.cn/api/profiles/{0}/appId` |
326+
| Azure Government | Telemetry Channel |`https://dc.applicationinsights.us/v2/track` |
327+
| Azure Government | QuickPulse (Live Metrics) |`https://quickpulse.applicationinsights.us/QuickPulseService.svc` |
328+
| Azure Government | Profile Query |`https://dc.applicationinsights.us/api/profiles/{0}/appId` |
329+
330+
If you currently use the [Application Insights REST API](https://dev.applicationinsights.io/
331+
) which is normally accessed via `api.applicationinsights.io' you will need to use an endpoint that is local to your region:
332+
333+
|Region | Endpoint Name | Value |
334+
|-----------------|:------------|:-------------|
335+
| Azure China | REST API | `api.applicationinsights.azure.cn` |
336+
| Azure Government | REST API | `api.applicationinsights.us`|
337+
156338
## Next steps
157339
* [Diagnostic Search](./diagnostic-search.md)
158340
* [Explore metrics](../essentials/metrics-charts.md)
159341
* [Write Analytics queries](../logs/log-query-overview.md)
342+
* To learn more about the custom modifications for Azure Government, consult the detailed guidance for [Azure monitoring and management](../../azure-government/compare-azure-government-global-azure.md#application-insights).
343+
* To learn more about Azure China, consult the [Azure China Playbook](/azure/china/).
160344

161345
<!--Link references-->
162346

0 commit comments

Comments
 (0)