Fun with Learning Technology
LearnCoursesQuestionsTracksToolsNewsExplorePractice
Fun with Learning Technology

A new problem, explained clearly, every day.

Subscribe
Learn
  • Lessons
  • Topics
  • News
  • Tools
  • Courses
  • Career tracks
  • Everything
Site
  • About
  • Contact
  • Support
  • Privacy
  • Terms
Get the daily one

One email per new problem. No spam.

Request a tutorial

Requests shape what gets made next.

© 2026 Fun with Learning TechnologyRSS
Home›Courses›Microsoft Azure›Azure Active Directory and IAM

Core Services

Azure Active Directory and IAM

Microsoft Entra ID, formerly known as Azure Active Directory, serves as the cloud-based identity and access management service that secures access to your applications and resources. It provides a unified platform to authenticate users and authorize their actions, which is critical for maintaining a zero-trust security posture in distributed cloud environments. You reach for these services whenever you need to manage user identities, define granular permissions, or enforce multi-factor authentication across your cloud infrastructure.

The Foundation of Identity: Tenants and Users

At the core of identity management lies the tenant, which acts as a dedicated instance of the directory service created for your organization. A tenant represents a secure boundary where all identities, service principals, and groups reside. Understanding this structure is essential because authentication requests are always validated against the specific directory where the user identity is mastered. When you create a user account, you are effectively provisioning a security principal that holds the credentials and attributes necessary for verification. The platform uses these identities to determine who is attempting to access a resource, ensuring that every request is tied to a verifiable entity. By isolating identities within a tenant, you create a controlled scope for governance and policy application. This logical separation is why organizations can manage multiple, isolated environments without cross-contamination of permissions or identity data, forming the bedrock of modern cloud security architectures.

# Using Azure CLI to verify current tenant and list basic user info
az account show --query tenantId
az ad user list --top 5 --query '[].{DisplayName:displayName, UserPrincipalName:userPrincipalName}'

Role-Based Access Control (RBAC) Mechanics

Role-Based Access Control is the mechanism that translates identity into capability within your cloud environment. Instead of managing permissions for individual users, you assign roles to users or groups, which encapsulate a collection of granular permissions. The effectiveness of RBAC relies on the principle of least privilege, which dictates that entities should only possess the minimum set of permissions required to perform their tasks. When a request is made, the authorization engine evaluates the role assignment at the management group, subscription, resource group, or resource level. This hierarchical inheritance is why you should always aim to assign permissions at the highest logical scope necessary, reducing management overhead while maintaining strict security. By abstracting permissions into roles, you decouple the identity of the user from the specific actions they are allowed to perform, making the entire permission framework resilient to personnel changes and organizational restructuring.

# Assigning the 'Reader' role to a user on a specific resource group
$scope = "/subscriptions/{subscription-id}/resourceGroups/my-resource-group"
$userEmail = "user@example.com"
az role assignment create --assignee $userEmail --role "Reader" --scope $scope

Service Principals and Automated Identities

While users represent human operators, service principals are the identities used by non-human actors, such as applications, services, or automated scripts, to interact with resources. A service principal is essentially the local instance of an application object in a specific tenant, allowing the application to authenticate and be assigned roles just like a human user. This is crucial for automation; hard-coding credentials in scripts is a significant security risk, whereas service principals allow you to use rotating secrets or managed identities. When a script runs in an automated pipeline, it authenticates as the service principal, and the authorization engine checks its assigned roles to decide what actions it can execute. Understanding service principals is vital for building robust infrastructure-as-code deployments and automated CI/CD pipelines, as it ensures that your automation workflows adhere to the same security standards as your manual administrative actions.

# Create a service principal for an application
$app = az ad app create --display-name "AutomationApp"
az ad sp create --id $app.appId

Managed Identities for Resource-to-Resource Trust

Managed Identities remove the burden of credential management by providing an identity for resources to use when connecting to other protected services. There are two types: system-assigned and user-assigned. A system-assigned identity is tied directly to the lifecycle of the Azure resource itself, meaning it is deleted automatically when the resource is removed. A user-assigned identity is created as a standalone resource and can be attached to multiple resources, offering more flexibility for complex architectures. The power of managed identities lies in the fact that the underlying credentials—such as client secrets—are fully managed and rotated by the platform, meaning you never have to store or handle them in your application code. This eliminates the risk of credential leakage and simplifies the configuration of secure communication between services, such as a virtual machine accessing a database or a function app calling an API endpoint.

# Enabling a system-assigned managed identity on a Virtual Machine
az vm identity assign --name MyVmName --resource-group MyResourceGroup

Conditional Access Policies

