Microsoft Azure Services and Architecture Questions
Microsoft Azure's core service catalog and architectural patterns: Virtual Machines, App Service, Azure Functions, VNets, Azure AD/Entra, and managed data services. Covers Azure service selection, the Azure Well-Architected design principles, integration with the broader Microsoft ecosystem, and hybrid patterns common in enterprise Azure estates. For provider-agnostic trade-offs, see the cross-cloud entries.
Explain Azure Virtual Network (VNet) peering, site-to-site VPN Gateway, and ExpressRoute. For a hybrid architecture where an on-prem datacenter requires low-latency, high-throughput access to Azure resources, which connectivity option would you choose and why? Discuss failover patterns and security implications.
Sample Answer
VNet peering, Site-to-Site (S2S) VPN Gateway, and ExpressRoute are three Azure network connectivity models with different performance, management and security trade-offs.
-
VNet peering: Connects two VNets (within or across regions) over Microsoft’s backbone network with low latency and high throughput. Peering is layer‑3 routing between VNets; it’s intra‑Azure only and does not extend to on‑premises automatically.
-
Site-to-Site VPN Gateway: IPsec/IKE tunnels over the public Internet between an on‑prem VPN device and an Azure VPN Gateway. Relatively quick to deploy, supports BGP for dynamic routing, but latency and throughput depend on Internet links and encryption overhead. Good for backup or low‑cost connectivity.
-
ExpressRoute: A private, dedicated circuit between your on‑prem provider and Microsoft edge (via an ExpressRoute provider or direct cross‑connect). Offers predictable low latency, high bandwidth (up to multiple Gbps), and optional private peering to VNets. Does not traverse the public Internet.
For a hybrid architecture requiring low latency and high throughput, I would choose ExpressRoute with private peering as the primary connectivity. Reasons:
- Dedicated path and SLA for consistent latency and throughput (important for SLOs).
- Scales to multiple Gbps, supports BGP for route control and integration with on‑prem routing.
- Can be combined with VNet peering to distribute traffic across hub-and-spoke VNets.
Failover patterns and resiliency:
- Dual ExpressRoute circuits from different providers or diverse physical paths for circuit-level redundancy.
- Active/active BGP across circuits; use route metrics and BGP path-preference to control failover.
- Configure Site-to-Site VPN as a backup: maintain IPsec tunnels to Azure Gateway and enable BGP so routes fail over automatically if ExpressRoute is lost.
- For intra‑Azure redundancy, use multiple VNets, zonal services, and global peering as needed.
Security implications and SRE considerations:
- ExpressRoute traffic is private (not Internet), reducing exposure; but you still must enforce segmentation via NSGs, Azure Firewall, or virtual appliances.
- Ensure route filters and prefix limits to prevent route leakage; use BGP MD5 where supported.
- VPN offers built‑in encryption; ExpressRoute by default is not encrypted over the provider network—if encryption is required end-to-end, use MACsec at provider layer or run IPsec over ExpressRoute, or use application-layer TLS.
- Monitoring: instrument circuit health, BGP sessions, latency, jitter, throughput, and path MTU. Automate alerts and runbooks for failover scenarios.
- Capacity planning: size circuits to meet peak throughput, consider egress costs and throttling patterns.
- Compliance: document data residency and provider controls; apply least-privilege IAM for network resources.
In summary: choose ExpressRoute private peering for primary low‑latency, high‑throughput connectivity, use S2S VPN as an automated failover, add VNet peering inside Azure for local connectivity, and implement BGP-based routing, monitoring, and security controls to meet SRE reliability and security requirements.
Your service's error budget was exhausted this quarter after a major outage. As the SRE lead, outline immediate remediation steps, how you'd re-prioritize the engineering backlog between reliability and feature work, how you'd communicate status and next steps to product and executive stakeholders, and the medium-term changes you'd institute to prevent recurrence.
Sample Answer
Situation: Our service exhausted its error budget this quarter after a major outage that impacted customers for X hours and violated the SLO.
Immediate remediation (first 24–72 hours):
- Incident containment: Ensure system is stable — roll back faulty deploys, disable problematic features or traffic paths, and apply hotfixes with canary validation.
- Restore customer experience: Prioritize degraded-but-safe modes (read-only, degraded QoS) to reduce customer impact.
- Evidence capture: Preserve logs, traces, and metrics; take read-only snapshots of configs and state for postmortem.
- Short blameless postmortem kickoff: Triage root-cause hypotheses, assign owners for RCA, and define immediate action items with owners and deadlines.
- Error-budget pause: Freeze non-essential changes that could affect reliability until defined mitigations are in place.
Re-prioritizing backlog:
- Immediately shift runway: Move the top reliability engineering (RE) tasks — rollback hardening, critical monitoring/alert fixes, runbook gaps, capacity fixes — to the top of the backlog. Apply a RICE-like scoring where risk to SLO and customer impact weigh heavily.
- Create a guarded feature pipeline: Allow low-risk, well-tested changes (dark launches, behind flags) but block high-risk features until stability milestones are hit.
- Timebox feature work: Allocate a small, controlled percentage (e.g., 10–20%) of sprint capacity for low-risk feature polish to maintain velocity while focusing on reliability.
Communication to product & execs:
- Immediate brief (within 2 hours): Concise status — impact, mitigation in progress, estimated time to restore, and next report cadence.
- Daily stakeholder updates: Share RCA progress, owner-assigned action items, and measurable recovery milestones (e.g., SLO back to X%).
- Executive summary (48–72 hours): High-level cause, customer impact, committed remediation plan with timelines, and requested trade-offs (e.g., pause major launches).
- Transparency and commitments: Publish a public-facing incident note for customers with apology, scope, and expected follow-ups.
Medium-term changes to prevent recurrence (weeks–quarters):
- SLO recalibration & policies: Reassess SLOs if needed, enforce error-budget governance — automatic gating for releases when budget is low.
- Reliability engineering program: Invest in capacity planning, chaos testing, and canary/blue-green pipelines; require rollout policies and kill-switches.
- Observability & alerting: Improve coverage of SLI instrumentation, reduce alert noise with actionable alerts, add SLO-based dashboards for execs and teams.
- Postmortem discipline: Ship detailed RCA with corrective and preventive actions, track action completion in triage meetings.
- Automation & runbooks: Automate repetitive recovery steps and maintain runnable runbooks tied into incident tooling and runbook tests.
- Team changes: Embed SRE in product teams for critical services, allocate recurring “reliability sprints,” and hire/rotate expertise where gaps exist.
Result/Measurement:
- Define clear milestones: restored SLO to target, closed critical RCA actions, reduced incident MTTR by X%, and regained a safe error budget within Y weeks. Regularly report these metrics to stakeholders to rebuild trust.
This approach balances urgent containment and customer recovery, shifts engineering focus to high-impact reliability work, keeps stakeholders informed, and builds systemic defenses to prevent recurrence.
Explain how to secure Terraform state stored in Azure Storage: discuss encryption at rest, access control via RBAC vs SAS tokens, enabling blob soft-delete and versioning, and state locking using Azure blob leases. Also propose strategies to remove secrets from state files and migrate sensitive values into Azure Key Vault.
Sample Answer
High-level approach: treat the Terraform backend like a critical secret — protect encryption, control who can read/write, enable recoverability, prevent concurrent corruption, and remove secrets from state entirely by moving them to Key Vault.
Encryption at rest
- Use Azure Storage encryption: Microsoft-managed keys are on by default. For stronger control use customer-managed keys (CMK) backed by an Azure Key Vault key (subscription-level key rotation, HSM-backed if needed). This gives you auditable key usage and rotation.
Access control — RBAC vs SAS
- Prefer Azure AD RBAC + Managed Identity for Terraform CI agents and operators. Assign least-privilege roles (e.g., Storage Blob Data Contributor on the container or a custom role limited to the backend container). Benefits: centralized identity, revocation, conditional access, and audit logs.
- SAS tokens: only for short-lived delegated access. Avoid long-lived account keys or SAS in code. If SAS is needed, mint very short TTL SAS from a service with managed identity and keep issuance audited.
Durability & recovery
- Enable blob soft-delete and blob versioning on the storage account so you can recover accidental deletes/corruption of the state file. Also enable immutability policies if you need WORM for compliance. Configure lifecycle rules for retention and archival.
State locking (prevent concurrent writes)
- The azurerm backend uses Azure blob leases to implement state locking automatically. Ensure the backend is configured to use the storage account/container used for locking, and that the service principal or managed identity has lease permissions (covered by Storage Blob Data Contributor). Monitor lock failures and configure retry backoffs in CI pipelines.
Removing secrets from state & migrating to Key Vault
- Stop writing secrets into state:
- Mark variables as sensitive in Terraform (variable "x" { sensitive = true }) to avoid showing in CLI, but sensitive values still end up in state.
- Best: never provide raw secrets to resources; instead store secrets in Azure Key Vault and reference them.
- Migration steps:
- Identify secrets in state: terraform state list + terraform state show; search for attributes like password, secret, client_secret.
- Extract and remove secrets from state: use terraform state pull to get JSON, redact or move values, then terraform state push OR use terraform state rm to remove sensitive resource instances and recreate them pointing to Key Vault.
- Create azurerm_key_vault and azurerm_key_vault_secret resources (or manage secrets out-of-band) and have resources reference secrets via data.azurerm_key_vault_secret or use managed identity + Key Vault references.
- Re-run apply so secrets are read at runtime from Key Vault instead of stored in state. For resources that must receive secrets at create-time, use provider-auth with managed identity to fetch them, or use data sources to inject secret values without writing them back to state (validate each resource; some providers will still record values).
- For already leaked secrets: rotate them immediately and audit access.
Operational best practices
- Use CI with short-lived managed identity credentials or OIDC-based Azure login rather than embedding credentials.
- Enable Storage and Key Vault logging (Azure Monitor), send logs to a central workspace, and alert on unauthorized access or deletion.
- Version Terraform and providers, run tfsec/tflint pre-commit, and restrict who can push state changes.
- Periodically run terraform state scan tools to flag secrets, and have an automated workflow to remediate and rotate any secret found.
This combination — CMK for encryption, RBAC + managed identities for access, soft-delete/versioning for recovery, blob-lease locking, and migrating secrets to Key Vault with state sanitization and rotation — gives a defense-in-depth posture for Terraform state in Azure.
An Application Gateway in front of AKS is returning intermittent 502 errors to users while pods and services appear healthy. Provide a step-by-step troubleshooting plan covering Application Gateway access logs, Backend Health, probe configuration, AKS ingress controller logs, pod logs, and potential kube-proxy or network policy issues that could cause these 502s.
Sample Answer
- Clarify scope & reproduce
- Confirm error rate, timing, affected paths, client IPs, and whether 502s are intermittent or correlated with deployments/scale events.
- Attempt to reproduce from multiple zones (curl with -v and trace).
- Application Gateway: access logs & Backend Health
- Check Access Logs for 502 timestamps, client IP, backendPool, requestUri, and subStatus. Correlate times with backendHealth probes.
- Run Backend Health API/portal to see per-backendStatus (Healthy/Unhealthy/Unknown) and any backend reasoning. Note which backend IP (pod node IPs or pod IPs depending on config) returned failures.
- Probe configuration
- Validate probe path, expected status code(s), interval, timeout, and match rules. Ensure probe path returns 200 quickly and doesn’t rely on auth/cookies.
- Compare probe source IPs to AKS network rules; ensure probes reach target (nslookup / tcpdump on node).
- AKS Ingress controller & pod logs
- Inspect ingress controller logs (nginx/traefik/AGIC) around 502 times for upstream errors, timeouts, 502 messages, or connection resets.
- Check pod logs for application exceptions, slow requests, thread pool exhaustion, or OOMs. Look for patterns (e.g., spike in latency before 502s).
- Node / kube-proxy / networking checks
- Verify kube-proxy mode (iptables/ipvs) and resource health; restart kube-proxy if inconsistent routes seen.
- On nodes that backend health points to, run curl from node to pod IP/Service ClusterIP to confirm connectivity and response times.
- Check conntrack table, ephemeral port exhaustion, or SYN/RESET patterns (ss, netstat, conntrack -L).
- If using Network Policies, ensure Application Gateway probe/source IP ranges and node-to-pod traffic are allowed. Confirm no intermittent policy enforcement or CNI issues.
- Metrics & telemetry correlation
- Correlate Application Gateway metrics (FailedRequests, UnhealthyHostCount), ingress controller metrics, pod CPU/memory, and node network metrics at error times.
- Check scaling events (HPA), pod restarts, or rolling updates coincident with 502s.
- Mitigation & fixes
- If probe misconfigured: correct path/timeout and force re-evaluation.
- If app slow: increase timeouts, add retries, or improve app performance and resource limits.
- If kube-proxy/CNI issues: rotate nodes, upgrade kube-proxy/CNI, or enable ipvs for stability.
- If network policy blocks probes intermittently: update policies to allow probe and node traffic.
- Post-incident
- Implement synthetic probes, alerting on Application Gateway 502 rate, and dashboards correlating backend health and ingress errors; document root cause and steps taken.
You observe a steady rise in inter-region egress charges between two VNets. Outline how you'd investigate the root cause using Azure Cost Management, Network Watcher, and flow logs, and propose optimizations: re-architecting services, using peering or ExpressRoute, caching/CDN usage, or changing replication strategies. Describe how you'd measure the savings after changes.
Sample Answer
Investigation plan (what I’d do and why)
- Azure Cost Management: Break down costs by resource and tag. Use Cost Analysis to filter by “Network” and group by “Resource/Resource Group/Source/Destination region” to confirm inter-region egress between the two VNets is the dominant driver and its trend (daily/weekly).
- Network Watcher + NSG flow logs + Traffic Analytics: Enable flow logs for the subnets/NSGs involved, push to Log Analytics or Storage. Use Traffic Analytics to surface top talkers (VMs, subnets, ports, protocols) and patterns (scheduled bulk transfers vs. steady chatty traffic).
- Packet-level verification: Use Network Watcher connection troubleshoot / IP flow verify and packet capture for suspicious VMs to validate application-level causes (replication, backups, large API payloads).
- Application/Storage diagnostics: Check DB/Storage replication settings, app logs, and blob transfer patterns; correlate timestamps with cost spikes.
Optimization proposals (trade-offs & actions)
- VNet peering or Global VNet peering: If cross-region calls are frequent and latency-sensitive, peer VNets (review billing — peering still charges egress but usually cheaper and lower latency) or use Azure Virtual WAN.
- ExpressRoute / Azure Virtual WAN + ExpressRoute Direct: For predictable high-volume cross-region traffic, consider ExpressRoute with Microsoft peering or an MPLS overlay — higher fixed cost but lower per-GB and SLA benefits.
- Re-architect: Move chatty microservices together (same region), use read replicas local to region, or restructure to async patterns (queueing) to reduce sync traffic.
- Caching / CDN: Introduce regional caching (Azure Cache for Redis in each region) and Azure CDN for static assets to eliminate repeated cross-region fetches.
- Change replication strategy: Switch from synchronous cross-region replication to async or change replication frequency (nearline for backups) to reduce data egress.
- Compression, batching, deduplication: Implement gzip, delta-sync, or bundle transfers into scheduled windows.
Measuring savings
- Baseline: Capture a 4-week baseline of daily egress GB, cost per day, and top talkers (from Cost Management + flow logs).
- Post-change monitoring: Continue flow logs and Cost Management; compare same metrics after changes (30/60/90 days). Track:
- % reduction in inter-region egress GB
- $ savings per month and ROI vs migration/ExpressRoute costs
- Application performance/latency and error rates (ensure SLOs met)
- Automation: Create dashboard and alerts (Azure Monitor/Workbooks) showing egress cost and volume and flag regressions.
Example outcome metrics to report
- Egress reduced from 10 TB→2 TB/month (80% reduction)
- Monthly cost savings $X vs one-time re-architecture cost $Y; payback N months
- No regression in p99 latency or achieved improved SLOs after caching
This approach blends cost telemetry, packet-level evidence, and application changes to target high-impact fixes while measuring ROI and operational impact.
Unlock Full Question Bank
Get access to all 42 Microsoft Azure Services and Architecture interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.