Azure / azure-policy

Repository for Azure Resource Policy built-in definitions and samples
MIT License
1.47k stars 1.07k forks source link

Feature Request: Detect Application Insights usage within a Web Application #1060

Open Michael-Malek opened 1 year ago

Michael-Malek commented 1 year ago

Details of the scenario you tried and the problem that is occurring

It would be nice if we could detect application insights usage within a web application.

Suggested solution to the issue

  1. If we could read appsettings for a Web app to detect "APPINSIGHTS_INSTRUMENTATIONKEY" ->Currently "Microsoft.Web/sites/config/appSettings" cannot return keys within the application settings
  2. If there was a value that could be used to check appinsights with it's own command. -> Currently there is a "Microsoft.Web/sites/config/ftpsState" that can detect FTPS state. having something similar for insights would be useful.
jper commented 4 months ago

I'm facing the same issue I have tried to workaround it as described in this readme https://github.com/Azure/azure-policy?tab=readme-ov-file#resource-type-query-results-incomplete-missing-or-non-standard-format using Microsoft.Web/sites/config/web.appsettings[*] and eventhough the policy definition is accepted as valid, it does not return anything.

Are there any workarounds so we can make a policy that checks that a function has application insights configured?