Skip to content
Report library
Purpose / Other

Appinsights Instrumentation Skill Security Audit

What the author says it does (original text)

Guidance for instrumenting webapps with Azure Application Insights. Provides telemetry patterns, SDK setup, and configuration references. WHEN: how to instrument app, App Insights SDK, telemetry patterns, what is App Insights, Application Insights guidance, instrumentation examples, APM best practices.

Independent security check

Security risks found

Files checked
13
Risks found
4
Could it run dangerous commands?Looks for programs run straight after downloading, remote control of your computer, and hidden commands.No risks found
Could it expose your files or keys?Looks for uploads of files containing passwords or keys, and keys written directly in the code.Risks found: 2
Medium risk

Application logs and request traces are sent to centralized Azure storage

Source references: 3
What we found

The guide enables the Application Insights SDK and states that console logs contain everything written to stdout/stderr, while request-level tracing captures timing and dependencies. Applications in one Container Apps environment share a workspace.

Why this matters

If the application logs personal data, tokens, request bodies, or other secrets, that information may enter a shared Azure workspace and become visible to principals with workspace read access.

The guide directs users to configure a connection string and add a telemetry SDK. Once enabled, request traces, response times, and dependencies can be sent to Application Insights. It also says everything written to stdout/stderr becomes console logs and that apps in one environment share a Log Analytics workspace. Logs containing personal data, tokens, or business content could therefore be centrally retained. Users can ask about collection scope, redaction, sampling, retention, and Azure access controls.

references/container-apps.md:26In the instructionsOpen original file
> 💡 **Tip:** All apps in the same environment share the workspace. Use `--logs-destination none` only for BYOB (bring-your-own-backend) scenarios.## System Logs vs Application Logs| Log Table | Content | Retention ||-----------|---------|-----------|| `ContainerAppConsoleLogs_CL` | stdout/stderr from containers | Workspace default || `ContainerAppSystemLogs_CL` | Platform events (scaling, restarts, image pulls) | Workspace default |> ⚠️ **Note:** The `_CL` suffix and `_s` column suffixes apply to the **Log Analytics** destination. Environments using the newer **Azure Monitor** destination use `ContainerAppConsoleLogs` / `ContainerAppSystemLogs` (no `_CL`, no `_s` suffixes). Check your environment's log destination to use the correct table name.System logs capture events outside your code—replica scheduling, health probe results, and revision activation. Console logs capture everything your app writes to stdout/stderr.
Show 2 other places
references/container-apps.md:52In the instructionsOpen original file
> ⚠️ **Warning:** Built-in metrics cover infrastructure only. For request-level tracing, response times, and dependency tracking, add Application Insights SDK.## Application Insights SDK SetupSet `APPLICATIONINSIGHTS_CONNECTION_STRING` as an environment variable on the container app, then add the SDK per language:
references/container-apps.md:37In the instructionsOpen original file
System logs capture events outside your code—replica scheduling, health probe results, and revision activation. Console logs capture everything your app writes to stdout/stderr.
Medium risk

The generic CLI example prints and passes the Application Insights connection string in plaintext

Source references: 4
What we found

The script queries the connection string to standard output and passes `$key=$value` as a command argument when changing application settings. This can place the value in terminal output, automation logs, or process arguments. A separate container example uses secretref, but the generic script does not.

Why this matters

Someone able to read the relevant output or execution environment could obtain the telemetry ingestion credential, potentially inject false telemetry or cause additional data ingestion into that Application Insights resource.

The generic script prints the connection string as TSV and places an arbitrary `$key=$value` in Azure CLI arguments. If `$value` is the Application Insights connection string, it may appear in terminal history, CI logs, or process arguments. A container-specific guide offers a safer secret/secretref pattern, but that does not remove exposure when the generic commands are used for other services. Users can require suppressed output, log masking, and Azure secret references or protected variables.

