Azure Security & Identity
Security is a core component of the AZ-204 exam. Focus on authentication patterns, managed identities, Key Vault, and RBAC.Authentication Patterns
Microsoft Identity Platform
The Microsoft Identity Platform (Azure AD v2.0) is the unified authentication service for work/school accounts, personal Microsoft accounts, and Azure AD B2C. Key Concepts:- v2.0 endpoint -
login.microsoftonline.com/{tenant}/v2.0 - Supports OAuth 2.0, OpenID Connect, and SAML
- MSAL (Microsoft Authentication Library) - Recommended SDK
- Scopes - Delegated (user context) vs Application (app context)
OAuth 2.0 Grant Types
OAuth 2.0 defines several flows for obtaining access tokens.- Client Credentials
- On-Behalf-Of (OBO)
- Device Code
OpenID Connect
OpenID Connect (OIDC) is an authentication layer on top of OAuth 2.0. Key Features:- ID token - JWT with user identity claims (sub, email, name)
- UserInfo endpoint - Returns additional claims
- Discovery -
/.well-known/openid-configuration - Scopes -
openid(required),profile,email
App Registration
App registration creates an application identity in Azure AD. Key Components:- Application (client) ID - Unique identity
- Service principal - Per-tenant instantiation
- Redirect URIs - Where tokens are sent
- API permissions - Graph, custom APIs
- Expose an API - Define scopes your API offers
- Certificates vs Secrets - Certificates preferred
Azure Key Vault
Key Vault stores secrets, keys, and certificates with HSM backing, RBAC, and audit logging.Key Vault Management
Storage Types:- Secrets - Passwords, connection strings, API keys
- Keys - RSA/EC keys for encryption/signing (HSM-backed)
- Certificates - X.509 certificates with auto-renewal
Use
DefaultAzureCredential which chains through managed identity, environment, Visual Studio, and CLI credentials - same code works locally and in Azure.Access Control Models
Key Vault supports two authorization models.- Azure RBAC (Recommended)
- Access Policies (Legacy)
Modern, standard Azure role assignments
- Built-in roles: Key Vault Secrets User, Key Vault Secrets Officer, Key Vault Administrator
- Scope to vault or individual secret/key
- Integrates with Azure Policy and PIM
- Supports deny assignments
Secret Rotation
Automate credential rotation to reduce exposure windows. Rotation Pattern:- Key Vault secrets have version history and expiry dates
- Near-expiry notification via Event Grid
- Azure Function rotates secret (updates database password)
- Function updates Key Vault with new value
- App Service reference auto-reloads new version
Managed Identities
Managed identities provide Azure services with an automatically managed Azure AD identity.Identity Types
System-Assigned
- Lifecycle: Tied to resource, deleted with resource
- Scope: One-to-one with resource
- Use: Single-service scenarios
- Enable via portal, CLI, or ARM
User-Assigned
- Lifecycle: Independent resource
- Scope: Shared across multiple resources
- Use: Multi-service scenarios
- Pre-authorized before deployment
Token Management
Understanding token lifecycle and validation is critical.Token Lifecycle
Token Types:- Access token - Short-lived JWT (~1 hour)
- Refresh token - Long-lived, gets new access tokens
- ID token - User identity claims (OIDC)
- In-memory by default
- Serializable for web app sessions
- Handles silent token refresh automatically
Azure RBAC
Role-Based Access Control uses role assignments to grant permissions.Role Assignments
Components:- Security principal - User, group, service principal, managed identity
- Role definition - Collection of permissions (Owner, Contributor, Reader, custom)
- Scope - Management group, subscription, resource group, resource
- Owner - Full control including managing access
- Contributor - Create/manage resources, no access management
- Reader - View only, no changes
- Service-specific roles (Storage Blob Data Contributor, etc.)
Assign roles at the narrowest scope needed - a storage blob contributor shouldn’t have that role across all storage accounts in the subscription.
Consent Framework
The consent framework prompts users or admins to authorize app access to protected resources. Consent Types:- User consent - Grants delegated permission for own data
- Admin consent - Grants permissions tenant-wide
- Admin consent required - Application permissions, sensitive scopes
- Incremental consent - Request scopes when needed
Exam Checklist
- Understand OAuth 2.0 grant types and when to use each
- Know OpenID Connect flow and ID token claims
- Understand app registration components
- Know Key Vault secret, key, and certificate storage
- Understand managed identity types and lifecycle
- Know DefaultAzureCredential and credential chain
- Understand RBAC role assignments and scopes
- Know token lifecycle and MSAL patterns
- Understand consent framework (user vs admin)
- Know secret rotation patterns with Event Grid