技能 appinsights-instrumentation
📊

appinsights-instrumentation

安全

為 Azure 應用程式新增 Application Insights 遙測

此技能提供逐步指引,說明如何使用 Azure Application Insights 檢測 Web 應用程式,包括 SDK 設定、組態,以及 ASP.NET Core、Node.js 和 Python 應用程式的遙測模式。

支援: Claude Codex Code(CC)
🥇 83 黃金
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「appinsights-instrumentation」。 如何為我的 Node.js 應用程式新增 App Insights?

預期結果:

  • Install the Azure Monitor package: npm install @azure/monitor-opentelemetry
  • Add this to your main entry file: const { useAzureMonitor } = require('@azure/monitor-opentelemetry');
  • Call setup early in your app: useAzureMonitor();
  • Set the connection string environment variable: APPLICATIONINSIGHTS_CONNECTION_STRING

正在使用「appinsights-instrumentation」。 什麼是建立 Application Insights 的 Bicep 範本?

預期結果:

  • Create a Log Analytics Workspace resource
  • Create the Application Insights resource with kind: 'web'
  • Link it to the workspace using WorkspaceResourceId
  • Output the connection string for use in your app configuration

安全審計

安全
v1 • 2/21/2026

This is an official Microsoft skill providing Azure Application Insights instrumentation guidance. All 49 static findings are false positives: weak crypto alerts triggered by Azure SKU names (PerGB2018) and API versions; backtick detections are markdown code blocks; path traversal alerts are relative markdown links; environment variable access is the Azure-recommended pattern for connection strings. No actual security risks identified.

12
已掃描檔案
374
分析行數
0
發現項
1
審計總數
未發現安全問題
審計者: claude

品質評分

73
架構
100
可維護性
87
內容
50
社群
100
安全
91
規範符合性

你能建構什麼

DevOps 工程師為 Azure Web 應用程式新增監控

DevOps 工程師需要為在 Azure App Service 上執行的現有 ASP.NET Core 應用程式新增 Application Insights。此技能提供逐步 SDK 設定和組態指引。

開發人員學習 App Insights 檢測

開發人員想了解如何使用 OpenTelemetry 為 Azure Monitor 檢測其 Node.js 應用程式。此技能提供快速入門指南和最佳實務。

需要 Azure 監控協助的 Claude Code 使用者

Claude Code 使用者詢問如何為其 Python 應用程式新增遙測。此技能提供 Python 特定的 SDK 設定和連線字串設定說明。

試試這些提示

基本檢測問題
如何為我的 Azure Web 應用程式新增 Application Insights 遙測?
ASP.NET Core 設定
示範如何使用 OpenTelemetry SDK 在我的 ASP.NET Core 應用程式中設定 Application Insights。
Node.js 組態
在我的 Node.js 應用程式中新增 Azure Monitor OpenTelemetry 的程式碼是什麼?我需要哪些環境變數?
Azure App Service 自動檢測
如何為我在 Azure App Service 中托管的應用程式啟用自動檢測,而不需要修改程式碼?

最佳實務

  • 使用環境變數設定連線字串,而非在組態檔案中硬編碼
  • 在應用程式啟動時儘早呼叫監控設定
  • 建議使用可用的 OpenTelemetry Distro 套件以簡化組態

避免

  • 不要修改 appsettings.json 來設定 App Insights(已淘汰的方法)
  • 不要在原始程式碼中硬編碼連線字串
  • 不要為高流量應用程式略過取樣設定

常見問題

什麼是 Application Insights?
Application Insights 是 Azure Monitor 的功能,提供應用程式效能監控 (APM)、遙測收集和診斷,適用於在 Azure 或內部部署環境執行的應用程式。
我需要修改程式碼才能使用 App Insights 嗎?
對於 Azure App Service 應用程式,您可以使用自動檢測而不需要修改程式碼。對於其他情況,您需要新增 SDK 並在程式碼中呼叫設定方法。
我要如何取得連線字串?
連線字串可在 Azure 入口網站中 Application Insights 資源的屬性下取得,或者您可以使用 Azure CLI 搭配 appinsights 命令來取得。
支援哪些語言?
此技能涵蓋 ASP.NET Core、Node.js 和 Python,並提供 Java 和 TypeScript 應用程式的參考。
自動檢測和手動檢測有什麼區別?
自動檢測不需要修改程式碼,但僅支援 Azure App Service。手動檢測需要 SDK 整合,但適用於任何托管環境。
我可以使用此技能建立 App Insights 資源嗎?
不行,此技能僅提供指引。若要建立實際的 Azure 資源,請叫用 azure-prepare 技能來協調元件變更。