scripts/appinsights.ps1:9In the codeOpen original file
# Query connection string of App Insightsaz monitor app-insights component show --app $applicationInsightsResourceName --resource-group $resourceGroupName --query connectionString --output tsv# Set environment variable of App Serviceaz webapp config appsettings set --resource-group $resourceGroupName --name $appName --settings $key=$value
Show 3 other places
references/aspnetcore.md:19In the instructionsOpen original file
The App Insights resource has a connection string. Add the connection string as an environment variable of the running app. You can use Azure CLI to query the connection string of the App Insights resource. See [scripts/appinsights.ps1](../scripts/appinsights.ps1) for what Azure CLI command to execute for querying the connection string.After getting the connection string, set this environment variable with its value.```"APPLICATIONINSIGHTS_CONNECTION_STRING={your_application_insights_connection_string}"```If the app has IaC template such as Bicep or terraform files representing its cloud instance, this environment variable should be added to the IaC template to be applied in each deployment. Otherwise, use Azure CLI to manually apply the environment variable to the cloud instance of the app. See [scripts/appinsights.ps1](../scripts/appinsights.ps1) for what Azure CLI command to execute for setting this environment variable.
references/container-apps.md:65In the instructionsOpen original file
```bash# Store as a secret (recommended — keeps value out of az show output and portal config)az containerapp secret set -n <app-name> -g <rg> \  --secrets "appinsights-conn=<conn-string>"az containerapp update \  --name <app-name> \  --resource-group <rg> \  --set-env-vars "APPLICATIONINSIGHTS_CONNECTION_STRING=secretref:appinsights-conn"```
scripts/appinsights.ps1:15In the codeOpen original file
# Set environment variable of Container App# Or update an existing container appaz containerapp update -n $containerAppName -g $resourceGroupName --set-env-vars $key=$value# Set environment variable of Function Appaz functionapp config appsettings set --name $functionName --resource-group $ResourceGroupName --settings $key=$value
Could it delete files or keep running?Looks for broad file deletion, disk overwrites, and programs set to start automatically.Risks found: 1
Medium risk

The “reference only” boundary conflicts with later modification and deployment instructions

Source references: 5
What we found

The introduction says component additions must use azure-prepare and that this Skill only provides reference material, but later instructs manual resource creation, code updates, and deployment after modification.

Why this matters

If an agent treats the later instructions as authorization, it could change dependencies, entry-point code, or infrastructure files—and initiate deployment—when the user only asked for guidance.

There is a genuine authorization-boundary conflict. The introduction says this Skill is reference-only and component additions belong to `azure-prepare`, but later instructions direct manual creation of cloud resources and application-code updates, linking concrete scripts and modification guides. An agent following the later imperative text could alter files or Azure resources when the user requested guidance only. Users can require this Skill to remain read-only and permit changes only after explicit implementation approval and target confirmation.

SKILL.md:12In the instructionsOpen original file
This skill provides **guidance and reference material** for instrumenting webapps with Azure Application Insights.> **⛔ ADDING COMPONENTS?**>> If the user wants to **add App Insights to their app**, invoke **azure-prepare** instead.> This skill provides reference material—azure-prepare orchestrates the actual changes.
Show 4 other places
SKILL.md:50In the instructionsOpen original file
### Manually instrumentManually instrument the app by creating the AppInsights resource and update the app's code. #### Create AppInsights resourceUse one of the following options that fits the environment.- Add AppInsights to existing Bicep template. See [examples/appinsights.bicep](examples/appinsights.bicep) for what to add. This is the best option if there are existing Bicep template files in the workspace.- Use Azure CLI. See [scripts/appinsights.ps1](scripts/appinsights.ps1) for what Azure CLI command to execute to create the App Insights resource.
references/aspnetcore.md:10In the instructionsOpen original file
- Configure the app to use Azure MonitorAn ASP.NET Core app typically has a Program.cs file that "builds" the app. Find this file and apply these changes.  - Add `using Azure.Monitor.OpenTelemetry.AspNetCore;` at the top  - Before calling `builder.Build()`, add this line `builder.Services.AddOpenTelemetry().UseAzureMonitor();`.> Note: since we modified the code of the app, the app needs to be deployed to take effect.
SKILL.md:26In the instructionsOpen original file
## When to Use azure-prepare Instead- User says "add telemetry to my app"- User says "add App Insights" - User wants to modify their project- Any request to change/add components
SKILL.md:63In the instructionsOpen original file
#### Modify application code- If the app is an ASP.NET Core app, see [ASPNETCORE guide](references/aspnetcore.md) for how to modify the C# code.- If the app is a Node.js app, see [NODEJS guide](references/nodejs.md) for how to modify the JavaScript/TypeScript code.- If the app is a Python app, see [PYTHON guide](references/python.md) for how to modify the Python code.
Could it bypass safety checks?Looks for skipped website security checks, excessive file access, or actions that skip your approval.No risks found
Could it mislead the AI or hide text?Checks the skill instructions for requests to ignore you, influence the report, or hide text in invisible characters.No risks found
Could it change links or payment recipients without asking?Looks for forced referral or payment changes combined with instructions to hide the change.Risks found: 1
Medium risk

