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
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.
| Control | Why | How to check | ID |
|---|---|---|---|
| Defender CSPM on every subscription | Attack paths, agentless scanning and governance need the paid tier | az security pricing show -n CloudPosture | MCSB PV-2 / CIS 8.1.1.1 |
| Workload plans for Servers, Storage, Key Vault, Resource Manager | Runtime detection on the control plane and on data stores | az security pricing list -o table | MCSB LT-1 / CIS 8.1.3.1, 8.1.5.1, 8.1.8.1, 8.1.9.1 |
| Plans enforced at management group scope | New subscriptions are covered without a manual step | Policy compliance of the Defender initiative | MCSB LT-1 |
| Security contacts and alert emails | Alerts reach a monitored mailbox, not a former employee | az security contact list | MCSB IR-2 / CIS 8.1.14, 8.1.15, 8.1.16 |
| Continuous export to Log Analytics | Alert and recommendation history, queryable in KQL | az security automation list | MCSB LT-5 / CIS 8.1.12 |
| Defender XDR and Sentinel integration | Alerts become correlated incidents | Defender portal incident queue | MCSB IR-3 |
| Vulnerability assessment and agentless scanning | Known CVEs on VMs and images are found without agents | securityresources query on sub-assessments | MCSB PV-5 / CIS 8.1.3.2, 8.1.3.4 |
| Least privilege on Defender settings | Turning a plan off is a defense evasion step | Role assignments for Security Admin | MCSB PA-7 |
| Triage by risk, not by score | Attackers exploit depth, score rewards breadth | Resource Graph secure score query | MCSB PV-2 |
| Exemptions and governance rules | Every red item has an owner, a due date or a documented waiver | Recommendations > Governance | - |
| CIS standard in regulatory compliance | Management view of benchmark coverage | Regulatory compliance dashboard | MCSB 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.
| Capability | Plan | Cost model |
|---|---|---|
| Recommendations, secure score, MCSB assessment, Azure Policy integration | Foundational CSPM | Free, on by default |
| Attack path analysis, cloud security explorer, agentless scanning, sensitive data discovery, governance rules | Defender CSPM | Per billable resource |
| Threat detection for VMs and Arc machines, Defender for Endpoint, vulnerability assessment, just-in-time VM access, file integrity monitoring | Defender for Servers Plan 1 or Plan 2 | Per server per hour |
| Malware scanning on upload, anomalous access detection | Defender for Storage | Per storage account, plus scanned volume |
| Suspicious secret, key and certificate access | Defender for Key Vault | Per vault or per transaction |
| Suspicious management operations through ARM | Defender for Resource Manager | Per subscription |
| Containers, App Service, databases, APIs, AI services | Respective plans | Varies |
Check current prices on the Azure pricing page before rolling plans out across hundreds of subscriptions.
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.
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:
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
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:
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:
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:
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.
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
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:
- Identity and access: MFA for accounts with owner or write permissions, external and deprecated accounts with privileged roles.
- Internet exposure: VMs with open management ports, storage accounts and Key Vaults with public network access (see Virtual Network).
- Attack paths (Defender CSPM): fix the choke points that appear in many paths.
- Logging and detection gaps: missing diagnostic settings, disabled plans.
- 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,SecureScorestables). - Activity log: changes to Defender itself appear as
Microsoft.Security/*operations inAzureActivity. The CIS benchmark asks for activity log alerts onMicrosoft.Security/securitySolutions/writeandMicrosoft.Security/securitySolutions/delete; add plan downgrades and export deletions:
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.
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
- What is Microsoft Defender for Cloud? (Microsoft Learn)
- Secure score in Defender for Cloud (Microsoft Learn)
- Identify and analyze risks with attack path analysis (Microsoft Learn)
- Continuously export Defender for Cloud data (Microsoft Learn)
- Configure email notifications for alerts and attack paths (Microsoft Learn)
- Drive remediation with governance rules (Microsoft Learn)
- Overview of Microsoft Defender for Resource Manager (Microsoft Learn)
- User roles and permissions in Defender for Cloud (Microsoft Learn)
- Azure security baseline for Microsoft Defender for Cloud (Microsoft Learn)
- Microsoft Defender for Cloud pricing (Microsoft Azure)
- CIS Microsoft Azure Foundations Benchmark (Center for Internet Security)
Filed under defender-for-cloud, posture-management, threat-detection, cis-benchmark
Written by
Florian Amette, Cloud Security Engineer & EditorSecurity engineer writing practical hardening pages for Microsoft Azure tenants and subscriptions, aligned with the CIS Microsoft Azure Foundations Benchmark.