0Pricing
Cloud & IT Cert Prep · Lesson

Users, Groups, and Role Assignments

Create users and groups in Entra ID, assign built-in RBAC roles to control access to Azure resources, and apply the principle of least privilege.

Users, Groups, and Role Assignments is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Azure RBAC: Role-Based Access Control

Azure Role-Based Access Control (RBAC) is the authorisation system that controls who can do what on Azure resources. Instead of assigning permissions directly to individuals, you assign roles to security principals (users, groups, service principals, or managed identities) at a specific scope. This separation keeps permissions manageable as your organisation grows.

The Three RBAC Concepts

Every RBAC assignment involves three components. A security principal is who gets access (user, group, or managed identity). A role definition is what actions are allowed (e.g., read VMs, write to storage). A scope is where access applies — from broadest to narrowest: management group, subscription, resource group, or individual resource. Access is inherited downward through the scope hierarchy.

# View all role assignments in a subscription
az role assignment list \
  --output table

# Check your own permissions on a resource
az role assignment list \
  --assignee <your-user-principal-name> \
  --output table

Built-In Roles Overview

Azure provides hundreds of built-in roles. The four most commonly used across all resource types are: Owner — full access including the ability to assign roles to others; Contributor — full access to create and manage resources but cannot grant access to others; Reader — view-only access; and User Access Administrator — can manage role assignments without contributing to resources themselves.

# List all built-in roles
az role definition list \
  --custom-role-only false \
  --query '[].{Name:roleName, Id:name}' \
  --output table | head -20

Assigning a Role

A role assignment grants the specified security principal the permissions defined in the role definition at the specified scope. Role assignments propagate to all child scopes — assigning Contributor at the resource group level gives Contributor access to every resource within that group. Assigning at subscription level gives Contributor across all resource groups in that subscription.

# Assign Contributor role to a user at resource group scope
az role assignment create \
  --assignee alice@yourcompany.com \
  --role Contributor \
  --resource-group myRG

# Assign Reader role to a group at subscription scope
az role assignment create \
  --assignee-object-id <group-object-id> \
  --role Reader \
  --scope /subscriptions/<subscription-id>

Principle of Least Privilege

The principle of least privilege states that every identity should have only the minimum permissions necessary to perform its job. In Azure RBAC this means: prefer Reader over Contributor where write is not needed, prefer resource-group scope over subscription scope, and use specific resource-level roles (e.g., Storage Blob Data Contributor) instead of the broad Contributor role where possible.

Custom Role Definitions

When no built-in role matches your requirements exactly, you can create a custom role. A custom role definition specifies a set of Actions (control-plane operations permitted), NotActions (excluded from the permitted set), DataActions (data-plane operations on resources like reading blob content), and AssignableScopes (subscriptions or management groups where the role can be assigned).

{
  'Name': 'VM Operator',
  'Description': 'Can start, stop, and restart VMs but not delete or reconfigure them',
  'Actions': [
    'Microsoft.Compute/virtualMachines/start/action',
    'Microsoft.Compute/virtualMachines/restart/action',
    'Microsoft.Compute/virtualMachines/deallocate/action',
    'Microsoft.Compute/virtualMachines/read'
  ],
  'NotActions': [],
  'AssignableScopes': ['/subscriptions/<subscription-id>']
}

Groups for Role Assignment Scale

Assigning roles to groups rather than individual users is a best practice. When a new developer joins the DevTeam, you add them to the DevTeam security group in Entra ID — they automatically inherit all role assignments the group holds, without any Azure RBAC changes. This single management point prevents scattered individual assignments that become difficult to audit or revoke at offboarding.

# Create a group and assign a role to it
az ad group create \
  --display-name 'DevTeam' \
  --mail-nickname DevTeam

# Assign role to the group
az role assignment create \
  --assignee-object-id <group-object-id> \
  --role Contributor \
  --resource-group dev-rg

Service Principals for Automation

A service principal is an identity used by applications, scripts, and automation tools to authenticate to Azure and access resources. Unlike a user identity, service principals have no interactive sign-in capability. You create them from App Registrations in Entra ID, then assign RBAC roles at the appropriate scope — for example, giving a CI/CD pipeline Contributor access to a single resource group to deploy infrastructure.

# Create a service principal and assign Contributor to a resource group
az ad sp create-for-rbac \
  --name myCICDprincipal \
  --role Contributor \
  --scopes /subscriptions/<sub-id>/resourceGroups/myRG

Deny Assignments

Deny assignments block specific actions for security principals even if a role assignment would otherwise permit them. Unlike role assignments, deny assignments cannot be created directly by administrators — they are attached by Azure Blueprints or managed applications to prevent users from modifying protected resources. A deny assignment takes precedence over any matching role assignment.

# List deny assignments in a resource group
az role assignment list \
  --include-deny-assignments \
  --resource-group myRG \
  --query '[?type==`Microsoft.Authorization/denyAssignments`]'

Privileged Identity Management (PIM)

Privileged Identity Management (PIM) is an Entra ID P2 feature that provides just-in-time privileged access. Instead of permanently assigning an Owner or Global Administrator role, you make users eligible for that role. When they need it, they activate the assignment for a time-limited window (e.g., 1-8 hours), optionally requiring an approval workflow and justification. This dramatically reduces the standing attack surface from over-privileged accounts.

Access Reviews for Ongoing Governance

Access Reviews (Entra ID P2) are periodic automated reviews that ask resource owners or managers to confirm whether their team members still need their current role assignments. Reviewers approve or deny continued access directly from the review interface. This catches stale permissions left over from role changes, project completions, or employee departures — a key requirement for regulatory compliance programmes.

Quick Check

Test your understanding of Microsoft Azure Fundamentals (AZ-900) concepts from this lesson.

Lesson Recap

In this lesson you learned: Azure RBAC assigns roles to security principals at a specific scope, the principle of least privilege means granting only the minimum permissions required, and PIM provides just-in-time activation for high-privilege roles instead of permanent assignment. Next up we cover Multi-Factor Authentication and Conditional Access in Entra ID.

Frequently asked questions

Is the “Users, Groups, and Role Assignments” lesson free?

Yes — the full text of “Users, Groups, and Role Assignments” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.

What will I learn in “Users, Groups, and Role Assignments”?

Create users and groups in Entra ID, assign built-in RBAC roles to control access to Azure resources, and apply the principle of least privilege. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cloud & IT Cert Prep?

No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Users, Groups, and Role Assignments” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cloud & IT Cert Prep lesson?

Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What Is Microsoft Entra ID?
  2. Users, Groups, and Role Assignments
  3. Multi-Factor Authentication and Conditional Access
  4. Single Sign-On and External Identities
← Back to Cloud & IT Cert Prep