AZ-204 cheat sheet
The distinctions that decide AZ-204 questions, grouped by service. For the underlying concepts, work through the official learning path listed under resources.
Caching
Shared vs Private Caching
| Aspect | Shared Cache | Private Cache |
|---|---|---|
| Location | Centralized server/cluster | Local to each app instance |
| Speed | SLOWER (network hop) | FASTER (local access) |
| Scalability | BETTER (add cluster nodes) | Worse (scale each instance) |
| Consistency | All instances see same data | Data may differ between instances |
Key Point: Shared caching is NOT faster than private caching - it provides better SCALABILITY.
Cache Eviction Policies
| Policy | What It Does | Use When |
|---|---|---|
| FIFO | Removes OLDEST items first | Oldest data = stale data |
| LRU | Removes LEAST RECENTLY USED | Recent access = likely needed |
| MRU | Removes MOST RECENTLY USED | Recently used = won't need again |
| Explicit | Triggered by DB notification | Real-time data sync needed |
Exam Tip: LRU = "Least Recently Used" - removes items that haven't been accessed recently
Azure Cache for Redis - Eviction
- Eviction policy for oldest data first → Use FIFO (First-In-First-Out)
- LRU is about access patterns, FIFO is about age
App Service web apps
Application Logging: Filesystem vs Blob Storage
| Storage Type | Duration | Region Requirement |
|---|---|---|
| Filesystem | SHORT-TERM (12 hours auto-off) | N/A |
| Blob Storage | LONG-TERM (persistent) | SAME REGION as App Service |
Exam Trap: Blob storage for logging must be in the SAME REGION as the App Service!
Diagnostics Settings
- AppServiceConsoleLogs → Logs to Log Analytics (not storage account for query analysis)
- To query logs, send to Log Analytics workspace, not storage account
TLS Mutual Authentication (Client Certificates)
- Access client cert via:
HttpRequest.ClientCertificateproperty - NOT through HTTP headers, URL query string, or client cookies
- Only supported for ASP.NET applications
Deployment Slots - Swapping Behavior
Settings that SWAP (follow the slot):
- Connection strings (unless marked sticky)
- Handler mappings, public certificates
Settings that DON'T SWAP (stay with slot):
- Publishing endpoints
- Custom domain names
- SSL certificates (private)
- Scale settings
Message-based solutions
Service Bus vs Queue Storage
| Feature | Service Bus | Queue Storage |
|---|---|---|
| Max message size | 256KB-100MB | 64KB |
| Max queue size | 1GB-80GB | 500TB |
| Protocol | HTTPS/AMQP/TCP | HTTPS only |
| Progress tracking | YES (sessions) | No |
| Point-to-point | Topics & Queues | Queues only |
Use Azure Queue Storage when: Volume > 80GB, need simple queue, HTTPS only is OK
Use Service Bus when: Need AMQP/TCP, sessions, topics, or message progress tracking
Service Bus - ServiceBusMessage
// Send message - use BinaryData, NOT string
ServiceBusMessage message = new ServiceBusMessage(BinaryData.FromString(messageBody));
await sender.SendMessageAsync(message);Exam Trap: ServiceBusMessage constructor takes BinaryData, not string directly!
Containers
ACR Push Workflow (CORRECT ORDER)
docker build- Build the imageaz acr login- Authenticate to ACR
Key Point: Tag image BEFORE pushing, login BEFORE push
Sidecar Containers
- ACI Container Groups = Multiple containers on same host (sidecar pattern)
- Kubernetes Pods = Also works, but ACI Container Groups is the Azure-native answer
App Service Container Deployment (az webapp)
# Create web app from container
az webapp create --resource-group $rg --plan $plan --name $app \
# Configure container settings
az webapp config container set --name $app --resource-group $rg \Event Grid
Enable Event Grid for Subscription
# CORRECT - Register the provider
az provider register --namespace Microsoft.EventGrid
# WRONG - These don't register Event Grid:
# az group deployment create (deploys templates, not providers)
# az group create (creates resource groups only)
# az eventgrid topic create (creates topic, doesn't register provider)API Management
Quota Exceeded = 403 Forbidden
- Set-usage-quota-by-key policy → Returns 403 when quota exceeded
- NOT 429 (that's rate limiting)
- Quota = Hard limit per time period
- Rate limit = Requests per second throttling
APIM Policies for Access Control
| Policy | Purpose | HTTP Code |
|---|---|---|
quota-by-key | Limit calls per period | 403 Forbidden |
rate-limit-by-key | Limit calls per second | 429 Too Many Requests |
validate-jwt | Validate JWT tokens | 401 Unauthorized |
restrict-caller-ips | IP allowlist/blocklist | 403 Forbidden |
Azure Monitor and Application Insights
App Insights Telemetry for User Behavior
Capture these THREE for behavior analytics:
- Events - Track user actions (clicks, features used)
- User ID - Identify individual users
- Session ID - Track user sessions
DON'T capture for behavior:
- Traces (developer debugging)
- Exceptions (error tracking, not behavior)
App Service Autoscale Rules
| Metric Source | What It Measures |
|---|---|
| Service Bus queue | Message count in queue |
| Metric name | MessageCount or ActiveMessageCount |
| Operator | GreaterThan or LessThan |
| Threshold | Number of messages |
Scale down trigger: Operator = LessThanOrEqual, compare to threshold
Security and identity
Managed Identity for VM Access
To use managed identity on a VM:
- Enable system-assigned identity on VM
- Grant Reader role at subscription scope (for resource group access)
- Use Azure CLI with
az login --identity
NOT needed: Create identity manually, retrieve access token manually
Microsoft Entra ID + MFA for External Users
Required actions:
- Upgrade to Microsoft Entra ID P1 (MFA requires P1 license)
- Create conditional access policy (enforce MFA)
NOT needed:
- Entra ID B2B (for guest users from other orgs)
- Entra ID B2C (for consumer-facing apps)
User-Assigned vs System-Assigned Managed Identity
| Scenario | Use This Identity Type |
|---|---|
| Single resource, lifecycle tied to resource | System-assigned |
| Multiple resources sharing same identity | User-assigned |
| Different permissions per deployment | User-assigned |
| Immutable infrastructure | User-assigned |
Cosmos DB and data
ASP.NET Memory Session State Provider
For session state that:
- Shares across ASP.NET apps
- Persists as snapshot
- Handles concurrent access
- Minimizes latency
Answer: ASP.NET Memory Session State Provider (NOT Cosmos DB, NOT SQL)
Quick reminders
- BinaryData - Service Bus messages use
BinaryData.FromString(), not raw strings - Same Region - Blob logging requires storage in SAME REGION as App Service
- 403 vs 429 - Quota exceeded = 403, Rate limit = 429
- FIFO vs LRU - FIFO = oldest first, LRU = least recently accessed
- Provider Register -
az provider register --namespace Microsoft.EventGrid - P1 License - MFA/Conditional Access requires Entra ID P1
- ClientCertificate - Access via
HttpRequest.ClientCertificate, not headers