Skip to content

04 / 13Governance and logging

Microsoft Defender for Cloud security hardening

Harden Microsoft Defender for Cloud: CSPM and workload plans enforced by policy, alert routing, continuous export, secure score triage and governance rules.

Service
Defender for Cloud
Category
Governance and logging
Baseline
11 controls
Updated
Published on 12 min read
On this page

Microsoft Defender for Cloud is two products under one name. The first is cloud security posture management (CSPM): it continuously assesses your Azure configuration against the Microsoft cloud security benchmark (MCSB) and turns the results into recommendations and a secure score. The second is a set of workload protection plans (Defender for Servers, Storage, Key Vault, Resource Manager, Containers and others) that detect threats at runtime and raise security alerts. Left at defaults, you get only the free Foundational CSPM tier: recommendations nobody owns, no runtime detection on the control plane, alert emails going to whoever happened to be subscription owner on day one, and alert history that is not exported anywhere. That is how a stolen token used from an anonymizing proxy, or a malware upload to a storage account, goes unnoticed for weeks. This page maps to the Logging and Threat Detection (LT), Incident Response (IR) and Posture and Vulnerability Management (PV) domains of the MCSB, and to the Microsoft Defender section of the CIS Microsoft Azure Foundations Benchmark.

Baseline controls

CIS numbers refer to the CIS Microsoft Azure Foundations Benchmark v7.0.0.

ControlWhyHow to checkID
Defender CSPM on every subscriptionAttack paths, agentless scanning and governance need the paid tieraz security pricing show -n CloudPostureMCSB PV-2 / CIS 8.1.1.1
Workload plans for Servers, Storage, Key Vault, Resource ManagerRuntime detection on the control plane and on data storesaz security pricing list -o tableMCSB LT-1 / CIS 8.1.3.1, 8.1.5.1, 8.1.8.1, 8.1.9.1
Plans enforced at management group scopeNew subscriptions are covered without a manual stepPolicy compliance of the Defender initiativeMCSB LT-1
Security contacts and alert emailsAlerts reach a monitored mailbox, not a former employeeaz security contact listMCSB IR-2 / CIS 8.1.14, 8.1.15, 8.1.16
Continuous export to Log AnalyticsAlert and recommendation history, queryable in KQLaz security automation listMCSB LT-5 / CIS 8.1.12
Defender XDR and Sentinel integrationAlerts become correlated incidentsDefender portal incident queueMCSB IR-3
Vulnerability assessment and agentless scanningKnown CVEs on VMs and images are found without agentssecurityresources query on sub-assessmentsMCSB PV-5 / CIS 8.1.3.2, 8.1.3.4
Least privilege on Defender settingsTurning a plan off is a defense evasion stepRole assignments for Security AdminMCSB PA-7
Triage by risk, not by scoreAttackers exploit depth, score rewards breadthResource Graph secure score queryMCSB PV-2
Exemptions and governance rulesEvery red item has an owner, a due date or a documented waiverRecommendations > Governance-
CIS standard in regulatory complianceManagement view of benchmark coverageRegulatory compliance dashboardMCSB PV-2

Foundational and Defender CSPM

Foundational CSPM is free and on by default for every subscription. It gives you the MCSB assessment, recommendations and secure score. Defender CSPM is the paid tier and adds the capabilities you need for prioritization: attack path analysis, the cloud security explorer, agentless VM and container image scanning, data-aware posture for storage and databases, and governance rules.

CapabilityPlanCost model
Recommendations, secure score, MCSB assessment, Azure Policy integrationFoundational CSPMFree, on by default
Attack path analysis, cloud security explorer, agentless scanning, sensitive data discovery, governance rulesDefender CSPMPer billable resource
Threat detection for VMs and Arc machines, Defender for Endpoint, vulnerability assessment, just-in-time VM access, file integrity monitoringDefender for Servers Plan 1 or Plan 2Per server per hour
Malware scanning on upload, anomalous access detectionDefender for StoragePer storage account, plus scanned volume
Suspicious secret, key and certificate accessDefender for Key VaultPer vault or per transaction
Suspicious management operations through ARMDefender for Resource ManagerPer subscription
Containers, App Service, databases, APIs, AI servicesRespective plansVaries

Check current prices on the Azure pricing page before rolling plans out across hundreds of subscriptions.

bash
az account set --subscription <sub-id>
az security pricing create --name CloudPosture --tier Standard
az security pricing show --name CloudPosture --query "{tier:pricingTier, extensions:extensions[].name}"

In the portal, the plan and its components (agentless scanning, sensitive data discovery, permissions management) are under Microsoft Defender for Cloud > Environment settings > (subscription) > Defender plans > Cloud Security Posture Management > Settings. Keep agentless scanning on: it is what feeds vulnerability findings into attack paths without deploying anything to the VMs.

Workload protection plans

A sensible minimum for any production subscription:

  • Defender for Resource Manager: watches every ARM operation. Alerts such as management operations from a malicious IP or from an anonymizing proxy are often the first and only signal that a token or service principal secret was stolen.
  • Defender for Key Vault: unusual access patterns to secrets, access from Tor, a sudden spike in secret listing.
  • Defender for Storage: anomalous data access and, with malware scanning on, malicious uploads detected before they are served to users.
  • Defender for Servers Plan 2 wherever you run VMs or Arc machines: it includes Microsoft Defender for Endpoint, vulnerability assessment and just-in-time VM access.

Add Defender for Containers for AKS, Defender for App Service for App Service and the database plans for SQL Database where those workloads exist.

bash
az security pricing create --name Arm --tier Standard
az security pricing create --name KeyVaults --tier Standard
az security pricing create --name StorageAccounts --tier Standard --subplan DefenderForStorageV2
az security pricing create --name VirtualMachines --tier Standard --subplan P2

az security pricing list --query "value[].{plan:name, tier:pricingTier, subPlan:subPlan}" -o table

Verify coverage across every subscription in one query with Azure Resource Graph:

KQL
securityresources
| where type == "microsoft.security/pricings"
| extend tier = tostring(properties.pricingTier), subPlan = tostring(properties.subPlan)
| where name in ("CloudPosture", "Arm", "KeyVaults", "StorageAccounts", "VirtualMachines")
| summarize plans = make_bag(bag_pack(name, tier)) by subscriptionId

Run it with az graph query -q "<query>" --first 1000.

Enforce plans at management group scope

Enabling plans with the CLI does not survive the next subscription someone creates. Use Azure Policy with DeployIfNotExists at your top management group. The built-in initiative Configure Microsoft Defender for Cloud plans bundles the individual definitions; you can also assign them one by one:

  • Configure Microsoft Defender CSPM to be enabled
  • Configure Azure Defender for Resource Manager to be enabled
  • Configure Microsoft Defender for Key Vault plan
  • Configure Microsoft Defender for Storage to be enabled
  • Configure Microsoft Defender for Servers plan
bash
INIT=$(az policy set-definition list \
  --query "[?displayName=='Configure Microsoft Defender for Cloud plans'].id" -o tsv)

az policy assignment create \
  --name defender-plans \
  --display-name "Defender for Cloud plans" \
  --policy-set-definition "$INIT" \
  --scope /providers/Microsoft.Management/managementGroups/<root-mg> \
  --mi-system-assigned --location westeurope

Grant the assignment identity the roles listed in the definitions (typically Security Admin), then run a remediation task for existing subscriptions. Pair it with the audit counterparts ("Azure Defender for Resource Manager should be enabled", "Microsoft Defender for Storage should be enabled", "Microsoft Defender CSPM should be enabled") so compliance shows drift. The rollout pattern is described on the Azure Policy page.

Security contacts and alert notifications

A Defender alert nobody reads is worth nothing. Configure the subscription security contact to send to a monitored distribution list and to the Owner role, with a minimum severity of Medium:

bash
az security contact create -n default \
  --emails "secops@example.com" \
  --notifications-by-role '{"state":"On","roles":["Owner"]}' \
  --alert-notifications '{"state":"On","minimalSeverity":"Medium"}'

az security contact show -n default

Portal path: Microsoft Defender for Cloud > Environment settings > (subscription) > Email notifications. The CIS benchmark checks that alert emails by severity are on (8.1.16), that a security contact address is set (8.1.15) and that subscription owners are notified (8.1.14). Enforce at scale with the audit policies "Subscriptions should have a contact email address for security issues", "Email notification for high severity alerts should be enabled" and "Email notification to subscription owner for high severity alerts should be enabled".

