Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Instrument your web apps with Azure Application Insights for telemetry and monitoring.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/appinsights.ps1
1# Create App Insights resource (3 steps)2## Add the Application Insights extension3az extension add -n application-insights4## Create a Log Analytics workspace5az monitor log-analytics workspace create --resource-group $resourceGroupName --workspace-name $logAnalyticsWorkspaceName --location $azureRegionName6## Create the Application Insights resource7az monitor app-insights component create --app $applicationInsightsResourceName --location $azureRegionName --resource-group $resourceGroupName --workspace $logAnalyticsWorkspaceName89# Query connection string of App Insights10az monitor app-insights component show --app $applicationInsightsResourceName --resource-group $resourceGroupName --query connectionString --output tsv1112# Set environment variable of App Service13az webapp config appsettings set --resource-group $resourceGroupName --name $appName --settings $key=$value1415# Set environment variable of Container App16# Or update an existing container app17az containerapp update -n $containerAppName -g $resourceGroupName --set-env-vars $key=$value1819# Set environment variable of Function App20az functionapp config appsettings set --name $functionName --resource-group $ResourceGroupName --settings $key=$value21