Tag: Azure Security

Evaluate and remediate overprivileged access assignments by using Azure role-based access control (RBAC) (SC-500 Exam Prep)

This post is a part of the "SC-500: Implementing End-to-End Security Controls for Cloud and AI Workloads" Exam Prep Hub.
This topic falls under these sections:
Manage identity, access, and governance (20–25%)
   --> Implement governance to enforce security and regulatory compliance
      --> Evaluate and remediate overprivileged access assignments by using Azure role-based access control (RBAC)


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Overview

Azure role-based access control (Azure RBAC) is the authorization system used to control who can access Azure resources, what they can do, and at what scope they can perform those actions.

One of the most important security responsibilities of an Azure administrator or security engineer is to ensure that users, groups, service principals, managed identities, and other security principals have only the permissions they actually need.

Over time, Azure environments can accumulate excessive permissions because:

  • Employees change jobs or responsibilities.
  • Temporary administrative access becomes permanent.
  • Users receive multiple role assignments through different groups.
  • Broad roles such as Owner or Contributor are assigned for convenience.
  • Roles are assigned at subscription or management-group scope when a resource-group or resource scope would be sufficient.
  • Group memberships change without corresponding changes to Azure access.
  • Service principals and managed identities retain permissions after an application changes.
  • Administrators assign a powerful built-in role when a narrower role would work.
  • Inherited role assignments are overlooked.

The SC-500 exam expects you to understand how to identify excessive Azure RBAC permissions, determine why the permissions exist, reduce them to the minimum required level, and periodically review access to prevent privilege accumulation.


1. Understand the Azure RBAC Access Model

Azure RBAC can be understood through three fundamental components:

Security principal + Role definition + Scope = Role assignment

Security principal

The security principal is the identity receiving the permissions.

Examples include:

  • User
  • Security group
  • Service principal
  • Managed identity
  • Workload identity

Azure RBAC can assign roles to these types of principals.

Role definition

A role definition specifies what actions the principal is allowed to perform.

Examples include:

  • Reader
  • Contributor
  • Owner
  • Storage Blob Data Reader
  • Virtual Machine Contributor
  • Custom roles

Scope

Scope specifies where the permissions apply.

Azure RBAC supports a hierarchy of scopes:

  1. Management group
  2. Subscription
  3. Resource group
  4. Individual resource

Permissions assigned at a parent scope are inherited by child scopes.

For example:

Management Group
|
+-- Subscription
|
+-- Resource Group
|
+-- Storage Account
|
+-- Virtual Machine

If a user receives Contributor at the subscription level, that access can apply to resources throughout the subscription.

If the same user receives Contributor only at a particular resource group, the permissions are limited to that resource group’s resources.

Therefore, scope is one of the most important factors when evaluating excessive access.


2. What Is Overprivileged Access?

A principal is overprivileged when it has more permissions or broader scope than necessary to perform its job.

Consider this example:

A developer only needs to restart virtual machines in the Development resource group.

The developer has:

Contributor at the subscription level

This is potentially excessive because Contributor provides broad management permissions across many resource types and the assignment applies to the entire subscription.

A better solution might be:

Virtual Machine Contributor at the Development resource-group scope

This reduces both:

  • The number of operations the developer can perform.
  • The number of resources on which those operations can be performed.

This follows the principle of least privilege: provide the minimum permissions necessary to perform the required task.


3. Why Overprivileged Assignments Are a Security Risk

Excessive Azure RBAC permissions increase the potential impact of a compromised identity.

For example, suppose a compromised account has:

Owner at subscription scope

The attacker could potentially manage resources and access assignments throughout the subscription.

Compare that with:

Virtual Machine Contributor at one resource group

The potential blast radius is significantly smaller.

The principle is:

The broader the role and the broader the scope, the greater the potential impact of credential compromise.

This is why Azure RBAC best practices recommend avoiding broad roles at broad scopes when narrower permissions can satisfy the business requirement.


4. Built-In Roles Should Usually Be the Starting Point

Azure provides many built-in roles for common administrative scenarios.

Examples include:

RoleGeneral purpose
ReaderView resources without managing them
ContributorManage Azure resources but cannot normally assign Azure RBAC roles
OwnerFull resource-management access, including managing Azure RBAC access
User Access AdministratorManage user access to Azure resources
Role Based Access Control AdministratorManage Azure role assignments with fewer permissions than User Access Administrator
Virtual Machine ContributorManage virtual machines
Storage Account ContributorManage storage accounts
Network ContributorManage networking resources

The goal isn’t simply to find a role that works.

The goal is to find the role that provides the required permissions with the least unnecessary privilege.

For example:

If someone only needs to view resources, use Reader rather than Contributor.

If someone needs to manage virtual machines but not storage accounts, use an appropriately scoped VM-management role rather than Contributor across the subscription.


5. Evaluate the Role and the Scope

When investigating an RBAC assignment, evaluate two separate questions.

Question 1: What can the principal do?

Examine the assigned role.

For example:

Owner
Contributor
Virtual Machine Contributor
Reader
Custom Role

Question 2: Where can the principal do it?

Examine the assignment scope.

For example:

Management group
Subscription
Resource group
Specific resource

You should evaluate both dimensions.

Consider:

RoleScopePotential concern
ReaderResourceLow
ReaderSubscriptionMay be appropriate
ContributorResourceDepends on requirement
ContributorResource groupPotentially broad
ContributorSubscriptionFrequently requires scrutiny
OwnerResourceHighly privileged
OwnerSubscriptionHighly privileged
User Access AdministratorSubscriptionHighly privileged

The correct question is not:

“Is Contributor dangerous?”

Instead ask:

“Does this principal need Contributor at this scope?”


6. Understand Inherited Permissions

A common RBAC troubleshooting mistake is attempting to remove a role assignment from a child resource when the assignment was actually created at a parent scope.

For example:

Subscription
|
+-- Contributor assigned to Alice
|
+-- Resource Group A
|
+-- VM

Alice sees Contributor access to the VM, but the assignment may not exist directly on the VM.

It is inherited from the subscription.

If you try to remove the assignment at the VM level, you cannot simply remove the inherited assignment there.

You must locate and modify or remove the assignment at the scope where it was actually created.

Exam tip

When you see:

“The user has access to a resource, but no role assignment appears directly on the resource.”

Think:

Inherited RBAC assignment.

Then investigate the parent scopes.


7. Use the Azure Portal to Evaluate Access

A common way to investigate Azure RBAC assignments is through Access control (IAM).

At the appropriate scope:

  1. Open the subscription, resource group, or resource.
  2. Select Access control (IAM).
  3. Select Role assignments.
  4. Review the principals.
  5. Review their roles.
  6. Review the assignment scope.
  7. Determine whether the assignment is direct or inherited.
  8. Identify unnecessary or excessive permissions.
  9. Remove or replace excessive assignments.

The important point is to investigate all effective access, rather than looking only at direct assignments.


8. Evaluate Effective Access, Not Just Individual Assignments

A user can have multiple role assignments.

For example:

Alice
├── Reader → Subscription
├── Contributor → Resource Group A
└── VM Contributor → VM01

Looking at only one assignment may not reveal the user’s actual level of access.

You need to consider:

  • Direct assignments
  • Group-based assignments
  • Inherited assignments
  • Multiple role assignments
  • Different scopes
  • Privileged roles
  • Service principals and managed identities where applicable

This is particularly important because a user may appear to have a relatively narrow direct assignment while receiving significantly broader permissions through group membership.


9. Look for High-Risk Roles

Certain Azure roles deserve particular scrutiny because they can provide highly privileged capabilities.

Owner

Owner provides full management access to the resource and includes the ability to manage Azure RBAC access.

An unnecessary Owner assignment should generally be removed or replaced with a less privileged role.

User Access Administrator

User Access Administrator is specifically designed to manage access to Azure resources.

Because it can manage role assignments, it is itself a highly privileged role.

Role Based Access Control Administrator

The Role Based Access Control Administrator role is designed for role-assignment management and has fewer permissions than User Access Administrator, making it useful when the requirement is specifically to delegate RBAC administration.

Contributor

Contributor cannot normally assign Azure RBAC roles, but it can perform broad resource-management operations.

Therefore:

Contributor is less privileged than Owner, but it can still be significantly overprivileged.

Do not assume that an assignment is acceptable merely because the principal isn’t an Owner.


10. Reduce Excessive Scope

One of the easiest ways to reduce excessive access is to narrow the scope.

For example:

Before

Contributor
Subscription

After

Virtual Machine Contributor
Development Resource Group

The second assignment reduces both:

  • Permissions
  • Scope

This is much closer to least privilege.

Azure recommends using narrower scopes, such as a resource group or resource, when a broader management-group or subscription scope isn’t required.


11. Remove Unnecessary Role Assignments

If a principal no longer requires access, the correct remediation is generally to remove the role assignment.

For example:

A contractor completed a project six months ago but still has Contributor access to the production subscription.

The appropriate action is to remove the unnecessary assignment.

Removing an Azure RBAC role assignment removes that access from the specified scope, assuming the assignment is not being inherited from another scope or otherwise recreated by an automated process.

Important distinction

Do not simply disable an account and assume the RBAC assignment has been cleaned up.

When an identity is deleted, stale role assignments can remain and should be removed as part of access hygiene.


12. Replace Broad Roles With Narrower Roles

Sometimes an assignment should not be removed completely because the user still needs access.

Instead, replace the excessive role with a narrower role.

Example:

Requirement

A support engineer needs to:

  • View Azure resources.
  • Restart virtual machines.

The engineer does not need to:

  • Modify storage accounts.
  • Modify networking.
  • Create role assignments.
  • Delete unrelated resources.

Poor assignment

Contributor
Subscription

Better assignment

Use a VM-specific role at the appropriate resource-group or resource scope.

This follows the principle:

Don’t remove required access—right-size it.


13. Use Custom Roles When Built-In Roles Are Too Broad

Sometimes no built-in role provides exactly the permissions required.

In that case, a custom Azure RBAC role can provide a more precise set of permissions.

For example, suppose an operations team needs to:

  • Start virtual machines.
  • Stop virtual machines.
  • Restart virtual machines.

But they should not be able to:

  • Delete virtual machines.
  • Modify networking.
  • Modify storage.
  • Assign roles.

If an appropriate built-in role is too broad, a custom role can be designed around the required operations.

The objective is not:

“Create a custom role because custom roles are more secure.”

Instead:

Create a custom role when a built-in role cannot provide the required least-privilege access.

Azure guidance recommends starting with built-in roles and creating custom roles only when there is a clear need.


14. Review Role Permissions Carefully

A custom role can contain permissions such as:

  • Actions
  • NotActions
  • DataActions
  • NotDataActions

These distinctions are important.

Actions

Control-plane management operations.

Examples include operations to:

  • Create resources
  • Update resources
  • Delete resources
  • Read resource configuration

DataActions

Data-plane operations.

These control access to data within supported Azure resources.

For example, management-plane access to a storage account is different from permission to read blob data.

Therefore:

Do not assume that having management permissions automatically means having data-plane permissions, or vice versa.


15. Be Careful With Wildcards

Custom roles can use wildcard permissions.

For example:

Microsoft.Storage/*

This can be convenient, but it may grant more permissions than intended and may encompass additional operations as the platform evolves.

For least privilege, explicitly identify the operations that are actually required whenever practical.

Azure RBAC guidance recommends avoiding wildcard permissions in custom roles unless they are genuinely justified.


16. Understand That NotActions Is Not an Explicit Deny

A frequent exam trap involves NotActions.

Suppose a role contains:

Actions:
Microsoft.Compute/*
NotActions:
Microsoft.Compute/virtualMachines/delete

NotActions removes specified operations from the role’s Actions set.

It does not create a universal deny rule.

If another role assignment grants the principal the ability to delete virtual machines, the NotActions entry in this particular role does not necessarily prevent that other assignment from granting the permission.

Therefore:

NotActions is an exclusion from a role definition, not a deny mechanism across Azure RBAC.


17. Investigate Group-Based Access

Group-based RBAC is a recommended way to manage access because it simplifies administration.

However, groups can also create hidden privilege accumulation.

For example:

User
|
+-- Member of Developers
| |
| +-- Contributor → Subscription
|
+-- Member of Operations
|
+-- Reader → Management Group

The user’s effective access comes from both groups.

When investigating excessive access, determine:

  • Which groups grant Azure roles?
  • Which groups is the user a member of?
  • Are nested groups involved?
  • Is the user receiving duplicate or overlapping permissions?
  • Is the user still supposed to be in those groups?

The best remediation may be to remove the user from an unnecessary group, rather than individually changing every RBAC assignment.


18. Review Service Principals and Managed Identities

Overprivileged access isn’t limited to human users.

Applications and workloads can also receive Azure RBAC assignments.

Examples:

  • Service principals
  • Managed identities
  • Workload identities

These identities should receive only the permissions necessary for the application to function.

For example:

An application only needs to read secrets from a specific Key Vault.

Giving its managed identity Owner access to the subscription would be extremely excessive.

Instead, assign an appropriate Key Vault role at the narrowest practical scope.

This reduces the potential blast radius if the workload or its credentials are compromised.


19. Use Privileged Identity Management (PIM)

For privileged access, Microsoft Entra Privileged Identity Management (PIM) can help reduce standing administrative privileges.

Instead of keeping highly privileged access permanently active, eligible users can activate privileged roles when needed, subject to organizational controls such as:

  • Approval
  • Multifactor authentication
  • Time limits
  • Justification
  • Notifications
  • Access reviews

PIM also supports reviews of Azure resource roles, helping organizations identify stale privileged assignments.

Exam concept

If the scenario says:

“Administrators need privileged access only occasionally.”

Think:

PIM / eligible access rather than permanent standing access.


20. Perform Regular Access Reviews

RBAC isn’t a “set it and forget it” security control.

Access should be reviewed regularly.

Ask:

  • Does the user still need the role?
  • Does the user still have the correct job responsibilities?
  • Is the scope still appropriate?
  • Is the role more powerful than necessary?
  • Is the assignment permanent when it could be temporary?
  • Is access coming through a group?
  • Is the identity still active?
  • Is the service principal or managed identity still required?

Access reviews can be used to review privileged Azure resource roles and Microsoft Entra roles through PIM. Recurring reviews can help identify stale access over time.


21. Understand the Difference Between Evaluation and Remediation

The exam topic contains two important activities:

Evaluate

Determine whether access is excessive.

Examples:

  • User has Owner but only needs Reader.
  • Contributor is assigned at subscription scope but only one resource group is required.
  • User retains access after changing departments.
  • Service principal has permissions unrelated to its application.
  • A privileged role is permanently assigned even though it is only occasionally required.

Remediate

Take action to reduce the risk.

Examples:

  • Remove the role assignment.
  • Remove unnecessary group membership.
  • Replace Contributor with a narrower role.
  • Reduce subscription scope to resource-group scope.
  • Replace Owner with a job-specific role.
  • Create a custom least-privilege role.
  • Convert standing privileged access to eligible PIM access where appropriate.

22. A Practical RBAC Remediation Process

A useful process for SC-500 is:

Step 1 — Identify the principal

Determine whether the assignment belongs to:

  • User
  • Group
  • Service principal
  • Managed identity
  • Workload identity

Step 2 — Identify all effective assignments

Look for:

  • Direct assignments
  • Group-based assignments
  • Inherited assignments
  • Multiple assignments

Step 3 — Identify the assigned roles

Determine whether the principal has:

  • Reader
  • Contributor
  • Owner
  • User Access Administrator
  • RBAC Administrator
  • Specialized built-in role
  • Custom role

Step 4 — Determine the actual business requirement

Ask:

What does this identity actually need to do?

Avoid designing permissions based on what the user currently happens to have.

Step 5 — Evaluate scope

Determine whether the role is assigned at:

  • Management group
  • Subscription
  • Resource group
  • Resource

Step 6 — Reduce the role

Choose the least powerful role that satisfies the requirement.

Step 7 — Reduce the scope

Choose the smallest practical scope.

Step 8 — Consider PIM

If privileged access is occasional, consider eligible/JIT-style privileged access rather than permanent access.

Step 9 — Remediate

Remove, replace, or modify the unnecessary assignment.

Step 10 — Review regularly

Schedule periodic access reviews, particularly for privileged roles.


23. A Simple Least-Privilege Decision Framework

When an exam question presents an excessive RBAC assignment, work through these questions:

Question 1

Does the principal still need access?

If No → remove the assignment.

Question 2

Does the principal need the entire role?

If No → replace it with a narrower role or custom role.

Question 3

Does the principal need access to everything within the current scope?

If No → reduce the scope.

Question 4

Does the principal need permanent privileged access?

If No → consider PIM.

Question 5

Is the access coming from a group?

If Yes → evaluate whether group membership should be removed rather than changing an individual assignment.

This framework is highly useful for scenario-based SC-500 questions.


24. Common Exam Traps

Trap 1: “Contributor is safe because it isn’t Owner.”

Incorrect.

Contributor can still provide broad management permissions.


Trap 2: “The user needs access to one VM, so give Contributor at the subscription.”

Incorrect.

Use a narrower role and narrower scope.


Trap 3: “The role isn’t assigned directly to the resource, so the user doesn’t have access.”

Incorrect.

The role may be inherited from a parent scope.


Trap 4: “NotActions denies the operation everywhere.”

Incorrect.

NotActions excludes operations from that role definition; it isn’t a universal deny.


Trap 5: “PIM automatically fixes excessive permissions.”

Not necessarily.

PIM can reduce standing privileged access, but you still need to evaluate whether the underlying role and scope are appropriate.


Trap 6: “Custom roles are always better.”

Incorrect.

Start with built-in roles. Use custom roles when built-in roles don’t provide the required least-privilege combination.


Trap 7: “Remove the user’s direct role assignment and the problem is solved.”

Not necessarily.

The user may receive the same or greater permissions through:

  • Group membership
  • Inheritance
  • Another role assignment

Trap 8: “A role assignment at a resource is always the most important thing to examine.”

Not necessarily.

You must evaluate the complete effective-access picture.


25. Key Concepts to Remember

For the SC-500 exam, remember these relationships:

RequirementPreferred approach
User no longer needs accessRemove role assignment
User needs less powerful permissionsReplace with narrower role
User needs access to fewer resourcesReduce scope
Built-in role is too broadConsider custom role
Privileged access is occasionalConsider PIM
Access comes through unnecessary groupRemove group membership
Assignment appears unexpectedlyCheck inherited/group-based access
Application has excessive permissionsRight-size service principal/managed identity
Need regular confirmation of privileged accessAccess reviews
Need to manage role assignments with fewer privilegesRBAC Administrator
Need to manage resources but not RBAC assignmentsContributor
Need full resource access including RBACOwner

Practice Exam Questions

Question 1

A developer needs to restart virtual machines in a single resource group. The developer currently has the Contributor role assigned at the subscription scope.

What is the BEST remediation?

A. Replace Contributor with an appropriate VM-management role at the resource-group scope.

B. Replace Contributor with Owner at the resource-group scope.

C. Keep Contributor because Contributor cannot assign RBAC roles.

D. Replace Contributor with User Access Administrator at the subscription scope.

Answer: A

Explanation

The developer needs VM-management capabilities only within one resource group. The best solution is to use a narrower VM-specific role and assign it at the resource-group scope.

Contributor at subscription scope provides considerably broader access than necessary.

This addresses both dimensions of least privilege:

  • Reduce the permissions
  • Reduce the scope

Question 2

A security engineer discovers that a user can modify resources in a resource group even though no Contributor assignment appears directly on the resource group.

What should the engineer investigate FIRST?

A. Whether the resource has a resource lock.

B. Whether Azure Policy is granting Contributor permissions.

C. Whether the user has an inherited role assignment from a parent scope.

D. Whether the user has a Microsoft Entra application role.

Answer: C

Explanation

Azure RBAC assignments are inherited from parent scopes.

The user may have Contributor assigned at the subscription or management-group level.

Azure Policy does not grant Azure RBAC permissions, and a resource lock does not grant access.


Question 3

An organization discovers that an employee has Owner access to an Azure subscription but only needs to manage virtual machines in one production resource group.

Which remediation best follows the principle of least privilege?

A. Change Owner to Contributor at the subscription scope.

B. Replace Owner with an appropriate VM-management role at the production resource-group scope.

C. Keep Owner but enable MFA.

D. Replace Owner with User Access Administrator at the subscription scope.

Answer: B

Explanation

The employee needs VM management in one resource group—not complete subscription administration.

The best remediation is therefore to:

  1. Reduce the role.
  2. Reduce the scope.

MFA is valuable but does not correct excessive authorization.


Question 4

An administrator wants to prevent a custom Azure RBAC role from allowing deletion of virtual machines while allowing the other operations included in a broader action set.

Which role-definition property is designed to exclude specific operations from the role’s Actions?

A. DataActions

B. AssignableScopes

C. NotDataActions

D. NotActions

Answer: D

Explanation

NotActions excludes specified control-plane operations from the role’s Actions.

NotDataActions applies to data-plane permissions.

However, remember that NotActions is not a universal deny. Another role assignment could potentially grant the excluded permission.


Question 5

A service principal used by an application has Contributor access to an entire subscription. The application only needs to read data from one Azure service.

What should the security engineer do?

A. Change Contributor to Owner at the subscription scope.

B. Remove the excessive assignment and grant the application only the required data-access role at the narrowest appropriate scope.

C. Keep Contributor because service principals are not subject to least-privilege requirements.

D. Assign User Access Administrator to the service principal.

Answer: B

Explanation

Service principals and managed identities must also follow least-privilege principles.

The application should receive only the permissions it requires and only at the necessary scope.

Giving an application Contributor at subscription scope creates an unnecessarily large blast radius if the application or its credentials are compromised.


Question 6

A company has 20 administrators who occasionally need highly privileged Azure access. Security policy requires that privileged permissions not remain permanently active.

Which solution is MOST appropriate?

A. Use Microsoft Entra Privileged Identity Management to provide eligible, controlled privileged access.

B. Assign Owner permanently but require users to change their passwords monthly.

C. Assign Contributor permanently and use Azure Policy to remove the role.

D. Create a resource lock on the subscription.

Answer: A

Explanation

PIM is designed to reduce standing privileged access and can support controlled, time-bound activation of privileged Azure resource roles.

The other choices do not solve the underlying problem of permanently assigned privileged permissions.


Question 7

A user receives the following Azure RBAC assignments:

  • Reader at the subscription level
  • Contributor at Resource Group A
  • Owner at Resource Group B

Security policy states that the user should only manage virtual machines in Resource Group A.

What is the BEST remediation?

A. Remove Reader and keep Owner.

B. Change Owner to Contributor but leave all other assignments unchanged.

C. Remove all Azure access and recreate the account.

D. Remove unnecessary assignments and provide an appropriately scoped VM-management role for Resource Group A.

Answer: D

Explanation

The user’s requirement is limited to VM management in Resource Group A.

The correct solution is to eliminate unnecessary access and provide the smallest role and scope that satisfy the requirement.

In particular, the Owner assignment on Resource Group B is clearly outside the stated requirement.


Question 8

A custom Azure RBAC role contains:

Actions:
Microsoft.Storage/*
NotActions:
Microsoft.Storage/storageAccounts/delete

What does NotActions accomplish?

A. It creates an explicit deny that prevents the user from deleting storage accounts through any Azure RBAC assignment.

B. It prevents the user from accessing storage-account data.

C. It excludes the specified delete operation from the permissions granted by this role definition.

D. It restricts where the role can be assigned.

Answer: C

Explanation

NotActions subtracts specified control-plane operations from the role’s Actions.

It does not create an explicit deny across all role assignments.

AssignableScopes controls where a custom role can be assigned, while DataActions concerns data-plane operations.


Question 9

A user no longer requires Contributor access to a subscription. The security engineer attempts to remove the Contributor assignment from a resource group but Azure indicates that the assignment is inherited.

What should the engineer do?

A. Create a resource lock on the resource group.

B. Delete the resource group.

C. Assign Reader to the user before removing Contributor.

D. Locate the original role assignment at the parent scope and remove or modify it there.

Answer: D

Explanation

Inherited Azure RBAC assignments must be addressed at the scope where the assignment was created.

If Contributor was assigned at the subscription level, removing it from an individual resource group isn’t the correct remediation.


Question 10

A security team performs a quarterly review and discovers several users with privileged Azure resource roles that were granted months ago. The organization wants resource owners to determine whether those users still require the access.

Which capability is BEST suited to this requirement?

A. Azure resource locks

B. Microsoft Entra access reviews through Privileged Identity Management

C. Azure Policy with a deny effect

D. Azure Storage firewall rules

Answer: B

Explanation

Access reviews integrated with Privileged Identity Management can be used to periodically review privileged Azure resource roles and determine whether users should retain access.

This directly addresses stale privileged access.

Resource locks protect resources from deletion or modification; they do not evaluate whether users still need RBAC permissions.

Azure Policy is useful for enforcing resource configurations, not for periodically certifying whether individual users still need privileged access.


Final Exam Takeaways

When you encounter an SC-500 question about overprivileged Azure RBAC access, think:

Evaluate the identity → evaluate the role → evaluate the scope → evaluate inherited/group access → determine the actual requirement → reduce role → reduce scope → remove unnecessary access → use PIM/access reviews for privileged access.

The most important principle is:

Least privilege = the minimum permissions at the minimum necessary scope for the minimum necessary period.

Also remember these high-value exam distinctions:

  • Owner → full resource access, including RBAC access management.
  • Contributor → broad resource management, but not normally Azure RBAC role assignment.
  • Reader → read-only management-plane access.
  • RBAC Administrator → role-assignment management with fewer permissions than User Access Administrator.
  • Role assignment = principal + role definition + scope.
  • Parent-scope assignments are inherited.
  • Narrow the role AND narrow the scope when remediating excessive access.
  • Custom roles are useful when built-in roles are too broad for the requirement.
  • NotActions is not a universal deny.
  • DataActions concern data-plane operations.
  • PIM helps reduce standing privileged access.
  • Access reviews help identify and remediate stale privileged assignments.
  • Groups, service principals, and managed identities must also be evaluated for excessive access.
  • The objective isn’t simply to remove permissions—it is to right-size access to what the principal actually needs.

Go to the SC-500 Exam Prep Hub main page

Implement and configure security controls by using infrastructure as code (SC-500 Exam Prep)

This post is a part of the "SC-500: Implementing End-to-End Security Controls for Cloud and AI Workloads" Exam Prep Hub.
This topic falls under these sections:
Manage identity, access, and governance (20–25%)
   --> Implement governance to enforce security and regulatory compliance
      --> Implement and configure security controls by using infrastructure as code


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Overview

Infrastructure as code (IaC) is the practice of defining and deploying infrastructure through machine-readable configuration files rather than manually creating and configuring resources through a portal.

For the SC-500 exam, IaC is important because security controls should be:

  • Consistent across environments
  • Repeatable and auditable
  • Enforced before deployment
  • Version-controlled
  • Reviewed through an approval process
  • Resistant to configuration drift
  • Integrated into the software development lifecycle

Common IaC technologies include:

  • Azure Resource Manager templates
  • Bicep
  • Terraform
  • Azure CLI and PowerShell scripts used within deployment automation
  • CI/CD pipelines such as GitHub Actions or Azure Pipelines

The objective is not simply to automate infrastructure deployment. The objective is to ensure that security and compliance requirements are built into the deployment process.


Why Infrastructure as Code Improves Security

Manual configuration can create inconsistent environments. For example, an administrator might enable encryption on one storage account but forget to enable it on another. A virtual network might be deployed with private access in one environment but with unnecessary public exposure in another.

IaC helps reduce these problems by defining the expected configuration in code.

Major security benefits

BenefitDescription
ConsistencyResources are deployed using the same approved configuration
RepeatabilityThe same secure configuration can be deployed multiple times
Version controlChanges can be tracked, reviewed, and reverted
AuditabilityOrganizations can identify who changed deployment code and when
StandardizationSecurity requirements can be applied across subscriptions and environments
Early detectionMisconfigurations can be identified before deployment
Reduced driftDeployed resources can be compared with the approved configuration
AutomationSecurity checks can run automatically in CI/CD pipelines

IaC does not automatically make an environment secure. Poorly written infrastructure code can reproduce insecure configurations at scale. Security must therefore be included in the design, validation, deployment, and monitoring processes.


Security Controls That Can Be Implemented Through IaC

IaC can define many Azure security settings, including:

Identity and access

  • Azure role assignments
  • Managed identities
  • Resource scopes
  • Role definitions
  • Access policies where supported
  • Privileged access configuration
  • Group-based access patterns

Governance

  • Azure Policy definitions
  • Policy assignments
  • Policy initiatives
  • Resource locks
  • Management group hierarchy
  • Required tags
  • Allowed regions
  • Allowed resource types
  • Naming standards

Network security

  • Virtual networks and subnets
  • Network security groups
  • Azure Firewall rules
  • Private endpoints
  • Private DNS zones
  • Route tables
  • Public network access settings
  • Network segmentation

Data protection

  • Storage encryption settings
  • Storage network restrictions
  • Secure transfer requirements
  • Key Vault configuration
  • Key and secret access
  • Azure SQL firewall rules
  • Auditing settings
  • Microsoft Defender plans

Compute security

  • Virtual machine encryption
  • Trusted launch settings
  • Managed identities
  • Just-in-time access configuration
  • Diagnostic settings
  • Container registry security
  • App Service authentication and networking settings

Security Should Be Defined at Multiple Layers

A mature IaC security strategy generally uses several layers.

1. Source-code controls

Security begins in the infrastructure repository.

Examples include:

  • Requiring pull requests
  • Requiring peer review
  • Protecting the main branch
  • Scanning for secrets
  • Scanning IaC files for insecure configurations
  • Preventing direct production changes
  • Maintaining approved modules
  • Tracking changes through version control

2. Pre-deployment validation

Before infrastructure is deployed, the code should be checked for:

  • Syntax errors
  • Invalid resource properties
  • Insecure defaults
  • Excessive permissions
  • Public network exposure
  • Missing encryption
  • Missing diagnostic settings
  • Noncompliant locations or resource types
  • Unapproved role assignments

Examples of tools and techniques include:

  • Bicep validation and linting
  • ARM template validation
  • Terraform validation and planning
  • Static analysis tools
  • Policy-as-code checks
  • Security scanning in CI/CD pipelines

3. Deployment-time controls

Azure Policy can evaluate resources during deployment and determine whether they comply with organizational requirements.

Depending on the policy effect, Azure Policy can:

  • Audit noncompliant resources
  • Deny noncompliant deployments
  • Modify resource properties
  • Deploy supporting configuration
  • Append required properties
  • Audit or deny public network access
  • Require diagnostic settings
  • Enforce approved resource locations

A secure deployment pipeline should use preventive controls where practical and auditing controls where immediate denial would disrupt legitimate deployment requirements.

4. Post-deployment monitoring

After deployment, organizations should continue checking for:

  • Configuration drift
  • Unauthorized changes
  • Newly created resources
  • Changes to role assignments
  • Disabled security controls
  • Public exposure
  • Missing logs
  • Noncompliant resources

Microsoft Defender for Cloud, Azure Policy compliance data, Azure Activity Logs, and Microsoft Sentinel can support this process.


Azure Policy and Infrastructure as Code

Azure Policy is a governance service used to enforce organizational standards and assess resource compliance.

IaC defines the desired infrastructure configuration, while Azure Policy provides an additional governance layer that can evaluate or enforce requirements across deployments.

Example

An organization requires all storage accounts to disable public blob access.

The organization can:

  1. Define the desired storage configuration in Bicep or Terraform.
  2. Add a validation check to the deployment pipeline.
  3. Assign an Azure Policy that audits or denies public blob access.
  4. Monitor compliance after deployment.
  5. Remediate existing noncompliant resources.

This layered approach is stronger than relying on IaC alone.

Common Azure Policy effects

EffectPurpose
AuditRecords noncompliance without blocking deployment
DenyBlocks creation or update of noncompliant resources
ModifyChanges or adds resource properties during deployment
AppendAdds properties to a resource request
DeployIfNotExistsDeploys supporting resources or configuration when missing
AuditIfNotExistsAudits resources when a related configuration is missing
DisabledDisables the policy

A policy assignment can be scoped at a management group, subscription, resource group, or resource level. Policies assigned at a parent scope can affect child resources.


Policy as Code

Policy as code means representing governance and security requirements in a format that can be version-controlled, reviewed, tested, and deployed through automation.

Examples include:

  • Azure Policy definitions stored in a repository
  • Policy initiatives defined as code
  • Terraform configurations for policy assignments
  • Bicep modules that deploy policy definitions and assignments
  • Automated compliance tests in a pipeline

Benefits of policy as code

  • Policies can be reviewed like application code.
  • Changes can be approved before deployment.
  • Policy definitions can be reused across environments.
  • Organizations can maintain consistent governance.
  • Policy changes can be rolled back.
  • Compliance requirements become visible and traceable.

Example workflow

  1. A security team creates a policy requiring private endpoints for selected PaaS services.
  2. The policy is stored in source control.
  3. A pull request is created.
  4. Automated checks validate the policy syntax and scope.
  5. Security and platform teams review the change.
  6. The policy is deployed through a pipeline.
  7. Compliance results are monitored.
  8. Exceptions are documented and approved.

Secure Bicep and ARM Deployments

Bicep is a declarative language used to define Azure resources. Bicep files are compiled into Azure Resource Manager templates.

Security practices for Bicep and ARM templates include:

Avoid hard-coded secrets

Do not place passwords, access keys, connection strings, or tokens directly in templates or parameter files.

Use services such as:

  • Azure Key Vault
  • Managed identities
  • Secure pipeline variables
  • Secret references supported by the deployment mechanism

Even when a secret is stored in a parameter file, the file may still be exposed through source control, build logs, or deployment artifacts.

Use secure parameters

Sensitive values should be handled as secure parameters where supported. However, secure parameters do not replace proper secret management.

Prefer managed identities

Managed identities reduce the need to store credentials in application configuration or deployment scripts.

For example, an application can use a managed identity to access Key Vault instead of storing a client secret in the application.

Use modules

Reusable Bicep modules can standardize secure configurations, such as:

  • Storage accounts with public access disabled
  • Private endpoints
  • Diagnostic settings
  • Required tags
  • Approved network rules
  • Managed identities
  • Standardized role assignments

Limit role-assignment scope

Role assignments should be deployed at the narrowest scope required.

A deployment should not assign subscription-level Owner access when resource-group-level access is sufficient.

Use explicit resource properties

Security-sensitive settings should be explicitly defined rather than relying on uncertain defaults.

Examples include:

  • Disabling public network access
  • Requiring secure transfer
  • Enabling diagnostic settings
  • Enabling encryption
  • Restricting network access
  • Selecting approved SKUs and regions

Secure Terraform Deployments

Terraform can manage Azure infrastructure through the Azure provider.

Important security practices include:

  • Store Terraform code in version control.
  • Protect the Terraform state file.
  • Use a secure remote backend.
  • Restrict access to state files.
  • Avoid storing secrets in state whenever possible.
  • Use managed identities or workload identities for pipeline authentication.
  • Review Terraform plans before applying changes.
  • Use policy checks before deployment.
  • Separate development and production state.
  • Restrict who can execute production applies.

Terraform state security

Terraform state may contain sensitive information about deployed resources and, depending on the configuration, may contain secrets or sensitive values.

Therefore:

  • Do not store state in a public location.
  • Encrypt state at rest.
  • Restrict access using Azure RBAC.
  • Enable appropriate storage protections.
  • Use locking to prevent conflicting changes.
  • Avoid placing state files in source control.

Protecting the IaC code is not enough. The state file and pipeline credentials must also be protected.


Secure CI/CD Pipelines

A deployment pipeline should treat infrastructure code as production code.

Recommended controls

  • Require approval for production deployments.
  • Use separate deployment identities for different environments.
  • Grant the pipeline only the permissions it needs.
  • Use workload identity federation where supported.
  • Avoid long-lived client secrets.
  • Store secrets in an approved secret-management service.
  • Scan templates and scripts before deployment.
  • Require successful policy checks.
  • Log deployment activity.
  • Restrict who can modify pipeline definitions.
  • Protect deployment branches.
  • Use separate stages for validation, testing, approval, and deployment.

Pipeline identity permissions

The pipeline identity should not automatically receive Owner at the subscription level.

For example, if a pipeline only deploys resources in one resource group, its permissions should be limited to that resource group whenever possible.

If the pipeline must create role assignments, that capability should be granted deliberately because role-assignment permissions are highly privileged.


Role Assignments in Infrastructure as Code

A role assignment consists of:

  1. A security principal
  2. A role definition
  3. A scope

The principal may be:

  • A user
  • A security group
  • A service principal
  • A managed identity
  • Another supported workload identity

When defining role assignments through IaC, consider:

  • Whether the assignment is necessary
  • Whether the role is too broad
  • Whether the scope is too broad
  • Whether a group should be used instead of an individual
  • Whether the assignment should be temporary
  • Whether the principal still exists
  • Whether the assignment creates privilege escalation risk

Example of an insecure pattern

A deployment template assigns Owner at the subscription scope to an application service principal.

This creates a significant risk because the service principal may be able to:

  • Modify resources
  • Delete resources
  • Create role assignments
  • Grant access to other identities
  • Escalate privileges

A safer design would use:

  • A narrower built-in role
  • A resource-group or resource scope
  • A managed identity
  • A custom role only if necessary
  • Separate deployment and runtime identities

Preventing Excessive Permissions

IaC should be reviewed for permissions that can lead to privilege escalation.

Particular attention should be given to permissions such as:

  • Creating or deleting role assignments
  • Managing role definitions
  • Assigning Owner or User Access Administrator
  • Managing policy assignments
  • Modifying Key Vault access
  • Changing network access controls
  • Disabling security monitoring
  • Modifying diagnostic settings
  • Deleting security resources

A custom role containing broad wildcard permissions may be more dangerous than a carefully selected built-in role.

Custom roles should be used only when built-in roles cannot satisfy the requirement. Their permissions should be narrowly defined and regularly reviewed.


Resource Locks and IaC

Resource locks can help protect critical resources from accidental deletion or modification.

Common lock types include:

  • Read-only
  • CanNotDelete

However, locks must be considered carefully in IaC workflows.

For example:

  • A deployment may fail if it attempts to modify a resource protected by a read-only lock.
  • A delete operation may fail because of a CanNotDelete lock.
  • The identity managing locks must have appropriate permissions.
  • Locks should not be treated as a replacement for RBAC, backups, or change control.

IaC can deploy and manage locks, but the deployment process should account for their effect on future updates.


Managing Exceptions

Security policies sometimes need exceptions for legitimate business requirements.

Exceptions should be:

  • Explicitly documented
  • Limited in scope
  • Time-bound where possible
  • Approved by the appropriate authority
  • Associated with a business justification
  • Monitored for continued necessity

Avoid broad exemptions at the subscription or management-group level when a resource-level exemption would be sufficient.

An exception should not become a permanent way to bypass security controls.


Handling Configuration Drift

Configuration drift occurs when deployed resources no longer match the approved IaC configuration.

Drift can occur when:

  • An administrator changes a resource manually
  • A script modifies a setting
  • A security control is disabled
  • A resource is updated outside the pipeline
  • A policy assignment changes
  • A role assignment is added directly through the portal

Drift-management process

  1. Detect the difference.
  2. Determine whether the change was authorized.
  3. Identify the responsible identity.
  4. Restore the approved configuration if necessary.
  5. Update the IaC code if the change is legitimate.
  6. Review whether additional controls are needed to prevent recurrence.

IaC should be treated as the authoritative definition of the desired state, but organizations should establish clear procedures for handling legitimate emergency changes.


Recommended Secure IaC Workflow

A secure end-to-end workflow can be organized as follows:

Step 1: Define security requirements

Identify requirements for:

  • Identity
  • Access
  • Network exposure
  • Encryption
  • Logging
  • Monitoring
  • Compliance
  • Data protection
  • Resource ownership

Step 2: Create reusable secure modules

Build approved modules for common resource types and configurations.

Step 3: Store code in source control

Use protected repositories and require peer review.

Step 4: Validate the code

Run:

  • Syntax validation
  • Static analysis
  • Secret scanning
  • Policy checks
  • Security configuration checks

Step 5: Generate and review the deployment plan

Review what the deployment will create, modify, or delete.

Step 6: Apply governance controls

Use Azure Policy and other preventive controls to block noncompliant deployments.

Step 7: Require approval for sensitive environments

Production deployments and privilege changes should require appropriate approval.

Step 8: Deploy using least privilege

Use a dedicated deployment identity with only the required permissions.

Step 9: Monitor compliance

Review policy compliance, activity logs, Defender for Cloud recommendations, and security alerts.

Step 10: Remediate drift

Investigate unauthorized changes and restore the approved configuration.


Common Exam Traps

Trap 1: IaC alone guarantees security

IaC can reproduce insecure settings. Security validation and governance are still required.

Trap 2: Azure Policy and IaC are identical

IaC defines desired infrastructure. Azure Policy evaluates or enforces governance requirements. They complement each other.

Trap 3: A pipeline identity should be Owner

The pipeline should receive only the permissions required for deployment. Owner is often unnecessarily broad.

Trap 4: Secure parameters eliminate secret-management risks

Secrets may still appear in state files, logs, artifacts, or source control. Use a dedicated secret-management solution.

Trap 5: A custom role is automatically safer

A custom role with wildcard permissions can be extremely broad. Least privilege depends on the actual permissions and scope.

Trap 6: Policy audit and policy deny have the same effect

Audit reports noncompliance. Deny blocks the deployment or update.

Trap 7: Resource locks replace RBAC

Locks protect against certain deletion or modification operations but do not determine who can access a resource.

Trap 8: A deployment at subscription scope is always appropriate

The deployment identity and role assignments should be scoped as narrowly as possible.

Trap 9: Terraform state is harmless

State may contain sensitive infrastructure details and secrets. It must be protected.

Trap 10: Manual emergency changes do not matter

Manual changes can create configuration drift and should be investigated, documented, and reconciled with IaC.


Practice Exam Questions

Question 1

A company uses Bicep to deploy storage accounts. Security requires that all storage accounts disable public network access. The company wants noncompliant deployments to be blocked automatically.

What should the company implement?

A. An Azure Activity Log alert
B. An Azure Policy with the Deny effect
C. A resource lock on each storage account
D. A Microsoft Sentinel workbook

Correct answer: B

Explanation: An Azure Policy with the Deny effect can block the creation or update of resources that do not meet the required configuration. Activity Log alerts and Sentinel workbooks provide monitoring, while resource locks do not enforce storage network settings.


Question 2

A Terraform deployment pipeline creates resources in a single resource group. The pipeline currently has Owner access at the subscription scope.

What is the best security improvement?

A. Grant the pipeline Global Administrator
B. Replace Terraform with manual deployments
C. Give the pipeline Contributor access at the subscription scope
D. Reduce the pipeline identity’s permissions and scope to what the deployment requires

Correct answer: D

Explanation: The pipeline should follow least privilege. If it only deploys resources in one resource group, its permissions should be limited to that resource group and should exclude unnecessary role-assignment or administrative permissions.


Question 3

An organization wants security policies to be reviewed, version-controlled, and deployed through a CI/CD pipeline.

Which approach best meets this requirement?

A. Store Azure Policy definitions in source control and deploy them as policy as code
B. Configure all policies manually in the Azure portal
C. Use resource locks instead of policies
D. Review policy compliance only once each year

Correct answer: A

Explanation: Policy as code allows policy definitions and assignments to be version-controlled, peer-reviewed, tested, and deployed consistently through automation.


Question 4

A developer places a database password directly in a Bicep parameter file stored in a private repository.

Why is this still a security concern?

A. The password may be exposed through source control, logs, or deployment artifacts
B. Parameter files cannot contain strings
C. Bicep cannot deploy database resources
D. Azure Policy automatically publishes parameter values

Correct answer: A

Explanation: A private repository does not eliminate the risk of secret exposure. Secrets may appear in source history, build logs, deployment outputs, artifacts, or copied files. Secrets should be stored and retrieved through an approved secret-management solution.


Question 5

A company wants to ensure that every production resource has diagnostic settings configured.

Which Azure Policy effect is most appropriate when the organization wants Azure to deploy the missing configuration automatically?

A. Audit
B. DeployIfNotExists
C. Disabled
D. Deny

Correct answer: B

Explanation: DeployIfNotExists can deploy supporting configuration when the required related resource or setting is missing. Audit only reports noncompliance, while Deny blocks noncompliant deployments.


Question 6

A Terraform state file is stored in a publicly accessible storage container.

What should the security team do first?

A. Delete all Terraform configuration files
B. Grant all administrators access to the container
C. Move the state to a protected backend and restrict access
D. Add a resource lock to the storage account only

Correct answer: C

Explanation: Terraform state can contain sensitive infrastructure information and potentially secret values. It should be stored in a secured backend with encryption, access controls, and appropriate protection against unauthorized access.


Question 7

A Bicep template assigns the Owner role at the subscription scope to a service principal used by an application at runtime.

What is the best remediation?

A. Replace the service principal with a user account
B. Assign the Owner role at the management-group scope
C. Disable Azure RBAC
D. Use a managed identity and grant only the required role at the narrowest scope

Correct answer: D

Explanation: Runtime applications should not normally receive Owner access. A managed identity and a narrowly scoped role reduce credential-management risk and limit the impact of compromise.


Question 8

A policy requiring private endpoints is stored in a repository. A developer submits a change that changes the policy effect from Deny to Audit without approval.

Which control would best prevent this change from being deployed?

A. A protected branch and required pull-request approval
B. A read-only resource lock
C. A storage firewall rule
D. A virtual network peering connection

Correct answer: A

Explanation: Source-control protections and required reviews can prevent unauthorized changes to policy code before it reaches the deployment pipeline. Resource locks and network controls do not govern repository changes.


Question 9

An administrator manually disables encryption on a resource that was originally deployed through IaC.

What is this situation called, and what should the organization do?

A. Privilege activation; permanently assign the administrator Owner
B. Configuration drift; investigate and restore the approved configuration
C. Policy inheritance; remove the management group
D. Deployment compilation; rebuild the Bicep compiler

Correct answer: B

Explanation: Configuration drift occurs when the deployed environment no longer matches the approved IaC configuration. The organization should investigate the change, determine whether it was authorized, and restore or update the desired configuration appropriately.


Question 10

An organization wants to allow a deployment pipeline to create resources and assign a specific role to a managed identity, but it does not want the pipeline to have unrestricted access to all role assignments.

What is the best approach?

A. Grant the pipeline subscription-level Owner access
B. Grant the pipeline Global Administrator
C. Use narrowly scoped role-assignment permissions and conditions where supported
D. Allow the pipeline to modify all custom role definitions

Correct answer: C

Explanation: Role-assignment management is highly privileged. The organization should limit the pipeline’s scope and permissions and use supported conditions to constrain which roles, principals, or actions it can manage.


Final Takeaways

For the SC-500 exam, remember these principles:

  • Define security requirements in infrastructure code.
  • Validate IaC before deployment.
  • Use Azure Policy as an additional governance layer.
  • Prefer Deny for requirements that must block noncompliant deployments.
  • Use DeployIfNotExists when missing supporting configuration should be deployed automatically.
  • Protect secrets, pipeline credentials, and Terraform state.
  • Use managed identities and workload identities instead of long-lived secrets.
  • Scope deployment permissions narrowly.
  • Review role assignments carefully, especially Owner and role-assignment management permissions.
  • Use source control, peer review, and protected deployment pipelines.
  • Monitor for configuration drift after deployment.
  • Treat IaC as a repeatable security-control mechanism, not as a substitute for monitoring and governance.

Go to the SC-500 Exam Prep Hub main page

Implement and configure security for storage accounts (SC-500 Exam Prep)

This post is a part of the "SC-500: Implementing End-to-End Security Controls for Cloud and AI Workloads" Exam Prep Hub.
This topic falls under these sections:
Secure storage, databases, and networking (25–30%)
   --> Implement security for storage accounts
      --> Implement and configure security for storage accounts


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Overview

Azure Storage provides cloud storage for:

  • Blob Storage
  • Azure Files
  • Queue Storage
  • Table Storage
  • Azure Data Lake Storage capabilities

Because storage accounts frequently contain sensitive business, application, backup, and analytical data, they must be protected against:

  • Unauthorized access
  • Accidental exposure
  • Data exfiltration
  • Credential theft
  • Malware uploads
  • Ransomware
  • Accidental deletion
  • Insecure network connections
  • Excessive permissions
  • Configuration drift

For the SC-500 exam, securing an Azure Storage account involves combining:

  1. Identity and access controls
  2. Network security
  3. Encryption and data protection
  4. Monitoring and threat detection
  5. Governance and compliance
  6. Backup, recovery, and data-retention controls

A secure configuration should follow the Zero Trust principles of verifying explicitly, using least-privilege access, and assuming that a breach may occur.


1. Use the Correct Storage Account Configuration

New storage accounts should use the Azure Resource Manager deployment model rather than the classic deployment model.

Azure Resource Manager-based storage accounts support modern security and governance capabilities, including:

  • Azure RBAC
  • Managed identities
  • Microsoft Entra authorization
  • Resource locks
  • Azure Policy
  • Tags
  • Modern deployment and management controls

The storage account configuration selected during creation can affect the security posture of every workload that uses the account. Therefore, account type, redundancy, networking, and endpoint configuration should be selected carefully.


2. Control Network Access

Azure Storage accounts have public endpoints. Network access should be restricted to only the clients and services that require it.

Public network access

If a storage account is intended to be accessed only through private connectivity, disable public network access.

This configuration helps ensure that clients must use private endpoints rather than the public endpoint.

However, creating a private endpoint does not automatically disable the public endpoint. The public endpoint must be separately blocked or restricted.

Private endpoints

A private endpoint provides a private IP address from an Azure virtual network for accessing a storage service.

Traffic travels through Azure Private Link and the Microsoft backbone rather than through the public internet.

Private endpoints are useful when:

  • Applications run in Azure virtual networks
  • Storage should not be publicly reachable
  • On-premises systems connect through VPN or ExpressRoute
  • Data exfiltration risk must be reduced
  • The organization requires private connectivity to PaaS services

A private endpoint can be created for the required storage service, such as Blob Storage, File Storage, Queue Storage, or Table Storage.

Important exam point

A private endpoint does not replace authorization. A client must still have appropriate permissions to access the storage data.

Network access and data authorization are separate controls:

  • Network controls determine whether the client can reach the service.
  • Authorization controls determine what the client can do after reaching it.

Storage firewalls and virtual network rules

When public access is necessary, use storage firewall rules to restrict access.

Possible network rule sources include:

  • Specific virtual network subnets
  • Public IP address ranges
  • Azure resource instances
  • Trusted Azure services

A common secure configuration is:

  1. Set the public network access rule to Selected networks.
  2. Set the default network action to Deny.
  3. Allow only approved IP ranges or virtual network subnets.
  4. Add narrowly scoped exceptions when required.

Virtual network rules generally require a service endpoint on the applicable subnet.

Example

A storage account is used by an application running in a specific subnet.

A secure design might:

  • Enable the Microsoft.Storage service endpoint on the subnet.
  • Add the subnet to the storage account’s virtual network rules.
  • Set the default network action to Deny.
  • Disable public access if a private endpoint is used instead.

Trusted Azure services

Some Azure services may need to access a storage account even though they do not originate from an explicitly approved virtual network or IP address.

A trusted-service exception can allow approved Azure services to access the account.

However, broad trusted-service exceptions increase the trust boundary. Where supported, a resource instance rule can provide a more narrowly scoped alternative by authorizing a specific Azure resource and its managed identity.

Exam consideration

Do not automatically select “Allow trusted Microsoft services” when the requirement is to allow only one specific Azure resource. A resource instance rule may provide a narrower security boundary.


Network security perimeter

A network security perimeter can establish a broader security boundary around supported PaaS resources.

It can help control:

  • Inbound traffic
  • Outbound traffic
  • PaaS-to-PaaS communication
  • Data-exfiltration paths

A perimeter may be useful when multiple storage accounts and other PaaS resources need to be governed as a group rather than through independent account-level rules.


3. Require Secure Connections

Secure transfer required

Enable the Secure transfer required setting to reject requests made over HTTP.

This setting applies to:

  • Storage REST endpoints
  • Azure Files SMB access

Secure transfer helps protect data in transit against interception and other network attacks.

Minimum TLS version

Configure the storage account to require TLS 1.2 or later.

This prevents clients from negotiating older, deprecated TLS versions.

A strong baseline is:

  • Secure transfer required: Enabled
  • Minimum TLS version: TLS 1.2 or later

These controls work together:

  • Secure transfer prevents unencrypted HTTP access.
  • Minimum TLS controls the strength of the encrypted connection.

4. Prevent Anonymous Public Blob Access

Blob containers can potentially be configured for anonymous public access.

Anonymous access should be disabled unless there is a documented business requirement for public content.

Important controls include:

  • Disable public blob access at the storage-account level.
  • Avoid configuring containers for anonymous access.
  • Use authenticated access for private data.
  • Use Azure Front Door and a Web Application Firewall when publicly serving appropriate content through a controlled application architecture.

Public access is especially dangerous when a storage account contains:

  • Customer information
  • Internal documents
  • Backups
  • Application data
  • AI training data
  • Logs
  • Personally identifiable information

A storage account can have network restrictions and still expose data anonymously if public blob access is enabled. Network security and authorization must both be evaluated.


5. Use Microsoft Entra ID and Azure RBAC

Azure RBAC is generally preferred over shared account keys for identity-based access to Azure Storage data.

RBAC assignments can be made to:

  • Users
  • Security groups
  • Managed identities
  • Service principals
  • Other supported workload identities

Assign roles at the narrowest scope required:

  • Storage account
  • Container
  • Resource group
  • Subscription, only when necessary

Use groups instead of assigning roles individually where practical.

Common data-access roles

Examples of storage data roles include:

  • Storage Blob Data Reader
  • Storage Blob Data Contributor
  • Storage Blob Data Owner
  • Storage Queue Data Contributor
  • Storage Table Data Contributor
  • Storage File Data SMB Share Reader
  • Storage File Data SMB Share Contributor

The correct role depends on the service and the required operations.

Reader versus Contributor

A principal that only needs to read blobs should not receive a data-contributor role.

A contributor role may allow the principal to create, modify, or delete data. Therefore, it should be used only when those capabilities are required.

Control-plane versus data-plane access

Azure RBAC permissions can relate to two different areas:

Control plane

Control-plane permissions manage the storage account resource itself.

Examples include:

  • Creating the storage account
  • Changing networking settings
  • Modifying account configuration
  • Deleting the account

Data plane

Data-plane permissions control access to the data stored in the account.

Examples include:

  • Reading blobs
  • Writing blobs
  • Deleting blobs
  • Reading queue messages
  • Accessing file shares

A user may have permission to manage the storage account without having the required data-plane role, or may have data access without being able to modify the storage account configuration.


6. Prefer Managed Identities for Applications

Applications running in Azure should generally use managed identities instead of storing storage account keys or client secrets.

Managed identities can be used by supported Azure resources to obtain Microsoft Entra tokens without requiring developers to manage credentials.

A typical design is:

  1. Enable a managed identity on the application.
  2. Assign the required storage data role to the identity.
  3. Scope the assignment to the storage account or container.
  4. Configure the application to authenticate using Microsoft Entra ID.
  5. Remove unnecessary account-key usage.

This reduces the risk of:

  • Secrets being stored in code
  • Credentials appearing in configuration files
  • Secret rotation failures
  • Long-lived credentials being compromised

7. Understand Shared Key Authorization and SAS

Storage account keys

Storage account keys provide broad access to storage services. Anyone who obtains a valid key may be able to access data or perform operations allowed by that key.

Risks include:

  • Broad permissions
  • Difficult attribution to individual users
  • Credential leakage
  • Long-lived access
  • Difficult rotation processes

Where possible, use Microsoft Entra authorization and Azure RBAC instead.

Shared Access Signatures

A Shared Access Signature, or SAS, grants delegated access to storage resources.

A SAS can restrict:

  • Resource
  • Permissions
  • Start time
  • Expiration time
  • Allowed protocol
  • IP address, where supported

SAS is useful when a client needs limited, temporary access without receiving the storage account key.

However, a SAS is still a bearer token. Anyone who obtains it may use it until it expires or is revoked through the applicable mechanism.

SAS best practices

  • Use the shortest practical expiration period.
  • Grant only the required permissions.
  • Restrict the resource scope.
  • Require HTTPS.
  • Avoid exposing SAS tokens in URLs, logs, or source control.
  • Prefer user delegation SAS for Blob Storage when appropriate because it is authorized through Microsoft Entra credentials rather than the storage account key.
  • Have a revocation strategy for compromised tokens.

Important distinction

A SAS does not bypass network restrictions. A request must satisfy both:

  1. Storage network access rules
  2. SAS or identity authorization requirements

8. Consider Disabling Shared Key Authorization

If an organization wants to require Microsoft Entra-based authorization, it can disable shared key access where supported.

Disabling shared key authorization also affects account-key-based and service SAS access because those SAS types depend on shared keys.

Before disabling shared key authorization, verify that all applications and services have been migrated to supported alternatives, such as:

  • Microsoft Entra ID
  • Azure RBAC
  • Managed identities
  • User delegation SAS

The change should be tested carefully because legacy applications may still depend on account keys.


9. Protect Data at Rest

Azure Storage encrypts data at rest by default using Microsoft-managed keys.

Additional controls may be required for sensitive or regulated data.

Customer-managed keys

Customer-managed keys allow the organization to control the encryption key used for storage encryption.

Keys can be managed through:

  • Azure Key Vault
  • Azure Key Vault Managed HSM

Customer-managed keys can support requirements involving:

  • Customer control of encryption keys
  • Key rotation
  • Key access auditing
  • Key revocation
  • Regulatory compliance

Customer-managed keys introduce additional responsibilities. The organization must protect the key-management service and ensure that the storage account can access the key when required.

If the key becomes unavailable or access is revoked incorrectly, storage operations may be affected.

Infrastructure encryption

Infrastructure encryption provides an additional service-managed encryption layer.

It is sometimes described as double encryption because data receives an additional encryption layer beyond the primary storage encryption.

Infrastructure encryption must be enabled when the storage account is created and may not be available as a setting that can be enabled later for an existing account.

Encryption scopes

Encryption scopes allow different encryption keys or key-management policies to be applied to specific containers or blobs.

They can be useful when:

  • Multiple tenants share a storage account
  • Different data sets require separate key control
  • Data classification requires different encryption arrangements

10. Protect Data from Accidental or Malicious Deletion

Encryption does not protect against deletion. Additional data-protection features are required.

Blob soft delete

Blob soft delete allows deleted blobs to be retained for a configured period so they can be recovered.

It helps protect against:

  • Accidental deletion
  • Malicious deletion
  • Application errors
  • Ransomware-related deletion activity

Container soft delete

Container soft delete protects deleted containers and their contents during the retention period.

Versioning

Blob versioning automatically maintains previous versions of blob data when supported operations modify or overwrite blobs.

Versioning can help recover from:

  • Accidental overwrites
  • Malicious changes
  • Application defects
  • Data corruption

Immutable blob storage

Immutable storage can enforce write-once, read-many behavior.

It is useful for data that must not be modified or deleted during a retention period, such as:

  • Compliance records
  • Financial records
  • Legal evidence
  • Audit logs
  • Regulatory archives

Immutable storage can use:

  • Time-based retention
  • Legal holds

Important exam distinction

Soft delete helps recover deleted data. Immutable storage helps prevent modification or deletion during a protected retention period. They address different risks and may be used together.


11. Use Resource Locks Carefully

Resource locks protect the storage account resource from accidental deletion or modification.

Common lock types include:

  • CanNotDelete
  • ReadOnly

A CanNotDelete lock helps prevent deletion of the storage account.

A ReadOnly lock prevents modification and deletion operations against the locked resource, although it can interfere with normal management operations.

Resource locks:

  • Apply to the resource configuration
  • Do not protect individual blobs by themselves
  • Do not replace soft delete
  • Do not replace immutable storage
  • Do not replace RBAC
  • Do not replace backups

Locks should be included in IaC where appropriate, but deployment pipelines must account for the restrictions imposed by the locks.


12. Enable Microsoft Defender for Storage

Microsoft Defender for Storage provides threat detection and security capabilities for storage accounts.

Depending on the enabled capabilities and supported services, Defender for Storage can help detect:

  • Suspicious access patterns
  • Malicious IP addresses
  • Unusual authentication activity
  • Potential data exfiltration
  • Malware uploaded to blobs
  • Sensitive data-related risks

Defender for Storage can include malware scanning for blob uploads and sensitive data discovery capabilities.

It can be enabled at the subscription level or for selected storage accounts, depending on the required configuration.

Defender for Storage complements preventive controls. It does not replace:

  • RBAC
  • Network restrictions
  • Encryption
  • Secure transfer
  • Public-access controls
  • Data-retention features

13. Enable Logging and Monitoring

Storage accounts should be monitored continuously.

Diagnostic settings can send logs and metrics to services such as:

  • Log Analytics
  • Microsoft Sentinel
  • Event Hubs
  • Storage accounts for archival purposes

Important events to monitor include:

  • Storage account key regeneration
  • Changes to firewall rules
  • Changes to public network access
  • Changes to encryption settings
  • Role-assignment changes
  • Shared Key usage
  • Anonymous access
  • Storage read operations
  • Storage write operations
  • Storage delete operations
  • Defender for Storage alerts

Storage logs can indicate how a request was authorized, such as through:

  • Microsoft Entra ID
  • Shared Key
  • SAS
  • Anonymous access

This information can help identify unexpected authentication methods or unauthorized access patterns.


14. Apply Azure Policy

Azure Policy can enforce or audit storage security requirements across subscriptions and management groups.

Examples of useful policy requirements include:

  • Require secure transfer
  • Require TLS 1.2 or later
  • Deny public network access
  • Deny public blob access
  • Require infrastructure encryption
  • Require customer-managed keys
  • Require diagnostic settings
  • Require approved locations
  • Require specific tags
  • Restrict allowed resource types

Common policy effects include:

EffectPurpose
AuditReports noncompliant resources
DenyBlocks noncompliant creation or updates
ModifyChanges resource properties during deployment
DeployIfNotExistsDeploys missing supporting configuration
AuditIfNotExistsReports missing related configuration

For example, a policy with a Deny effect can prevent the deployment of a storage account that permits public network access.

An Audit policy is useful when the organization needs to discover existing noncompliance without immediately blocking deployments.


15. Use Infrastructure as Code for Secure Storage Deployments

Storage accounts should be deployed through approved infrastructure-as-code templates or modules.

IaC can define:

  • Network access settings
  • Private endpoints
  • Firewall rules
  • Secure transfer
  • Minimum TLS version
  • Encryption settings
  • Diagnostic settings
  • Role assignments
  • Blob versioning
  • Soft-delete retention
  • Public access settings
  • Resource locks
  • Tags

A secure deployment pipeline should:

  1. Store templates in source control.
  2. Require peer review.
  3. Scan templates for insecure settings.
  4. Prevent secrets from being embedded in code.
  5. Validate policy compliance.
  6. Review deployment plans.
  7. Require approval for production changes.
  8. Deploy using a least-privileged identity.
  9. Monitor the deployed resources.
  10. Detect and remediate configuration drift.

IaC is not inherently secure. An insecure template can reproduce the same vulnerability across many storage accounts.


16. Recommended Secure Storage Baseline

A general secure baseline may include:

  • Use Azure Resource Manager-based storage accounts.
  • Disable public network access when private connectivity is sufficient.
  • Use private endpoints for internal workloads.
  • Set public network rules to deny by default.
  • Require secure transfer.
  • Require TLS 1.2 or later.
  • Disable public blob access.
  • Prefer Microsoft Entra ID and Azure RBAC.
  • Use managed identities for applications.
  • Avoid account keys where possible.
  • Use short-lived, narrowly scoped SAS tokens when required.
  • Enable encryption at rest.
  • Use customer-managed keys for applicable compliance requirements.
  • Enable infrastructure encryption when required.
  • Enable soft delete and versioning.
  • Use immutable storage for protected records.
  • Enable Defender for Storage.
  • Configure diagnostic settings.
  • Apply Azure Policy.
  • Monitor role assignments and network changes.
  • Protect storage configuration with resource locks where appropriate.

Common Exam Traps

Trap 1: A private endpoint automatically disables public access

It does not. Public network access must be separately disabled or restricted.

Trap 2: A firewall rule grants data access

A firewall rule controls network reachability. The client still needs appropriate authorization.

Trap 3: Contributor provides blob data access

The Contributor role is primarily a management-plane role. Data access generally requires an appropriate storage data role.

Trap 4: SAS is always secure

SAS tokens can be leaked and may provide access until expiration or revocation. They must be narrowly scoped and short-lived.

Trap 5: Encryption prevents deletion

Encryption protects confidentiality of data at rest. It does not prevent deletion or overwriting.

Trap 6: Soft delete prevents all changes

Soft delete helps recover deleted data. It does not provide the same protection as immutable storage.

Trap 7: Resource locks protect blobs

Resource locks protect the storage account resource. They do not independently protect individual blobs from deletion.

Trap 8: Trusted Azure services is always the best option

A resource instance rule may provide a narrower exception when only one specific Azure resource needs access.

Trap 9: Azure RBAC replaces network security

RBAC and network controls solve different problems. Both may be required.

Trap 10: Defender for Storage prevents every attack

Defender for Storage provides detection and protection capabilities, but it does not replace preventive configuration controls.


Practice Exam Questions

Question 1

A company has a storage account that is used only by applications running inside an Azure virtual network. The security team requires that the account not be accessible through the public internet.

What should the company implement?

A. A storage firewall rule allowing all public IP addresses
B. A private endpoint and disabled public network access
C. A SAS token with a one-year expiration
D. A resource lock

Correct answer: B

Explanation: A private endpoint provides private connectivity from the virtual network. Public network access should also be disabled because creating a private endpoint does not automatically block the public endpoint.


Question 2

An application needs to read blobs from one container but must not upload, modify, or delete blobs.

Which access configuration should be used?

A. Storage Blob Data Owner at the subscription scope
B. Storage Blob Data Contributor at the storage-account scope
C. Owner at the resource-group scope
D. Storage Blob Data Reader at the narrowest appropriate scope

Correct answer: D

Explanation: Storage Blob Data Reader provides read access without granting write or delete permissions. The assignment should be scoped to the container or storage account as appropriate.


Question 3

A storage account must allow access from only two corporate public IP ranges. All other public network traffic must be blocked.

Which configuration should be used?

A. Create a resource lock
B. Enable anonymous blob access
C. Assign the Reader role to the corporate users
D. Set the default public network action to Deny and add the two IP ranges

Correct answer: D

Explanation: Storage firewall rules can restrict public endpoint access to specified IP ranges. The default action should be Deny so that only explicitly permitted sources can connect.


Question 4

A company wants to prevent applications from using storage account keys and require Microsoft Entra-based authorization instead.

What should the company consider?

A. Enable anonymous public access
B. Disable all diagnostic settings
C. Disable shared key authorization after migrating dependent applications
D. Assign Owner to every application identity

Correct answer: C

Explanation: Disabling shared key authorization can require applications to use Microsoft Entra ID, managed identities, Azure RBAC, or supported alternatives. The organization must first identify and migrate applications that depend on account keys or key-based SAS.


Question 5

A storage account contains financial records that must not be modified or deleted for seven years.

Which feature is most appropriate?

A. Blob versioning only
B. Immutable blob storage with time-based retention
C. A storage firewall
D. A private endpoint

Correct answer: B

Explanation: Immutable storage with time-based retention is designed to prevent modification or deletion during a defined retention period. Versioning helps recover previous versions but does not provide the same write-once, read-many protection.


Question 6

An Azure application needs temporary access to upload files to a specific blob container. The application should not receive the storage account key.

Which option is most appropriate?

A. A narrowly scoped, short-lived SAS token
B. Subscription-level Owner access
C. Anonymous public access to the container
D. A ReadOnly resource lock

Correct answer: A

Explanation: A SAS token can provide limited permissions to a specific resource for a defined period. It should be short-lived, restricted to the required operations, and transmitted only over HTTPS.


Question 7

A security team wants Azure to block the deployment of storage accounts that permit public blob access.

Which control should be used?

A. Microsoft Sentinel workbook
B. Azure Monitor metric alert
C. Azure Policy with the Audit effect
D. Azure Policy with the Deny effect

Correct answer: D

Explanation: The Deny effect blocks creation or updates that violate the policy. Audit identifies noncompliant resources but does not prevent deployment.


Question 8

A company wants to detect suspicious access patterns, malware uploaded to blobs, and unusual authentication activity.

Which service should it enable?

A. Azure Resource Locks
B. Microsoft Defender for Storage
C. Azure Private DNS
D. Azure Policy only

Correct answer: B

Explanation: Microsoft Defender for Storage provides threat-detection capabilities for storage accounts, including supported malware scanning and detection of suspicious access activity.


Question 9

A storage account uses a private endpoint, but users can still access the account through its public endpoint.

What is the most likely explanation?

A. Private endpoints do not provide encryption
B. Azure RBAC is disabled
C. Public network access was not separately disabled or restricted
D. Blob versioning is not enabled

Correct answer: C

Explanation: Creating a private endpoint does not automatically disable the public endpoint. The storage account’s public network access must be disabled or restricted separately.


Question 10

An organization wants to require secure connections and prevent clients from using outdated encryption protocols.

Which configuration should it use?

A. Enable Secure transfer required and require TLS 1.2 or later
B. Enable anonymous blob access and SAS
C. Create a CanNotDelete resource lock
D. Assign Storage Blob Data Reader to all users

Correct answer: A

Explanation: Secure transfer required rejects HTTP requests, while the minimum TLS version setting prevents clients from negotiating older TLS versions. Together, they strengthen protection for data in transit.


Final Takeaways

For the SC-500 exam, remember the following:

  • Use private endpoints and disable public network access when public connectivity is unnecessary.
  • If public access is required, use firewall rules with a default Deny action.
  • Network access does not replace authorization.
  • Prefer Microsoft Entra ID, Azure RBAC, and managed identities.
  • Use SAS only when temporary delegated access is required.
  • Keep SAS permissions and expiration periods narrow.
  • Require secure transfer and TLS 1.2 or later.
  • Disable anonymous public blob access unless explicitly required.
  • Use customer-managed keys when additional key control is necessary.
  • Use soft delete for recovery and immutable storage for retention enforcement.
  • Enable Defender for Storage and diagnostic logging.
  • Apply Azure Policy to enforce storage security baselines.
  • Use infrastructure as code to deploy consistent, reviewable configurations.
  • Monitor for unauthorized changes and configuration drift.

Go to the SC-500 Exam Prep Hub main page