Manage Microsoft Sentinel analytics rules programmatically via the REST API

domain: learn.microsoft.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Authenticate with Entra ID using a service principal and obtain a token for the Azure management audience (management.azure.com).
  2. List existing alert rules with GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules?api-version=2025-09-01.
  3. Create or update a scheduled analytics rule with PUT to the same base path appended with /{ruleId}, supplying a JSON body with kind, displayName, query, queryFrequency, queryPeriod, triggerOperator, triggerThreshold, severity, and tactics fields.
  4. Enable or disable a rule by PATCHing the enabled property on the rule object.
  5. Export rules to ARM JSON for GitOps: retrieve each rule via GET, strip read-only fields, and store the body as a parameterized ARM template in version control.

Known gotchas

Related routes

Run CloudWatch Logs Insights queries programmatically via the AWS API
docs.aws.amazon.com · 5 steps · unrated
Create Kibana alerting rules programmatically via the Alerting API
www.elastic.co · 5 steps · unrated
Ingest custom logs into Microsoft Sentinel via the Logs Ingestion API with a DCR
learn.microsoft.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans