← ClaudeAtlas

instrumenting-azure-app-insightslisted

Provisions workspace-based Azure Application Insights with a dailyQuotaGb cost cap and optional metric alerts (5xx spikes, server exceptions) on an Action Group. Outputs the connection string for app settings wiring (APPLICATIONINSIGHTS_CONNECTION_STRING). Use when adding observability to a project, replacing classic non-workspace App Insights (which is retiring), or setting up failure alerts that email an on-call owner.
alexpizarro/azure-lean-stack-skills · ★ 1 · DevOps & Infrastructure · score 72
Install: claude install-skill alexpizarro/azure-lean-stack-skills
# Instrumenting Azure Application Insights Workspace-based Application Insights with cost guardrails. Classic (non-workspace) App Insights is retiring, so this is the only forward-compatible setup. ## When to invoke - Adding observability to a new project - Migrating off classic Application Insights - Setting up failure-rate alerts that page an owner - Auditing observability cost on an existing app ## The two-resource setup App Insights now sits on top of a Log Analytics workspace: ``` Log Analytics Workspace ← cost guardrail lives here (dailyQuotaGb) ↑ │ WorkspaceResourceId │ Application Insights component ← what the SDK talks to ↑ │ APPLICATIONINSIGHTS_CONNECTION_STRING │ Your app's instrumented SDK ``` Workspace owns: - Retention (`retentionInDays: 30` default; max 730) - Daily quota cap (`workspaceCapping.dailyQuotaGb: 1`) - All actual data storage App Insights component owns: - The connection string the SDK uses - Per-app filtering / sampling rules ## Cost guardrail: `dailyQuotaGb` The single most important setting. Without it, a runaway log loop can ingest 100+ GB and bill hundreds of dollars overnight. ```bicep resource workspace 'Microsoft.OperationalInsights/workspaces@2023-09-01' = { properties: { sku: { name: 'PerGB2018' } retentionInDays: 30 workspaceCapping: { dailyQuotaGb: 1 } // ← hard daily cap } } ``` Rule of thumb: - Hobby / low-traffic: 1 GB/day cap (~$2/month at default rates) - S