Join our Newsletter — 33% off our NHI Course
Home› Guides› Azure Monitor and Log Analytics Security Guide: Workspace…
Guide Cloud Security

Azure Monitor and Log Analytics Security Guide: Workspace Access, Retention and Ingestion

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 18 November 2026 14 min read
On this page

A Log Analytics workspace holds the evidence for every investigation in Azure, so who can read it, who can write to it, how long it keeps data and which identities feed it are security decisions, not just monitoring settings. This guide covers the workspace itself: access control modes and roles, table-level and granular access, workspace shared keys, retention design, data collection rules and transformations, the identities behind the Azure Monitor Agent and the Logs Ingestion API, and network isolation with Azure Monitor Private Link Scope.

Getting platform logs into the workspace in the first place, through the Activity Log and diagnostic settings, is covered separately in the Azure Monitor, Activity Log and Diagnostic Settings Guide. This page picks up once the data is arriving.

This is an independent guide from NHI Mgmt Group, based on Microsoft's public documentation as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.

Key takeaways

  • Check each workspace's access control mode. Workspaces created before March 2019 default to requiring workspace permissions; newer ones allow resource or workspace permissions, which enables resource-context access for application teams.
  • Log Analytics Contributor is more powerful than it sounds. It can read storage account keys and its VM extension permissions can grant full control of a virtual machine.
  • Workspace shared keys are static credentials that let anyone send data into your workspace. Remove the need for them and limit who can read them.
  • Default analytics retention is 30 days for most tables. Set analytics and total retention per table based on investigation needs, up to 730 days interactive and 12 years total.
  • Data collection rules are control-plane resources that decide what is collected, transformed and routed. Write access to a DCR is the ability to blind a detection.
  • The Logs Ingestion API authenticates with an Entra app and needs the Monitoring Metrics Publisher role on the DCR. Scope that role to one DCR per sender.
  • Azure Monitor Private Link Scope in Private Only mode prevents a network from reaching Azure Monitor resources outside your scope, which closes an exfiltration path.

Why the workspace is a security boundary

Attackers who reach a cloud estate tend to do two things with logging: read it, to learn what defenders can see, and change it, so that their activity is not recorded. Changing collection maps to ATT&CK T1685 Disable or Modify Tools. Both depend on identities. Service principals and managed identities with broad Contributor rights at subscription scope can usually alter diagnostic settings, data collection rules and workspace retention without any human being involved.

The workspace also concentrates sensitive data. Sign-in logs, security events, command lines and application traces often contain usernames, IP addresses, tokens accidentally logged by applications, and connection strings. Read access to a busy workspace is close to read access to the estate's secrets history. That is the reason for treating workspace access with the same rigour as Key Vault access.

Access control modes and access modes

Two settings interact, and confusing them is the most common cause of either over-sharing or broken access.

The access control mode is a workspace property you change on its Properties page:

  • Require workspace permissions. Users need permissions on the workspace or on specific tables. Resource permissions do not grant access. This is the default for workspaces created before March 2019.
  • Use resource or workspace permissions. Enables granular Azure RBAC. Resource-context queries check only resource permissions; workspace-context queries check workspace permissions. This is the default for workspaces created after March 2019.

The access mode depends on where a user opens Logs. Opening Logs from the workspace or the Azure Monitor menu gives workspace context, covering every table the user can access, intended for central administration. Opening Logs from a resource's menu gives resource context, limited to data for the resources, resource group or subscription the user can read, intended for application teams. Records appear in resource context only if _ResourceId is populated.

For a shared central workspace, NHI Mgmt Group recommends the resource or workspace permissions mode, with application teams using resource context and only the security and platform teams holding workspace-level read. That lets an application owner see their own logs without seeing sign-in logs or other teams' data. Check that custom tables written through the ingestion API populate _ResourceId where resource context matters, or those rows will only be visible at workspace level.

Roles, table access and the shared key permission

Microsoft's built-in roles for Log Analytics have different blast radii:

RoleWhat it allowsNotes
Log Analytics Data ReaderThe minimum permissions for running queriesIntended for use with granular RBAC
Log Analytics ReaderView and search all monitoring data and settingsExcludes reading workspace shared keys
Log Analytics ContributorReader rights plus editing monitoring settings, managing solutions, reading storage account keys, running search jobs and restoring from long-term retentionIts VM extension permission can grant full control of a VM
Privileged Monitoring Data ReaderAccess to protected tablesPreview at the time of writing

Treat Log Analytics Contributor as a privileged role. A pipeline identity that only needs to deploy saved queries or alert rules should not hold it at subscription scope, because the same role can install VM extensions, which is code execution on every VM in scope.