The examples create potentially billable Azure resources and alter live application settings

Source references: 6
What we found

The script creates a Log Analytics workspace and Application Insights component, then changes settings on an App Service, Container App, or Function App. The Bicep example selects the usage-priced PerGB2018 SKU.

Why this matters

Execution in an authenticated Azure account creates persistent resources, potential usage charges, and production configuration changes. Incorrect resource-group or application names could affect unintended services.

This risk is conditional on the examples actually being executed. The script creates a Log Analytics workspace and an Application Insights component and can change live settings for App Service, Container Apps, or Function Apps; the Bicep example selects the `PerGB2018` SKU. Resource creation and telemetry storage may incur Azure charges, while configuration changes can affect application behavior. Users should constrain the subscription, resource group, app names, region, and budget and request a preview of affected resources.

scripts/appinsights.ps1:3In the codeOpen original file
## Add the Application Insights extensionaz extension add -n application-insights## Create a Log Analytics workspaceaz monitor log-analytics workspace create --resource-group $resourceGroupName --workspace-name $logAnalyticsWorkspaceName --location $azureRegionName## Create the Application Insights resourceaz monitor app-insights component create --app $applicationInsightsResourceName --location $azureRegionName --resource-group $resourceGroupName --workspace $logAnalyticsWorkspaceName
Show 5 other places
scripts/appinsights.ps1:12In the codeOpen original file
# Set environment variable of App Serviceaz webapp config appsettings set --resource-group $resourceGroupName --name $appName --settings $key=$value# Set environment variable of Container App# Or update an existing container appaz containerapp update -n $containerAppName -g $resourceGroupName --set-env-vars $key=$value# Set environment variable of Function Appaz functionapp config appsettings set --name $functionName --resource-group $ResourceGroupName --settings $key=$value
examples/appinsights.bicep:7In the instructionsOpen original file
// Create Log Analytics Workspaceresource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {  name: '${name}-workspace'  location: location  properties: {    sku: {      name: 'PerGB2018'    }    retentionInDays: 30  }
SKILL.md:56In the instructionsOpen original file
Use one of the following options that fits the environment.- Add AppInsights to existing Bicep template. See [examples/appinsights.bicep](examples/appinsights.bicep) for what to add. This is the best option if there are existing Bicep template files in the workspace.- Use Azure CLI. See [scripts/appinsights.ps1](scripts/appinsights.ps1) for what Azure CLI command to execute to create the App Insights resource.
scripts/appinsights.ps1:4In the codeOpen original file
az extension add -n application-insights## Create a Log Analytics workspaceaz monitor log-analytics workspace create --resource-group $resourceGroupName --workspace-name $logAnalyticsWorkspaceName --location $azureRegionName## Create the Application Insights resourceaz monitor app-insights component create --app $applicationInsightsResourceName --location $azureRegionName --resource-group $resourceGroupName --workspace $logAnalyticsWorkspaceName
examples/appinsights.bicep:12In the instructionsOpen original file
  properties: {    sku: {      name: 'PerGB2018'    }    retentionInDays: 30  }

Inside this skill

6 instruction sections

The Skill describes itself as reference guidance and says actual Application Insights additions should be handled by azure-prepare, but later provides direct instructions to create cloud resources, modify code, and deploy.

