
Cloud
Learning Level
Azure Monitor provides comprehensive monitoring, alerting, and diagnostics for Azure resources and applications.
By the end of this lesson, you'll understand:
# Create Application Insights
az monitor app-insights component create \
--app myappinsights \
--location eastus \
--resource-group myResourceGroup \
--application-type webNode.js:
const appInsights = require("applicationinsights");
appInsights.setup("<instrumentation-key>")
.setAutoDependencyCorrelation(true)
.setAutoCollectRequests(true)
.setAutoCollectPerformance(true)
.setAutoCollectExceptions(true)
.start();
const client = appInsights.defaultClient;
// Track events
client.trackEvent({
name: "UserSignup",
properties: {email: "user@example.com"}
});
// Track exceptions
try {
// code
} catch (error) {
client.trackException({error});
}# Create metric alert
az monitor metrics alert create \
--name "High CPU Alert" \
--resource-group myResourceGroup \
--scopes /subscriptions/.../myVM \
--condition "avg Percentage CPU > 80" \
--description "Alert when CPU exceeds 80%"# Get metrics
az monitor metrics list \
--resource /subscriptions/.../myVM \
--metric "Percentage CPU" \
--start-time 2024-01-01T00:00:00 \
--end-time 2024-01-31T23:59:59 \
--interval PT1HLearn about Azure Identity for access control, or explore cost optimization strategies.
Resources
Ojasa Mirai
Master AI-powered development skills through structured learning, real projects, and verified credentials. Whether you're upskilling your team or launching your career, we deliver the skills companies actually need.
Learn Deep • Build Real • Verify Skills • Launch Forward