Email is a safety net, not a process. The real routing goes through export and your SIEM.

Continuous export to Log Analytics

The portal keeps alerts for a limited time and recommendations only as current state. Continuous export streams security alerts, recommendations, secure score and regulatory compliance changes to a Log Analytics workspace (or Event Hubs for a third-party SIEM), which gives you history and lets you query and alert on it.

Portal path: Environment settings > (subscription) > Continuous export. At scale, assign the built-in policy Deploy export to Log Analytics workspace for Microsoft Defender for Cloud data at the management group, pointing at the central workspace described on the Azure Monitor page. For Event Hubs, use Deploy export to Event Hub for Microsoft Defender for Cloud data.

Once data flows, alerts land in SecurityAlert and recommendations in SecurityRecommendation:

KQL
SecurityAlert
| where TimeGenerated > ago(7d)
| summarize count() by AlertName, AlertSeverity
| order by count_ desc

Defender XDR and Microsoft Sentinel integration

Defender for Cloud alerts are integrated into the Microsoft Defender portal, where they are correlated with Defender for Endpoint, Defender for Identity and Entra ID Protection signals into incidents. If you run Microsoft Sentinel, connect the tenant-based Defender for Cloud data connector so alerts from every subscription become incidents without per-subscription configuration. Avoid also connecting the legacy subscription-based connector on the same subscriptions, or you get duplicate incidents.

The point of this step is correlation: a Resource Manager alert on its own is ambiguous, but the same caller IP appearing in a risky sign-in in Entra ID and a Key Vault secret list five minutes later is an incident.

Vulnerability assessment and agentless scanning

Defender for Cloud uses Microsoft Defender Vulnerability Management for VM vulnerability findings, either through the Defender for Endpoint sensor (Servers Plan 2) or through agentless disk snapshot scanning (Defender CSPM and Servers Plan 2). Container image scanning in registries and running workloads comes with Defender CSPM and Defender for Containers.

Query findings across subscriptions:

KQL
securityresources
| where type == "microsoft.security/assessments/subassessments"
| where properties.status.code == "Unhealthy"
| extend severity = tostring(properties.status.severity),
         finding = tostring(properties.displayName)
| summarize resources = dcount(tostring(properties.resourceDetails.id)) by finding, severity
| order by resources desc

Prioritize vulnerabilities on internet-exposed machines first; attack path analysis does this correlation for you.

Who can change Defender settings

Disabling a Defender plan, deleting a continuous export or adding a broad alert suppression rule is a defense evasion technique (MITRE ATT&CK T1562, Impair Defenses). Keep those rights narrow:

  • Security Admin can change policies, plans and dismiss alerts. Grant it to the security team only, ideally through Privileged Identity Management eligible assignments (see Entra ID and Azure RBAC).
  • Security Reader is enough for most people who need to see recommendations and alerts.
  • Subscription Owners and Contributors can also change plans. That is one more reason to keep standing Owner assignments rare.

Alert on plan changes with an activity log alert on Microsoft.Security/pricings/write (see Logging and detection).

Secure score and risk prioritization

Secure score is the share of security controls you fully satisfy, weighted by control. Each control groups related recommendations, and you only get its points when every resource in it is healthy. Partial fixes show little movement, which is intentional.

KQL
securityresources
| where type == "microsoft.security/securescores"
| extend current = todouble(properties.score.current),
         max = todouble(properties.score.max)
| project subscriptionId, percent = round(100 * current / max, 1)
| order by percent asc
KQL
securityresources
| where type == "microsoft.security/assessments"
| where properties.status.code == "Unhealthy"
| summarize resources = count() by recommendation = tostring(properties.displayName),
            severity = tostring(properties.metadata.severity)
| order by resources desc

Score rewards breadth, attackers exploit depth: one internet-exposed VM with a known exploited vulnerability and a managed identity that is Owner on the subscription matters more than fifty missing tags. Work in this order:

  1. Identity and access: MFA for accounts with owner or write permissions, external and deprecated accounts with privileged roles.
  2. Internet exposure: VMs with open management ports, storage accounts and Key Vaults with public network access (see Virtual Network).
  3. Attack paths (Defender CSPM): fix the choke points that appear in many paths.
  4. Logging and detection gaps: missing diagnostic settings, disabled plans.
  5. Everything else, in batches by recommendation, using Fix or Azure Policy remediation.