View source
SKILL.md:12In the instructionsOpen original file
This skill provides **guidance and reference material** for instrumenting webapps with Azure Application Insights.> **⛔ ADDING COMPONENTS?**>> If the user wants to **add App Insights to their app**, invoke **azure-prepare** instead.> This skill provides reference material—azure-prepare orchestrates the actual changes.
SKILL.md:50In the instructionsOpen original file
### Manually instrumentManually instrument the app by creating the AppInsights resource and update the app's code. #### Create AppInsights resourceUse one of the following options that fits the environment.- Add AppInsights to existing Bicep template. See [examples/appinsights.bicep](examples/appinsights.bicep) for what to add. This is the best option if there are existing Bicep template files in the workspace.- Use Azure CLI. See [scripts/appinsights.ps1](scripts/appinsights.ps1) for what Azure CLI command to execute to create the App Insights resource.

Its implementation path installs Azure/OpenTelemetry packages, initializes monitoring during application startup, and connects the application to Application Insights through an environment variable.

View source
references/nodejs.md:5In the instructionsOpen original file
- Install client library```npm install @azure/monitor-opentelemetry```- Configure the app to use Azure MonitorA Node.js app typically has an entry file that is listed as the "main" property in package.json. Find this file and apply these changes in it.  - Require the client library at the top. `const { useAzureMonitor } = require("@azure/monitor-opentelemetry");`  - Call the setup method. `useAzureMonitor();`> Note: The setup method should be called as early as possible but it must be after the environment variables are configured since it needs the App Insights connection string from the environment variable. For example, if the app uses dotenv to load environment variables, the setup method should be called after it but before anything else.> Note: since we modified the code of the app, it needs to be deployed to take effect.
references/container-apps.md:54In the instructionsOpen original file
## Application Insights SDK SetupSet `APPLICATIONINSIGHTS_CONNECTION_STRING` as an environment variable on the container app, then add the SDK per language:| Language | Package | Init Pattern ||----------|---------|-------------|| Node.js | `@azure/monitor-opentelemetry` | Call `useAzureMonitor()` before app startup || Python | `azure-monitor-opentelemetry` | Call `configure_azure_monitor()` at entry || .NET | `Azure.Monitor.OpenTelemetry.AspNetCore` | `builder.Services.AddOpenTelemetry().UseAzureMonitor()` || Java | Agent JAR (manual) | Set `JAVA_TOOL_OPTIONS=-javaagent:/agent/applicationinsights-agent.jar` |

The container guide distinguishes infrastructure metrics, console logs, and request-level tracing, and states that all applications in one Container Apps environment share the logging workspace.

View source
references/container-apps.md:26In the instructionsOpen original file
> 💡 **Tip:** All apps in the same environment share the workspace. Use `--logs-destination none` only for BYOB (bring-your-own-backend) scenarios.## System Logs vs Application Logs| Log Table | Content | Retention ||-----------|---------|-----------|| `ContainerAppConsoleLogs_CL` | stdout/stderr from containers | Workspace default || `ContainerAppSystemLogs_CL` | Platform events (scaling, restarts, image pulls) | Workspace default |> ⚠️ **Note:** The `_CL` suffix and `_s` column suffixes apply to the **Log Analytics** destination. Environments using the newer **Azure Monitor** destination use `ContainerAppConsoleLogs` / `ContainerAppSystemLogs` (no `_CL`, no `_s` suffixes). Check your environment's log destination to use the correct table name.System logs capture events outside your code—replica scheduling, health probe results, and revision activation. Console logs capture everything your app writes to stdout/stderr.
references/container-apps.md:41In the instructionsOpen original file
Container Apps exposes these metrics without any SDK:| Metric | Description | Dimensions ||--------|-------------|-----------|| `Replicas` | Current replica count | `revision` || `Requests` | HTTP request count | `statusCode`, `statusCodeCategory`, `revision`, `replica` || `UsageNanoCores` | CPU usage per replica | `revision`, `replica` || `WorkingSetBytes` | Memory usage per replica | `revision`, `replica` || `RestartCount` | Container restart count | `revision`, `replica` || `RxBytes` / `TxBytes` | Network I/O | `revision`, `replica` |> ⚠️ **Warning:** Built-in metrics cover infrastructure only. For request-level tracing, response times, and dependency tracking, add Application Insights SDK.
Start here · InstructionsSKILL.md
appinsights-instrumentation
Lines connect the instruction file to its sections, not an observed execution order. Select a section to read the source.

