Governance: Azure Policy, RBAC, Custom Roles, Locks, IaC, Backup Security
How to enforce and audit security at scale on Azure: Azure Policy built-in and custom definitions, regulatory compliance in Defender for Cloud, resource locks, RBAC custom roles, overprivileged-access remediation, Azure Backup security, and IaC security controls.
Governance at scale, in one module
Governance is how you keep the rules of your tenant from quietly breaking. A single security engineer cannot manually inspect every storage account, every NSG rule, every RBAC assignment across thousands of resources. So you express rules and run them automatically:
- Azure Policy is the rules engine: βevery storage account must require HTTPSβ, βno public IPs on production NSGsβ, βall SQL servers must have auditing onβ. Built-in definitions cover most baseline controls; you write custom definitions for the rules unique to your org.
- Regulatory compliance in Defender for Cloud maps your environment against frameworks (ISO 27001, PCI DSS, NIST 800-53, CIS, SOC 2, etc.) and gives you a compliance scorecard with remediation steps.
- Resource locks prevent accidental delete or modification on resources that should not change.
- RBAC + custom roles let you grant least-privilege at exactly the scope and actions a role needs β and access reviews catch the privilege creep that always returns.
- Azure Backup security features protect backup data itself from being attacked (Soft delete, immutability, multi-user authorisation).
- IaC security controls push these guardrails leftward into Bicep, ARM, and Terraform pipelines so misconfigurations are caught before they ship.
Azure Policy
Azure Policy evaluates resources against rules at scale. Three primary moving parts:
| Feature | Policy definition | Initiative (policy set) | Assignment |
|---|---|---|---|
| What it is | A single rule (e.g. 'storage accounts must require HTTPS') | A bundle of related policy definitions (e.g. 'CIS Azure benchmark v2.0.0') | Applying a definition or initiative to a scope |
| Created by | Microsoft (built-in) or you (custom JSON) | Microsoft (built-in) or you (custom) | You β picks scope, parameters, identity for remediation |
| Effects available | Deny, Audit, AuditIfNotExists, DeployIfNotExists, Modify, Append, Manual, Disabled | Inherited from each contained definition | Effects can be overridden via parameters at assignment time |
| Scope | N/A β definitions are written but not yet applied | N/A β initiatives are written but not yet applied | Management group, subscription, resource group, or resource |
| Identity needed | No | No | Managed identity required for DeployIfNotExists and Modify effects |
Effects you must know
- Deny β blocks creation/update of resources that violate the policy. Hardest gate; pre-incident.
- Audit β logs a compliance state but does not block. Most common starting point.
- AuditIfNotExists β evaluates a related resource (e.g. βevery VM must have a diagnostic settingβ) and audits if missing.
- DeployIfNotExists (DINE) β auto-deploys a remediation template when the related resource is missing. Requires a system-assigned or user-assigned managed identity on the assignment, with role assignments to deploy the template.
- Modify β mutates resource properties on create/update to comply (e.g. add a required tag).
- Disabled β turns the policy off without removing the assignment.
Initial-state-vs-future-state trap
A frequent SC-500 exam pattern: βEsme wants to ensure all NEW storage accounts require secure transfer, AND she wants to remediate the 800 existing storage accounts that donβt have it.β The correct answer almost always combines two effects:
- Deny for future violations β assigned at the subscription scope, this stops anyone from creating a non-compliant storage account from now on.
- Modify or DeployIfNotExists for the existing 800 β assigned with a system-assigned managed identity, then run a remediation task that applies the change to all currently non-compliant resources.
Audit alone is the wrong answer because it leaves the existing 800 non-compliant indefinitely.
Custom policy definitions
When the built-in catalogue doesnβt cover a rule unique to your org, write a custom policy definition in JSON. Two parts:
policyRule.ifβ the condition that selects resources (e.g.resource type = Microsoft.Network/networkSecurityGroupsANDproperties.securityRules[*].destinationPortRange contains '22'ANDproperties.securityRules[*].access = AllowANDproperties.securityRules[*].sourceAddressPrefix = '*').policyRule.thenβ the effect (Deny, Audit, etc.) and any deployment template for DINE/Modify.
For SC-500, you should be able to read a custom definitionβs JSON and explain what it does β not author it from scratch in the exam.
Regulatory compliance in Defender for Cloud
Defender for Cloudβs Regulatory compliance view maps your environment against compliance frameworks. By default, the Microsoft Cloud Security Benchmark (MCSB) is assigned and evaluated. You can add additional standards (PCI DSS, ISO/IEC 27001, NIST SP 800-53, CIS, SOC 2, HIPAA HITRUST, FedRAMP, country-specific frameworks like SWIFT CSCF or the NZISM equivalents).
Each standard breaks down into controls and recommendations. Defender for Cloud evaluates each recommendation against your environment, assigns a status (Healthy / Unhealthy / Not applicable / Not assessed), and aggregates to a per-standard compliance percentage.
For controls that Microsoft cannot automatically evaluate (process controls β βDocument an incident response planβ), you can perform manual attestation to mark the control as satisfied.
For controls that genuinely donβt apply, exemptions with a justification and expiry can be granted by an admin. Exemptions are recorded for the auditor and lapse on expiry, prompting re-review.
Resource locks
Two lock types:
- CanNotDelete β resource can be modified but not deleted. The protection that prevents an
az group deletefrom accidentally taking out a production resource group. - ReadOnly β resource cannot be modified or deleted. Stronger; useful for highly stable resources whose configuration must not change. Note: ReadOnly can interfere with operations that look like reads but are actually writes underneath β read carefully before applying.
Locks apply at subscription, resource group, or individual resource scope, and inherit downward. Locks override RBAC β even Owner cannot delete a CanNotDelete-locked resource without first removing the lock (which requires Microsoft.Authorization/locks/* permission).
RBAC at scale
Built-in roles cover the common cases β Owner, Contributor, Reader, plus service-specific roles (Key Vault Secrets User, Storage Blob Data Contributor, Virtual Machine Contributor, etc.). Two SC-500 surfaces:
- Custom Azure roles β when no built-in role fits, define a custom role with explicit
Actions,NotActions,DataActions,NotDataActions, andAssignableScopes. Created at the tenant root or a management group, assignable at any scope at or underAssignableScopes. - Microsoft Entra roles vs Azure roles β Entra roles govern directory operations (user management, app registration, policy admin). Azure RBAC roles govern Azure resource operations. They are separate systems with separate role definitions β
Global Administratoris an Entra role,Owneris an Azure RBAC role. SC-500 expects you to know the distinction and pick the right surface for the task.
Detecting and remediating overprivileged access
Two primary signals:
- Microsoft Entra Privileged Identity Management access reviews β scheduled review of role holders. Reviewer (manager, named approver, or self-attestation) confirms whether each assignment is still needed; unreviewed assignments can be auto-removed.
- Microsoft Entra Permissions Management (formerly CloudKnox) β surfaces actual permission usage across Azure, AWS, and GCP. Identifies identities with unused or excessive permissions and proposes a right-sized role. Treats permission as data, not posture.
For Azure RBAC specifically, you can review assignments via the portal, az role assignment list, or the Microsoft Graph API, filter for assignments at high scopes (subscription Owner / Contributor), and remove or replace with narrower scopes.
Azure Backup security features
Backups must themselves be defended β ransomware actors increasingly target backup vaults specifically because deleting the backup forecloses recovery. Key Recovery Services / Backup vault settings:
- Soft delete β deleted backups retained for 14 days (immutable) before purge. Enabled by default, recommended to keep on.
- Immutable vaults β once enabled (and made irreversible), no one can shorten retention or delete backups before retention expires.
- Multi-user authorisation (MUA) β protects critical operations on the vault (disable soft delete, change retention, delete) with a second-approver workflow via Microsoft Entra Resource Guard.
- Cross-region restore β for region-redundant Recovery Services vaults, you can restore in a secondary region if the primary is compromised.
For the exam, the pattern is: βbackups should survive a tenant compromiseβ. The combination of soft delete + immutable + MUA is the answer.
IaC security controls
Two complementary patterns:
- Shift-left in pipelines β Defender for DevOps (when GitHub or Azure DevOps is connected) scans Bicep, ARM, Terraform, and Kubernetes manifests for misconfigurations during PRs. Pipelines can fail builds on high-severity findings.
- Runtime-side Azure Policy β DINE/Modify policies catch what slips through the pipeline. A workload deployed via a non-compliant template is corrected after the fact.
Microsoft.Security-namespace resources in Bicep let you express security-plan toggles (Defender for Cloud plan enablement, auto-provisioning, contact details, default workspace) as code β version-controlled, peer-reviewed, repeatable across subscriptions.
Scenario: Asha rolls out a tenant-wide governance baseline
Asha at Aurora Health Service is establishing a security baseline across 47 subscriptions under one management group hierarchy:
- Custom initiative at the root management group: combines the MCSB built-in initiative + 8 custom policies (no public-IP NSG rules outside the DMZ, all SQL servers have auditing on, all storage accounts require HTTPS + minimum TLS 1.2, no Owner role at subscription scope for human accounts, etc.). Mix of
Denyfor new andDeployIfNotExistsfor existing. - Remediation tasks scheduled for each DINE policy to fix the existing fleet. Each remediation runs as the assignmentβs managed identity with the minimum role to perform the fix.
- Regulatory compliance: in Defender for Cloud, attach NIST SP 800-53 Rev. 5 and ISO/IEC 27001 standards alongside MCSB. Quarterly compliance review with the security committee uses these views.
- PIM + access reviews: every standing Owner / Contributor at subscription scope migrated to PIM-eligible. Quarterly access review on the entire eligibility set.
- Backup hardening: every Recovery Services vault has soft delete + immutable enabled, MUA configured with two named approvers from outside the data-protection team.
- IaC: connect both Azure DevOps and GitHub to Defender for DevOps. Pipeline build fails on high-severity Bicep / Terraform findings. Bicep modules for new subscriptions include the Microsoft.Security plan-enablement resources so Defender for Cloud is on by default.
Result: the tenant has a written baseline expressed in policy, an auditable compliance scorecard, just-in-time admin access, immutable backups, and IaC catches misconfigurations before deploy. The next acquisition gets the same baseline by being added to the management group.
Key terms
Knowledge check
Esme at Northwind Bank wants to ensure all NEW storage accounts require secure transfer (HTTPS), AND remediate the 800 EXISTING storage accounts that don't currently require it. Which Azure Policy approach is correct?
Asha at Aurora Health Service wants to identify identities in her Azure environment with permissions they do not actually use β to right-size their roles. Which Microsoft service is purpose-built for this?
Dom at Kestrel Cyber Co-op is hardening a client's Recovery Services vault against ransomware actors who target backups. He's already enabled soft delete and immutable vault. What is the next step that prevents an attacker (or a compromised admin) from disabling those very protections?
Domain 1 wrap-up
Youβve covered identity, application identity, managed identities, Key Vault, and governance. Next up is Domain 2 β Secure storage, databases, and networking (25β30% of the exam β the heaviest domain by weight).
We start with storage account security and Defender for Storage, then move through Azure SQL and Defender for Databases, then deep-dive on the network controls: NSGs, ASGs, Virtual Network Manager, Virtual WAN, VPN, Entra Private Access, Private Endpoints, Private Link, Azure Firewall, and Network Watcher.