Exemptions and governance rules

When a recommendation genuinely does not apply, exempt it instead of leaving it red. Exemptions are policy exemptions on the MCSB assignment, with the category Waiver or Mitigated, a justification and an expiry date. Review expired exemptions every quarter.

Governance rules (Defender CSPM) turn the dashboard into a work queue: for example, every high severity recommendation in subscriptions tagged env=prod is assigned to the owner from the owner resource tag, with a 14 day due date and weekly email reminders. Portal path: Environment settings > (management group or subscription) > Governance rules. Define rules at management group level so they apply to new subscriptions.

Regulatory compliance standards

Under Regulatory compliance, add the CIS Microsoft Azure Foundations Benchmark standard next to the default MCSB. The dashboard maps each CIS control to the Azure Policy assessments behind it and shows pass or fail per control. It is a good management view with known limits: controls implemented in Microsoft Entra ID or requiring process evidence show as manual. Complement it with an external scanner and periodic manual review.

Logging and detection

  • Export: continuous export of alerts, recommendations and secure score to the central workspace (SecurityAlert, SecurityRecommendation, SecureScores tables).
  • Activity log: changes to Defender itself appear as Microsoft.Security/* operations in AzureActivity. The CIS benchmark asks for activity log alerts on Microsoft.Security/securitySolutions/write and Microsoft.Security/securitySolutions/delete; add plan downgrades and export deletions:
KQL
AzureActivity
| where OperationNameValue in~ (
    "MICROSOFT.SECURITY/PRICINGS/WRITE",
    "MICROSOFT.SECURITY/AUTOMATIONS/DELETE",
    "MICROSOFT.SECURITY/ALERTSSUPPRESSIONRULES/WRITE",
    "MICROSOFT.SECURITY/SECURITYCONTACTS/DELETE")
| where ActivityStatusValue == "Success"
| project TimeGenerated, Caller, CallerIpAddress, SubscriptionId, OperationNameValue
  • High value alerts to page on: Resource Manager alerts about malicious IPs or anonymizing proxies, Key Vault access from Tor or unusual applications, malware uploaded to storage, Defender for Servers credential theft alerts.
KQL
SecurityAlert
| where TimeGenerated > ago(1d)
| where AlertSeverity == "High"
| project TimeGenerated, AlertName, CompromisedEntity, ProviderName, Tactics

Activity log export, workspace design and alert plumbing are covered on the Azure Monitor page.

Common mistakes

  • Enabling plans on one subscription only. Attackers pivot to the subscription you forgot. Enforce plans at management group scope through policy.
  • Skipping Defender for Resource Manager to save cost. It is cheap and is often the only detection for token theft used against the control plane.
  • Suppressing noisy alerts globally. A tenant-wide suppression rule for an alert type also hides the real one. Scope suppression rules to the specific resource and entity, with a comment and an expiry date.
  • Alert emails to individuals. Owners change; alerts keep going to a mailbox nobody reads. Use a distribution list and route alerts through your SIEM.
  • No continuous export. Without it, alert history ages out and you cannot reconstruct what fired months before an incident was discovered.
  • Treating secure score as the goal. Fixing fifty low severity items moves the score while the one exploitable attack path stays open.

References

Filed under defender-for-cloud, posture-management, threat-detection, cis-benchmark

Written by

, Cloud Security Engineer & Editor

Security engineer writing practical hardening pages for Microsoft Azure tenants and subscriptions, aligned with the CIS Microsoft Azure Foundations Benchmark.

Related services

  1. App ServiceHarden Azure App Service: HTTPS and TLS, basic auth and FTP off, access restrictions, private endpoints, Key Vault references, logging and dangling DNS.
  2. Azure FunctionsHarden Azure Functions: access keys and Entra auth, master key exposure, identity-based storage, network isolation, Flex Consumption, CORS and logging.
  3. Virtual MachinesHarden Azure VMs: Trusted Launch, no public IPs, JIT and Bastion access, Entra ID login, encryption at host, Update Manager patching and Defender for Servers.