For table-level control, Microsoft recommends granular RBAC, which uses role assignment conditions for table and row level access. The older method grants per-table read actions in custom roles. Microsoft documents a subtle trap with the older method: a NotAction that blocks one table only works inside the same role that grants the read. If the user also inherits a general read permission from Reader or Contributor, they can still read the blocked table. Audit for broad inherited roles before relying on table restrictions.

The Microsoft.OperationalInsights/workspaces/sharedKeys/action permission lets a holder read the workspace keys used to send data. Anyone with the key can write data into the workspace, which means they can plant misleading records or flood a table. Restrict that permission to the smallest possible group, rotate keys when you no longer need them, and move senders to authenticated ingestion through data collection rules, which Microsoft describes as more secure than workspace keys.

Retention design: analytics, long-term and deletion

Retention is where security needs and cost collide, so it is often left at the default. That default is short. Analytics retention is 30 days for all tables except a set kept for 90 days at no charge, which includes AzureActivity, Usage and the Application Insights tables. Most identity investigations reach back further than 30 days, because dwell time for credential misuse is often measured in months.

The model has two layers:

  • Analytics retention (interactive queries) can be set at workspace default or per table, up to 730 days.
  • Total retention can be set per table up to 12 years (4,383 days). Data between the end of analytics retention and the end of total retention is long-term retention and is reached through search jobs or restore.

Behaviours to know before you change anything:

  • Shortening total retention waits 30 days before removing data, so mistakes can be reverted inside that window.
  • Reducing analytics retention moves the remainder into long-term retention rather than deleting it, provided total retention covers it.
  • The Azure CLI parameter for total retention supports up to 2,556 days; longer values need the portal, REST API or a supporting PowerShell version.
  • Basic tables are only queryable for a fixed 30 days; Auxiliary tables are queryable for their full total retention.
  • Deleting a custom log table reserves the name for 15 days; Auxiliary data in that table is permanently deleted after 15 days.

A practical baseline from NHI Mgmt Group: keep sign-in, audit and Activity Log tables at least one year in analytics retention where budget allows, with total retention matched to your regulatory requirement, and keep high-volume verbose tables short in analytics with longer total retention. Changes to retention settings should themselves raise an alert, because shortening retention is a quiet way to destroy evidence. Map these choices to NIST SP 800-53 AU-11 Audit Record Retention.

Data collection rules: the control plane of collection

A data collection rule is a reusable control-plane resource that defines what is collected, its schema, optional transformations and where it is routed. Telemetry does not flow through the DCR; agents and services read it and apply its instructions. A data collection rule association connects one resource to one DCR, and the relationship is many-to-many, so one DCR may govern collection for hundreds of machines.

That shared design is efficient and risky. Anyone who can edit a widely associated DCR can stop collecting security events across a fleet, or add a transformation that drops specific records. Microsoft advises reviewing a shared DCR's associations before changing it; from a security point of view, the same review belongs in your change control:

  • Manage DCRs as code, deployed by a pipeline identity scoped to the resource group that holds them.
  • Keep security-relevant DCRs (Windows security events, Linux audit, Sysmon) separate from application DCRs so application teams never need write access to them.
  • Alert on DCR writes and DCR association deletes from the Activity Log.
  • Review transformations as carefully as detection rules. A filter clause that removes noisy events can also remove the one event an investigation needs.

Transformations are also a privacy and secrets control. Microsoft describes them as a way to filter or modify data, for example to remove or redact sensitive fields. Use an ingestion-time transformation to strip tokens, keys and connection strings that applications write into logs, so the workspace does not become a secondary secret store. A workspace transformation DCR applies directly to the workspace for data that does not otherwise pass through a DCR.

Machine identities that write to the workspace

Every source of data is an identity, and each needs least privilege.

Azure Monitor Agent. The agent runs on Azure and hybrid machines, retrieves its associated DCRs at install and checks for updates periodically. It can be deployed through a VM extension, Azure Policy or features such as VM insights, and non-Azure machines are supported through Azure Arc. The agent is the supported path; the Log Analytics agent is legacy and Microsoft provides migration guidance. Machines still running the legacy agent typically authenticate with the workspace ID and key, which is another reason to finish migration. For Arc-connected machines, the machine's own identity becomes part of your estate, covered in the Azure Arc-Enabled Servers Security Guide.

Logs Ingestion API. Custom applications and third-party tools send data through the Logs Ingestion API, which replaces the legacy Data Collector API. A client sends a payload to an ingestion endpoint and names the DCR in the request URI. Microsoft's documentation describes authenticating with an Entra app registration using the client credentials flow, with the token audience https://monitor.azure.com in the public cloud, and granting the app the Monitoring Metrics Publisher role on the DCR. From 1 March 2026 the API enforces TLS 1.2 or higher.