File reference map

References: 14
Files making referencesReferenced content
Lines show actual file references, not execution order. Select a node to highlight its connections and inspect the files and source locations. Dashed lines include files that still need locating.
Files and check records13 files

Coverage and gaps

Content covered in each file

These are the source ranges included in this check, not a guarantee that every issue has been resolved.

  • SKILL.mdFull text included
  • scripts/appinsights.ps1Full text included
  • examples/appinsights.bicepFull text included
  • references/aspnetcore.mdFull text included
  • references/auto.mdFull text included
  • references/container-apps.mdFull text included
  • references/nodejs.mdFull text included
  • references/python.mdFull text included
  • references/sdk/azure-monitor-opentelemetry-exporter-java.mdFull text included
  • references/sdk/azure-monitor-opentelemetry-exporter-py.mdFull text included
  • references/sdk/azure-monitor-opentelemetry-py.mdFull text included
  • references/sdk/azure-monitor-opentelemetry-ts.mdFull text included
  • LICENSE.txtFull text included

This report is for the version above. We read the available code and instructions without running the skill or checking extra packages it installs. This is not a promise of safety: a different version or setup may behave differently.

  • LICENSE.txtLicense
  • SKILL.mdInstructions
  • examples/appinsights.bicepSupporting file
  • references/aspnetcore.mdSupporting file
  • references/auto.mdSupporting file
  • references/container-apps.mdSupporting file
  • references/nodejs.mdSupporting file
  • references/python.mdSupporting file
  • references/sdk/azure-monitor-opentelemetry-exporter-java.mdSupporting file
  • references/sdk/azure-monitor-opentelemetry-exporter-py.mdSupporting file
  • references/sdk/azure-monitor-opentelemetry-py.mdSupporting file
  • references/sdk/azure-monitor-opentelemetry-ts.mdSupporting file
  • scripts/appinsights.ps1Script

Operations mentioned in code and instructions

Connect to websites
references/auto.md:3In the instructionsOpen original file
Use Azure Portal to auto-instrument a webapp hosted in Azure App Service for App Insights without making any code changes. Only the following types of app can be auto-instrumented. See [supported environments and resource providers](https://learn.microsoft.com/azure/azure-monitor/app/codeless-overview#supported-environments-languages-and-resource-providers).
references/auto.md:10In the instructionsOpen original file
```https://portal.azure.com/#resource/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Web/sites/{app_service_name}/monitoringSettings```
Run commands
references/container-apps.md:9In the instructionsOpen original file
```bashWORKSPACE_ID=$(az monitor log-analytics workspace show \
references/container-apps.md:65In the instructionsOpen original file
```bash# Store as a secret (recommended — keeps value out of az show output and portal config)
references/sdk/azure-monitor-opentelemetry-exporter-py.md:8In the instructionsOpen original file
## Install```bashpip install azure-monitor-opentelemetry-exporter
Read keys or account settings
references/container-apps.md:123In the instructionsOpen original file
| mv-expand container = properties.template.containers| mv-expand envVar = container.env| where isnotempty(envVar)
references/sdk/azure-monitor-opentelemetry-ts.md:15In the instructionsOpen original file
  azureMonitorExporterOptions: {    connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING  }
Install extra software packages
references/nodejs.md:7In the instructionsOpen original file
```npm install @azure/monitor-opentelemetry```
references/python.md:7In the instructionsOpen original file
```pip install azure-monitor-opentelemetry```
references/sdk/azure-monitor-opentelemetry-exporter-py.md:9In the instructionsOpen original file
```bashpip install azure-monitor-opentelemetry-exporter```
Lines read
563
File checksum (to compare versions)
b1a391a6a27b29a4d7dbe373bee5a7cf06fbca29de0f8c7629a4e610ce6c8459