Reputation: 1
I'm currently working on configuring the Azure Monitor Application Insights Agent on my local machine, following the documentation provided at https://learn.microsoft.com/en-us/azure/azure-monitor/app/application-insights-asp-net-agent?tabs=api-reference. I have set up an Application Insights resource in the azure portal.
I've executed the command to enable monitoring:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process -Force
Enable-ApplicationInsightsMonitoring -ConnectionString 'InstrumentationKey=00000000-0000-0000-0000-000000000123;IngestionEndpoint=https://xxxx.applicationinsights.azure.com/'
However, I've noticed that only the local apps hosted on Azure (in production) are getting instrumented when I run them locally. I can confirm this by running the following command:
`Get-ApplicationInsightsMonitoringStatus`
Here's a snippet of the output:
`AppName : Default Web Site
VirtualPath : /
ApplicationPoolName : DefaultAppPool
SiteId : 1
SiteState : Started
ProcessId :
AppName : website1.local
VirtualPath : /
ApplicationPoolName : website1.local
SiteId : 2
SiteState : Started
ProcessId : 40128
Instrumented : true
ConnectionString : InstrumentationKey=00000000-0000-0000-0000-000000000123;IngestionEndpoint=https://uksouth-1.in.applicationinsights.azure.com/;LiveEndpoint=https://uksouth.livediagnostics.monitor.azure.com/;ApplicationId=00034567-0001-4338-abe8-00000000123
AppName : website2.local
VirtualPath : /
ApplicationPoolName : website2.local
SiteId : 3
SiteState : Started
ProcessId : 32516`
My goal is to target and instrument only website2.local. I've attempted to achieve this using the following command:
`Enable-ApplicationInsightsMonitoring -InstrumentationKeyMap @(
@{
MachineFilter='.*';
AppFilter='website2.local';
InstrumentationSettings=@{
InstrumentationKey='00000000-0000-0000-0000-000000000123'
}
}
)`
My expectation was that this command would target the specific local site website2.local for instrumentation. However, despite configuring the command with the settings from the docummentation, the expected outcome of exclusive instrumentation for website2.local was not achieved?
However, despite trying various configurations, I haven't been successful in instrumenting website2.local.
Do I need to configure something at the application level to achieve this? I am using .net framework and MVC applications.
Thanks
Upvotes: 0
Views: 229
Reputation: 471
I think somehow you've code containing connection string within website1.local deployed thats why it is instrumenting your website1.local application also. You can simply navigate to your website1.local and remove app settings(connection string or setting with name "APPINSIGHTS_INSTRUMENTATIONKEY". Reference: https://azuredevopslabs.com/labs/vsts/monitor/ Hope this helps.
Upvotes: 0