Conditional Access is the engine that enforces security policies based on real-time signals, moving beyond simple static passwords. It acts as an "if-then" decision engine: if a user is logging in from an unknown location, then require multi-factor authentication; or if the device is not compliant, then block the access request. These signals include user identity, network location, device health, and application sensitivity. Because you cannot predict every potential threat vector, Conditional Access provides a flexible framework that adapts to the current risk environment. It enables a proactive security posture where access decisions are re-evaluated constantly rather than just at the initial login. By implementing these policies, you ensure that even if credentials are compromised, an attacker would still face additional hurdles—such as biometric verification or network restrictions—that protect your organization's sensitive data from unauthorized exposure.

# Example logic for a conditional access policy
# Enforce MFA for all users targeting the Azure Management cloud app
az ad conditional-access policy create --name "Require-MFA-For-Admins" --all-users --include-apps "00000002-0000-0000-c000-000000000000" --mfa-enforcement

Key points

  • A tenant is the primary security boundary for your organizational identities.
  • RBAC permissions should be assigned based on the principle of least privilege.
  • Role assignments are inherited downwards through the management hierarchy.
  • Service principals enable secure, non-interactive authentication for automated applications.
  • Managed identities eliminate the need for developers to manage credentials in code.
  • Conditional Access policies allow for dynamic security decisions based on contextual signals.
  • System-assigned managed identities follow the lifecycle of their associated Azure resource.
  • Effective IAM configuration requires separating human user identities from machine identities.

Common mistakes

  • Mistake: Assigning directory-level roles (like Global Administrator) for resource management. Why it's wrong: This violates the principle of least privilege, granting excessive power over the entire tenant. Fix: Use Azure RBAC with scoped roles (e.g., Contributor) at the Resource Group or Subscription level instead.
  • Mistake: Confusing Azure AD (now Microsoft Entra ID) roles with Azure RBAC roles. Why it's wrong: They control access to different planes; Entra ID roles manage identity and tenant settings, while Azure RBAC manages resources like VMs and Databases. Fix: Use Entra ID roles for identity management and Azure RBAC for resource management.
  • Mistake: Failing to enable Multi-Factor Authentication (MFA) for administrative accounts. Why it's wrong: Passwords alone are insufficient to protect against credential stuffing and phishing attacks. Fix: Enforce Conditional Access policies requiring MFA for all high-privilege users.
  • Mistake: Over-relying on Guest User invitations without applying Conditional Access. Why it's wrong: External identities can become security risks if they have perpetual access without security constraints. Fix: Apply identity protection policies and time-bound access reviews to all external users.
  • Mistake: Creating users manually in the cloud instead of synchronizing from an on-premises directory. Why it's wrong: This leads to fragmented identity management, duplicate accounts, and inconsistent lifecycle management. Fix: Use Entra Connect to synchronize identities to maintain a single source of truth.

Interview questions

What is the fundamental purpose of Azure Active Directory, now known as Microsoft Entra ID, in an enterprise environment?

Azure Active Directory serves as Microsoft's cloud-based identity and access management service. Its primary purpose is to provide a centralized hub for managing identities, controlling access to resources, and securing applications. It enables single sign-on capabilities, which increases user productivity by allowing employees to use one set of credentials for all corporate resources. Furthermore, it enforces security policies like Conditional Access, which ensures that only authorized users, on compliant devices, can access sensitive corporate data, significantly reducing the surface area for potential security breaches across the Azure ecosystem.

Can you explain the role of Conditional Access policies in Azure and why they are critical for a Zero Trust architecture?

Conditional Access policies act as the 'if-then' decision engine within Azure. When a user attempts to access an application, the service evaluates specific signals, such as the user's identity, location, device health, and risk level. If these conditions are met, access is granted; otherwise, it is blocked or a multi-factor authentication prompt is triggered. This is critical for Zero Trust because it assumes that the network perimeter is no longer sufficient. By continuously validating these signals before every access request, Azure ensures that security is granular, adaptive, and centered on the identity of the requester rather than their network location.

Compare and contrast Azure Role-Based Access Control (RBAC) with Azure Attribute-Based Access Control (ABAC).

Azure RBAC and ABAC are both used to control access, but they operate differently. RBAC is role-centric; you assign a pre-defined role, such as Contributor or Owner, to a user or group over a scope like a resource group. This is simple but can lead to role explosion if granular requirements grow. ABAC extends RBAC by adding conditions based on attributes, such as requiring a project tag on a resource to match a user's department attribute. For example, a condition might look like: '(Resource.Tags['Project'] == User.Project)'. ABAC provides dynamic, fine-grained control, whereas RBAC is best for static, broad management assignments.

What are Managed Identities in Azure, and why should you use them instead of traditional service principals with client secrets?

Managed Identities provide an automatically managed identity in Microsoft Entra ID for Azure resources. When you use them, you eliminate the need for developers to manage credentials like client secrets or certificates inside their code. Azure handles the rotation of these secrets automatically. By using a system-assigned or user-assigned Managed Identity, your code authenticates securely to services like Azure Key Vault or Azure SQL Database without any embedded credentials. This significantly reduces the risk of credential leakage, as there are no hardcoded secrets to inadvertently expose in source control or configuration files.