Controls for ingestion identities, as NHI Mgmt Group recommendations:

  • One app registration per sending system, with Monitoring Metrics Publisher assigned on that system's DCR only, never on a resource group or subscription.
  • Prefer certificate or federated credentials over client secrets where the sending platform supports them, and give any secret a short expiry. The How to replace Azure app secrets with federated credentials walkthrough shows the pattern.
  • Record the owner of each ingestion app, and disable apps whose source system is retired. An orphaned ingestion credential can be used to inject false records.
  • Where data arrives from outside Azure, record source IP ranges and alert on ingestion from new ranges.

The general review of who holds what in Azure is covered in the Azure RBAC and Service Principals Guide.

An Azure Monitor Private Link Scope defines the boundary of your monitoring network. A virtual network connects to it through a private endpoint, and clients then reach the workspaces, data collection endpoints and Application Insights resources in the scope over the Azure backbone. Each scope has separate access modes for ingestion and for queries:

  • Open lets the network reach resources in the scope and Azure Monitor resources outside it. It suits gradual onboarding but does not prevent exfiltration.
  • Private Only lets the network reach only resources in the scope. Microsoft describes it as the most secure option and the one that prevents data exfiltration.

The exfiltration point matters for machine identities. In Open mode, a compromised workload could send collected data to an attacker-controlled workspace in another tenant over the same Azure Monitor endpoints your firewall already allows. Private Only removes that path. Pair it with egress controls in the Azure Firewall Security Guide.

DNS is the main design constraint. Query endpoints are shared across all workspaces, so adding one resource changes DNS resolution for every Log Analytics workspace queried from that network. Microsoft recommends a single scope for all networks that share the same DNS, because multiple scopes cause the Azure Monitor DNS zones to override each other and can break existing environments. Note too that a data collection endpoint is needed for the Logs Ingestion API when you use Private Link, and the DCR, workspace and endpoint must be in the same region.

Monitoring the monitor

The workspace needs its own detections, ideally sent to a second workspace or a SIEM that the same administrators cannot alter. Start with these, as NHI Mgmt Group recommendations:

  • Changes to workspace retention, table retention or table plans.
  • Changes to the access control mode, and new role assignments on the workspace.
  • Any read of workspace shared keys.
  • DCR writes, DCR association deletes and new or changed transformations.
  • New app registrations granted Monitoring Metrics Publisher.
  • A sudden drop in event volume from a table or a group of machines, which is often the first sign that collection was changed.
  • Large exports, search jobs or restores run by identities that do not normally run them.

These map to NIST SP 800-53 AU-6 Audit Record Review, Analysis, and Reporting and to AU-9 protection of audit information.

Common failure patterns

  • Old workspace, old mode. A workspace from before 2019 still requires workspace permissions, so every application team was given workspace-wide read.
  • Contributor as a convenience role. A monitoring pipeline holds Log Analytics Contributor at subscription scope and can install VM extensions everywhere.
  • Table restrictions undone by inherited roles. A custom role blocks a sensitive table but the user also holds Reader.
  • Shared key in scripts. Workspace keys sit in automation scripts long after the original sender was migrated.
  • 30-day retention on identity tables. An investigation starts after the evidence has aged out.
  • One DCR, everyone can edit. A fleet-wide DCR is in a resource group where application teams hold Contributor.
  • Secrets in logs. Applications log bearer tokens and connection strings, and no transformation removes them.
  • Ingestion app with wide scope. Monitoring Metrics Publisher is granted at subscription scope, so one credential can write to every DCR.
  • Private Link left in Open mode. Onboarding finished a year ago but the mode never moved to Private Only.

Practitioner checklist

  • List every workspace and record its access control mode, retention defaults, owners and linked Private Link Scope.
  • Move shared workspaces to resource or workspace permissions mode and give application teams resource-context access only.
  • Remove Log Analytics Contributor from pipeline identities that do not need VM extension rights.
  • Use granular RBAC for sensitive tables and check for inherited broad read roles.
  • Restrict the shared key permission and migrate senders to DCR-based ingestion.
  • Set analytics and total retention per table, with identity and audit tables kept at least a year.
  • Manage DCRs as code, separate security DCRs from application DCRs, and alert on DCR changes.
  • Add transformations that redact tokens, keys and connection strings.
  • Give each Logs Ingestion API sender its own app with Monitoring Metrics Publisher on one DCR.
  • Move Private Link Scopes to Private Only for both ingestion and queries once onboarding is complete.

Standards and references

Related NHI Mgmt Group resources: Azure Monitor, Activity Log and Diagnostic Settings Guide · Azure RBAC and Service Principals Guide · Azure Arc-Enabled Servers Security Guide · Microsoft Azure Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.