1---2name: azure-ad-entra3description: Use when configuring Microsoft Entra ID (Azure AD), managing app registrations, setting up Conditional Access policies, implementing PIM for privileged access, or studying for AZ-500, SC-500, or AZ-305.4---56# Azure AD / Microsoft Entra ID78## When to Use9- Designing identity architecture for Azure solutions10- Configuring app registrations, service principals, and managed identities11- Implementing Conditional Access policies for Zero Trust12- Setting up PIM (Privileged Identity Management) for just-in-time access13- Managing Azure RBAC across subscriptions, resource groups, and resources14- Preparing for AZ-500 (Azure Security), SC-500 (Cloud Security), or AZ-305 (Architect) exam1516## Core Jobs1718### 1. Identity Types19| Identity | Description | Use Case |20|----------|-------------|---------|21| **User** | Human identity with credentials | Employee sign-in |22| **Group** | Collection of users/service principals | RBAC assignment at scale |23| **Service Principal** | App identity in a tenant; auto-created with App Registration | Application-to-Azure auth |24| **System-assigned Managed Identity** | Identity tied to Azure resource lifecycle | VM, Function App, AKS accessing other Azure services |25| **User-assigned Managed Identity** | Standalone identity; reusable across resources | Shared identity for multiple resources |26| **B2B Guest** | External user federated with their own IdP | Partner/vendor access |27| **B2C Customer** | Consumer identity (social, custom) via Entra B2C | Customer-facing apps |2829### 2. App Registrations vs Enterprise Applications30| Concept | App Registration | Enterprise Application |31|---------|-----------------|----------------------|32| Location | Tenant where app is defined | Every tenant where app is used |33| Purpose | Define app identity, permissions, redirect URIs | Consent record; user/group assignment |34| Relation | One app registration → one or more enterprise apps | Auto-created in tenant when app is used |3536- **App registration**: defines `client_id`, secret/certificate, API permissions (delegated vs application)37- **Enterprise app (Service Principal)**: where you assign users/groups for SSO; where you see sign-in logs38- **Delegated permission**: app acts on behalf of signed-in user (requires user consent or admin consent)39- **Application permission**: app acts as itself with no user context (background services; requires admin consent)4041### 3. Managed Identities42| Type | Lifecycle | Reuse | Best For |43|------|-----------|-------|---------|44| **System-assigned** | Deleted with resource | Cannot reuse | Simple single-resource scenarios |45| **User-assigned** | Independent | Reusable across resources | Shared identity, pre-authorization, AKS Workload Identity |4647- Assign RBAC role to Managed Identity on target resource (e.g., `Storage Blob Data Contributor`)48- In code: use `DefaultAzureCredential` — automatically picks up Managed Identity token in Azure49- No credentials, no rotation, no secrets to manage5051### 4. Conditional Access52- Requires: **Entra ID P1** (basic CA) or **P2** (risk-based CA with Identity Protection)53- Policy structure: **Signal** → **Decision** → **Controls**54 - Signals: user/group, application, location (IP/named location), device compliance, sign-in risk, user risk55 - Decisions: Allow, Block, Require controls56 - Controls: MFA, compliant device, hybrid Azure AD join, approved app, terms of use57- Common policies:58 - Require MFA for all users accessing Azure portal59 - Block access from non-compliant countries (named location)60 - Require compliant device for access to sensitive apps61- **Report-only mode**: evaluate policy impact without enforcing (test before apply)6263### 5. PIM (Privileged Identity Management)64- Requires: **Entra ID P2**65- **Eligible roles**: user must activate to use; defines max duration + approval workflow66- **Active roles**: always active; only for break-glass or automation scenarios67- Activation flow: user requests activation → optional MFA + justification → optional approval → role active for defined period68- **PIM for Azure resources**: Just-in-time Owner/Contributor on subscriptions/resource groups69- **Access reviews**: periodic review of role assignments; auto-remove if not confirmed70- Audit: all PIM activations logged; alertable in Sentinel7172### 6. Azure RBAC73| Scope Level | Example |74|-------------|---------|75| **Management Group** | All subscriptions in organization |76| **Subscription** | All resource groups in subscription |77| **Resource Group** | All resources in resource group |78| **Resource** | Single resource (e.g., one storage account) |7980- Built-in roles: `Owner` (full + can grant access), `Contributor` (full except access mgmt), `Reader` (read-only)81- Custom roles: define specific actions (`Microsoft.Storage/storageAccounts/read`)82- **Deny assignments**: explicit deny overrides allow; used in Azure Blueprints/Managed Applications83- Role assignment takes ~2 minutes to propagate; retries are normal during testing8485## Key Concepts86- **Managed Identity** — keyless identity for Azure resources; no credentials; RBAC-based authorization87- **Conditional Access** — policy engine: if signal matches, apply control (MFA, block, device check)88- **PIM** — just-in-time privileged access; eligible roles activated on demand with justification89- **App registration** — defines your application's identity in Entra ID; client_id, secrets, API permissions90- **B2B** — external user collaboration; federated with guest's own IdP; distinct from B2C (customers)91- **RBAC deny** — deny assignment overrides role-based allow; created by Blueprints/Managed Apps92- **DefaultAzureCredential** — Azure SDK credential chain; uses Managed Identity automatically in Azure9394## Checklist95- [ ] Managed Identity used instead of service principal with secret for Azure-to-Azure auth?96- [ ] User-assigned Managed Identity when identity needs to be reused across multiple resources?97- [ ] Conditional Access policy in report-only mode before enforcement?98- [ ] PIM configured for all privileged roles (subscription Owner, Global Admin)?99- [ ] App registration permissions set to minimum required (delegated vs application correctly chosen)?100- [ ] RBAC assigned at resource group scope (not subscription) for least-privilege?101- [ ] Access reviews scheduled for privileged role assignments?102103## Output Format104- 🔴 **Critical** — service principal with password secret used where Managed Identity is possible105- 🔴 **Critical** — application permissions granted without admin consent (will fail at runtime)106- 🟡 **Warning** — Conditional Access applied without report-only testing first (may lock out users)107- 🟡 **Warning** — Global Admin role permanently active (use PIM eligible assignment instead)108- 🟢 **Suggestion** — use user-assigned Managed Identity when multiple resources need the same Azure access109110## Exam Tips111- **Managed Identity = no credentials to manage** — system-assigned tied to resource lifecycle; user-assigned reusable across resources112- **Conditional Access = requires Entra ID P1** — MFA enforcement, compliant device requirement, named location blocking113- **PIM = requires Entra ID P2** — eligible roles activated on-demand with justification and optional approval114- **App registration = defines permissions** — delegated (on behalf of user) vs application (app as itself); application permissions require admin consent115- **B2B = external users with their own IdP** — federated; distinct from B2C (consumer identity platform for customers)116- **RBAC deny assignments = deny overrides allow** — used in Azure Blueprints and Managed Applications to lock down resources