How does Azure PIM (Privileged Identity Management) enhance the security posture of an Azure subscription?

Azure PIM mitigates the risks associated with excessive, unnecessary, or misused access rights by enforcing 'Just-In-Time' (JIT) access. Instead of assigning permanent administrative privileges, PIM allows administrators to be 'eligible' for a role. When they need to perform an administrative task, they activate the role for a limited time—for example, two hours—often requiring MFA or manager approval. This drastically reduces the window of opportunity for an attacker to compromise a standing administrative account. It also provides comprehensive auditing, so organizations can review exactly who had access to what and when, ensuring strict compliance with the principle of least privilege.

Explain the concept of 'External Identities' in Azure and how B2B collaboration functions within that framework.

Azure External Identities allows your organization to securely collaborate with guest users from other companies. When you invite a user via B2B collaboration, Azure does not create a new user object with a password in your tenant. Instead, the guest user authenticates using their own home identity provider, and your Azure tenant simply trusts that authentication. To manage this securely, you apply Conditional Access policies to these external users, ensuring they meet your organization's security standards despite being external. This framework is essential for modern business, as it enables seamless inter-company workflows while maintaining the strict identity perimeter of your own Azure environment without forcing guest users to manage a separate set of credentials.

All Microsoft Azure interview questions →

Check yourself

1. A developer needs permissions to modify VMs within a specific Resource Group but should not be able to manage users. Which approach should you take?

  • A.Assign the User Administrator role at the Subscription level.
  • B.Assign the Virtual Machine Contributor role at the Resource Group level.
  • C.Add the user to the Global Administrator role.
  • D.Assign the Owner role at the Management Group level.
Show answer

B. Assign the Virtual Machine Contributor role at the Resource Group level.
The Virtual Machine Contributor role at the Resource Group level follows the principle of least privilege. The User Administrator role is for identity management, not resource management. Global Administrator is overly broad, and Owner at the Management Group level provides excessive permissions across all subscriptions.

2. Why is it recommended to use Conditional Access policies rather than standard per-user MFA settings?

  • A.Conditional Access policies are free, whereas per-user MFA requires a premium license.
  • B.Conditional Access allows for context-based decisions, such as device state and sign-in risk.
  • C.Per-user MFA settings have been deprecated by Microsoft entirely.
  • D.Conditional Access policies apply only to local Azure AD accounts, not synchronized ones.
Show answer

B. Conditional Access allows for context-based decisions, such as device state and sign-in risk.
Conditional Access provides granular control based on signals like IP address, location, device compliance, and risk levels. Per-user MFA is a legacy method that lacks this context. Conditional Access is not free (it requires P1/P2 licenses), and it applies to both local and synchronized identities.

3. A company wants to allow external contractors to access specific Azure blobs without creating them as full user objects in the directory. What should be used?

  • A.Azure AD B2B collaboration.
  • B.Shared Access Signatures (SAS).
  • C.Role-Based Access Control (RBAC) at the management group level.
  • D.Azure AD Privileged Identity Management (PIM).
Show answer

B. Shared Access Signatures (SAS).
Shared Access Signatures provide time-bound, granular access to storage resources without requiring an identity in the directory. B2B collaboration creates guest identities, which is more complex than needed. RBAC is for identity-based access, and PIM is for just-in-time elevation, not external access.

4. When configuring a service principal for an application to access Azure resources, what is the best practice for authentication?

  • A.Use a hardcoded password in the application code.
  • B.Use a client secret with an infinite expiration date.
  • C.Use a certificate-based credential or managed identity.
  • D.Assign the Global Administrator role to the service principal.
Show answer

C. Use a certificate-based credential or managed identity.
Managed identities or certificates are significantly more secure than secrets because they eliminate the need to handle sensitive credentials in code. Hardcoding secrets or using infinite secrets increases risk. Assigning Global Administrator to a service principal is a major security vulnerability.

5. What is the primary function of Privileged Identity Management (PIM) in an Azure environment?

  • A.To synchronize on-premises identities with the cloud.
  • B.To provide just-in-time, time-bound access to privileged roles.
  • C.To enforce password complexity requirements for all users.
  • D.To automate the creation of virtual machines based on tags.
Show answer

B. To provide just-in-time, time-bound access to privileged roles.
PIM is designed to manage elevated access by requiring users to activate roles only when needed, reducing the window of opportunity for attackers. Synchronization is handled by Entra Connect, password policies are set in the identity protection or authentication settings, and tag-based automation is part of Azure Policy.

Take the full Microsoft Azure quiz →

← PreviousAzure Overview and Resource GroupsNext →Azure Blob Storage and Data Lake Gen2

Microsoft Azure

19 lessons, free to read.

All lessons →

Track your progress

Sign in to mark lessons done, score quizzes and keep notes.

Open in the app