From 382b5da2a730f494f8bc45426e7c4abf0752bec3 Mon Sep 17 00:00:00 2001 From: HarshCasper Date: Tue, 17 Mar 2026 15:59:10 +0530 Subject: [PATCH] add Azure Monitor service doc --- src/content/docs/azure/services/insights.mdx | 11 - src/content/docs/azure/services/monitor.mdx | 220 +++++++++++++++++++ 2 files changed, 220 insertions(+), 11 deletions(-) delete mode 100644 src/content/docs/azure/services/insights.mdx create mode 100644 src/content/docs/azure/services/monitor.mdx diff --git a/src/content/docs/azure/services/insights.mdx b/src/content/docs/azure/services/insights.mdx deleted file mode 100644 index d3a2e974..00000000 --- a/src/content/docs/azure/services/insights.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Insights" -description: API coverage for Microsoft.Insights in LocalStack for Azure. -template: doc ---- - -import AzureFeatureCoverage from "../../../../components/feature-coverage/AzureFeatureCoverage"; - -## API Coverage - - diff --git a/src/content/docs/azure/services/monitor.mdx b/src/content/docs/azure/services/monitor.mdx new file mode 100644 index 00000000..35ecac0c --- /dev/null +++ b/src/content/docs/azure/services/monitor.mdx @@ -0,0 +1,220 @@ +--- +title: "Monitor" +description: Get started with Azure Monitor on LocalStack +template: doc +--- + +import AzureFeatureCoverage from "../../../../components/feature-coverage/AzureFeatureCoverage"; + +## Introduction + +Azure Monitor is a platform service for collecting, analyzing, and acting on telemetry from Azure resources and applications. +It helps you inspect activity logs and configure diagnostic settings for operational visibility. +These capabilities are useful for troubleshooting, auditing, and observability workflows. + +LocalStack for Azure provides a local environment for building and testing applications that make use of Azure Monitor. +The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of Monitor's integration with LocalStack. + +## Getting started + +This guide is designed for users new to Azure Monitor and assumes basic knowledge of the Azure CLI and our `azlocal` wrapper script. + +Start your LocalStack container using your preferred method. For more information, see [Introduction to LocalStack for Azure](/azure/getting-started/). + +:::note +As an alternative to using the `azlocal` CLI, users can run: + +`azlocal start-interception` + +This command points the `az` CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API. +To revert this configuration, run: + +`azlocal stop-interception` + +This reconfigures the `az` CLI to send commands to the official Azure management REST API. At this time, there is no full parity between `azlocal` and `az` commands after running `az start-interception`. Therefore, this technique is not fully interchangeable. +::: + +### Create a resource group + +Create a resource group to contain your Monitor demo resources: + +```bash +azlocal group create \ + --name rg-monitor-demo \ + --location westeurope +``` + +```bash title="Output" +{ + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monitor-demo", + "location": "westeurope", + "managedBy": null, + "name": "rg-monitor-demo", + "properties": { + "provisioningState": "Succeeded" + }, + "tags": null, + "type": "Microsoft.Resources/resourceGroups" +} +``` + +### Create a storage account + +Create a storage account to use as a diagnostic settings destination: + +```bash +azlocal storage account create \ + --name stmonitordoc79 \ + --resource-group rg-monitor-demo \ + --location westeurope \ + --sku Standard_LRS +``` + +```bash title="Output" +{ + ... + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monitor-demo/providers/Microsoft.Storage/storageAccounts/stmonitordoc79", + ... + "name": "stmonitordoc79", + ... + "primaryEndpoints": { + "blob": "https://stmonitordoc79blob.localhost.localstack.cloud:4566", + ... + "table": "https://stmonitordoc79table.localhost.localstack.cloud:4566", + ... + }, + ... +} +``` + +### List activity logs + +List recent activity logs from the subscription: + +```bash +azlocal monitor activity-log list --max-events 5 +``` + +```bash title="Output" +[ + { + "caller": "00000000-0000-0000-0000-000000000000", + "category": { + "value": "Administrative", + ... + }, + "eventName": { + "value": "EndRequest", + ... + }, + "eventTimestamp": "2026-03-17T07:34:43.230050", + "resourceGroupName": "rg-monitor-demo", + "resourceProviderName": { + "value": "Microsoft.Resources", + ... + }, + ... + }, + ... +] +``` + +### Create and inspect diagnostic settings + +Get the resource group resource ID: + +```bash +RESOURCE_ID=$(azlocal group show \ + --name rg-monitor-demo \ + --query id \ + --output tsv) +``` + +Create diagnostic settings for the resource group: + +```bash +azlocal monitor diagnostic-settings create \ + --name rg-monitor-demo \ + --resource "$RESOURCE_ID" \ + --storage-account stmonitordoc79 \ + --logs '[{"category":"Administrative","enabled":true}]' +``` + +```bash title="Output" +{ + "id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monitor-demo/providers/microsoft.insights/diagnosticSettings/rg-monitor-demo", + "name": "rg-monitor-demo", + "logs": [ + { + "category": "Administrative", + "enabled": true + } + ], + "metrics": [], + "storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monitor-demo/providers/microsoft.Storage/storageAccounts/stmonitordoc79", + "type": "microsoft.insights/diagnosticSettings" +} +``` + +Get the diagnostic setting: + +```bash +azlocal monitor diagnostic-settings show \ + --name rg-monitor-demo \ + --resource "$RESOURCE_ID" +``` + +```bash title="Output" +{ + "id": "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-monitor-demo/providers/microsoft.insights/diagnosticSettings/rg-monitor-demo", + "name": "rg-monitor-demo", + "logs": [ + { + "category": "Administrative", + "enabled": true + } + ], + "metrics": [], + ... +} +``` + +### Update and delete diagnostic settings + +Update diagnostic settings to include an additional category: + +```bash +azlocal monitor diagnostic-settings update \ + --name rg-monitor-demo \ + --resource "$RESOURCE_ID" \ + --logs '[{"category":"Administrative","enabled":true},{"category":"Security","enabled":false}]' +``` + +```bash title="Output" +{ + "name": "rg-monitor-demo", + "logs": [ + { + "category": "Administrative", + "enabled": true + }, + { + "category": "Security", + "enabled": false + } + ], + ... +} +``` + +Delete the diagnostic setting: + +```bash +azlocal monitor diagnostic-settings delete \ + --name rg-monitor-demo \ + --resource "$RESOURCE_ID" +``` + +## API Coverage + +