Microsoft Azure Services and Architecture Questions
Microsoft Azure's core service catalog and architectural patterns: Virtual Machines, managed Kubernetes (AKS), App Service and Azure Functions, Storage accounts and managed disks, Azure SQL and Cosmos DB, VNets with hybrid connectivity and global load balancing, Microsoft Entra ID and RBAC, and Key Vault secrets and encryption. Covers Azure service selection, infrastructure as code (ARM, Bicep, Terraform), observability with Azure Monitor and Kusto queries, cost governance and Azure Policy, the Azure Well-Architected design principles, and hybrid management via Azure Arc, common in enterprise Azure estates. For provider-agnostic trade-offs, see the cross-cloud entries.
Write a Bicep template snippet that defines an AKS cluster with two node pools: a default (general) pool and a spot-preemptible node pool for noncritical batch jobs. Include parameters for node sizes and counts, enable managed identity, and set the spot node pool to use spot instances. Provide only the resource declarations necessary to create the managed cluster and the two agent pools (no pipeline code).
Sample Answer
Approach
Two agent pools, two different jobs, inside one AKS cluster (AKS: Azure Kubernetes Service, Azure's managed Kubernetes offering, where Azure runs and patches the control plane and you manage the worker node pools underneath it): the default pool is a System-mode pool that always runs on-demand (regular) VMs, since it has to host the cluster's own critical add-ons and can't be evicted mid-workload; the second pool is a User-mode pool with scaleSetPriority: 'Spot', which only makes sense for workloads that tolerate eviction (batch jobs), since Azure can reclaim spot capacity with a short notice period whenever it needs the capacity back at on-demand price. The template below was compiled with the Bicep CLI (bicep build) against its bundled Azure resource type definitions, which is the strongest available check of resource type/property correctness without live Azure credentials: it validates the exact property names and structure against Bicep's own schema for Microsoft.ContainerService/managedClusters@2024-05-01, not just that the file parses as valid Bicep syntax.
@description('Azure region for all resources')
param location string = resourceGroup().location
@description('Name of the AKS cluster')
param clusterName string = 'aks-prod-cluster'
@description('Kubernetes version')
param kubernetesVersion string = '1.30.3'
@description('VM size for the default system node pool')
param systemNodeVmSize string = 'Standard_D4s_v5'
@description('Node count for the default system node pool')
param systemNodeCount int = 3
@description('VM size for the spot node pool')
param spotNodeVmSize string = 'Standard_D4s_v5'
@description('Node count for the spot node pool')
param spotNodeCount int = 2
resource aks 'Microsoft.ContainerService/managedClusters@2024-05-01' = {
name: clusterName
location: location
identity: {
type: 'SystemAssigned'
}
properties: {
kubernetesVersion: kubernetesVersion
dnsPrefix: '${clusterName}-dns'
agentPoolProfiles: [
{
name: 'system'
mode: 'System'
vmSize: systemNodeVmSize
count: systemNodeCount
osType: 'Linux'
type: 'VirtualMachineScaleSets'
}
]
}
}
resource spotPool 'Microsoft.ContainerService/managedClusters/agentPools@2024-05-01' = {
parent: aks
name: 'spotpool'
properties: {
mode: 'User'
vmSize: spotNodeVmSize
count: spotNodeCount
osType: 'Linux'
type: 'VirtualMachineScaleSets'
scaleSetPriority: 'Spot'
scaleSetEvictionPolicy: 'Delete'
spotMaxPrice: -1
nodeTaints: [
'kubernetes.azure.com/scalesetpriority=spot:NoSchedule'
]
}
}
output aksName string = aks.name
output spotPoolName string = spotPool.name
Actual verification performed: bicep build microsoft-azure-services-and-architecture-b5-aks.bicep --outfile microsoft-azure-services-and-architecture-b5-aks.json completed with zero errors and zero warnings using Bicep CLI 0.47.16, confirming every property name and value type above (scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, mode, nodeTaints) matches the actual Microsoft.ContainerService/managedClusters and .../agentPools resource schema for the 2024-05-01 API version, not just that the Bicep syntax itself is well-formed. This environment has no Azure credentials, so bicep deploy/an actual az deployment was not run; the compile-and-type-check step above is the strongest verification available without live Azure access, and is a materially stronger check than "it looks right," since Bicep's compiler rejects unknown or mistyped resource properties.
Key points
spotMaxPrice: -1means "pay up to the current on-demand price," the standard safe default; a positive value caps the price you'll pay and the node pool stops accepting new spot capacity above that cap, which trades cost predictability for a higher eviction/unavailability rate.scaleSetEvictionPolicy: 'Delete'removes the underlying VM entirely on eviction (versus'Deallocate', which stops but keeps the VM allocated, billing for disk but not compute);Deleteis the right choice for a stateless batch node pool that autoscales, since there's no reason to keep a deallocated node around.- The
nodeTaintsentry here is actually redundant, not a required step: AKS automatically applies thekubernetes.azure.com/scalesetpriority=spot:NoScheduletaint (and the matchingkubernetes.azure.com/scalesetpriority: spotlabel) to any node pool created withscaleSetPriority: 'Spot', whether or not the template lists it, exactly as Microsoft's own Spot node pool documentation states ("A Spot node pool has the ... taint"). Declaring it explicitly does no harm since it matches what AKS enforces anyway, but the real thing to get right is on the consumer side: any pod meant to run on the spot pool needs a matchingtoleration(and normally a node affinity for thekubernetes.azure.com/scalesetpriority: spotlabel) in its pod spec, since the taint exists regardless of what this Bicep file says. - A
System-mode pool cannot itself be spot-priority; onlyUser-mode pools supportscaleSetPriority: 'Spot', which is exactly why the cluster needs at least the one non-spot system pool this template always creates.
Complexity and edge cases
There's no algorithmic complexity here since this is declarative infrastructure, not a runtime algorithm; the relevant "complexity" is the resource dependency graph, which is deliberately small and linear here (one cluster, one child agent pool resource depending on it via parent:), so Bicep/ARM can compute a safe deployment order with no manual dependsOn needed. Edge cases worth naming explicitly: a spot pool scaled to zero nodes during low-demand windows needs the cluster autoscaler enabled (not included above, since the question scoped this to "resource declarations necessary to create the cluster and the two pools," not the autoscaler configuration) or it simply won't scale back up on its own; an eviction happening mid-batch-job needs the workload itself to be checkpoint/restart-tolerant, which is an application-level requirement this template cannot enforce, only enable via the taint; and a region or zone briefly running out of spot capacity for the requested VM size will leave spotNodeCount unmet until capacity frees up, which is expected spot behavior, not a template bug.
A customer needs a highly available 3-tier (web, application, database) application spanning two Azure regions with minimal failover time and consistent read performance. Design an architecture using Azure services (regional front-ends, global DNS/routing, compute options, and database replication) and explain trade-offs between active-passive and active-active approaches, including expected RTO/RPO implications and cost considerations.
Sample Answer
Direct answer
For a 3-tier app that needs low failover time and consistent reads across two regions, default to active-passive: one region takes all writes and reads, the second is a warm, continuously-replicated standby that only takes traffic during a declared failover. Reach for active-active only when you can accept eventual consistency between regions in exchange for both regions serving live traffic all the time; it costs roughly double the compute and data tier and adds real correctness work (conflict resolution) that active-passive avoids entirely.
Architecture
- Global entry point: Azure Front Door (Standard/Premium) in front of both regions. Front Door does TLS termination, health-probes each region's origin, and fails traffic over automatically at the HTTP layer, which is faster and more controllable than relying on client-side DNS caching alone. Traffic Manager (DNS-level routing) is the cheaper alternative if you don't need Front Door's WAF/CDN features, but failover then depends on the client's DNS resolver honoring your TTL (Time To Live: how long a DNS answer is cached before a client re-checks it).
- Web/app tier: identical App Service Plans (or AKS (Azure Kubernetes Service, Azure's managed Kubernetes)/VMSS, same idea) deployed in both regions, both always running in active-passive (the passive region's compute is live and warm, just not receiving traffic until failover; this is what buys you fast RTO (Recovery Time Objective: how long it takes to restore service after a failure) instead of a cold-start VM boot).
- Data tier: Azure SQL Database with an auto-failover group. The primary region takes all writes; the secondary is a readable replica kept in sync by asynchronous geo-replication. The failover group publishes two DNS listeners that don't change across a failover (
<group>.database.windows.netfor read-write,<group>.secondary.database.windows.netfor read-only), so the app's connection string never has to change.
graph TD
U[User] --> FD[Azure Front Door]
FD -->|primary, active| R1W[Region A: App Service]
FD -->|standby, health-probed| R2W[Region B: App Service]
R1W --> R1DB[(Azure SQL: primary)]
R2W -.read-only listener.-> R1DB
R1DB ==async geo-replication==> R2DB[(Azure SQL: secondary)]
R2W --> R2DB
Worked example: active-passive vs active-active on this design
Take the SQL failover group specifics as the concrete numbers, since Microsoft publishes them for exactly this mechanism:
- Replication to the secondary is asynchronous, so RPO (Recovery Point Objective: how much data, measured in time, you could lose in a failure) is near-zero in the common case but is not zero: a forced failover (primary truly unreachable, you can't wait for the last transactions to drain) can lose whatever was in flight, bounded by whatever
GracePeriodWithDataLossHoursyou configure. A planned failover (primary still reachable) waits for full sync first and loses nothing. - The failover group's DNS listener has a fixed 30-second TTL. So once you decide to fail over, RTO is roughly: your detection time (the term that actually dominates, typically 1 to 5 minutes with a real health-check/alerting pipeline) + the control-plane time to flip the group's primary/secondary roles (low single-digit minutes) + up to 30 seconds for the listener CNAME to repoint + client reconnect. A well-automated active-passive setup (automation triggers the failover, not a human) realistically lands in the 5 to 15 minute RTO range, and near-zero RPO unless the failure itself is what's forcing data loss.
- Consistent read performance is the actual argument against active-active here: the secondary is a read-only replica with real (if small) replication lag, so if you route ordinary user reads to the secondary "for latency," you can serve stale data. The safe pattern is: all reads and writes go to the primary region's App Service, and the read-only listener is reserved for genuinely latency-tolerant workloads (reporting, analytics), not the main request path. Active-active with Cosmos DB multi-region writes would give every region low-latency local reads with a chosen consistency level (session consistency gives read-your-writes per client), but Cosmos DB bills throughput per region, so writing in both regions roughly doubles your provisioned RU/s cost versus a single write region, on top of needing conflict resolution logic (Cosmos DB defaults to last-writer-wins) for any row two regions might touch concurrently.
Trade-offs and pitfalls
| Active-passive (SQL failover group) | Active-active (Cosmos DB multi-region write) | |
|---|---|---|
| RTO | Minutes, bounded by detection + 30s DNS TTL | Effectively zero, both regions already serving |
| RPO | Near-zero (async lag); forced failover can lose in-flight writes | Near-zero per write, but conflicts are resolved automatically (usually last-writer-wins), which is a different risk than data loss |
| Cost | ~1x compute (standby is warm but idle of user traffic) + 1x data tier compute, both regions running | Roughly 2x the data tier's throughput cost (per-region RU/s), full compute in both regions carrying live load |
| Operational complexity | Low: one failover runbook, no conflict logic | Higher: need conflict resolution, idempotent writes, and monitoring for split-brain-style anomalies |
The pitfall teams hit most often is choosing active-active because "it sounds more available" without an actual requirement for it, then discovering months later that a race condition between two regions writing the same row was silently resolved by last-writer-wins and nobody designed for that. Pick active-active only when you have a genuine business reason to serve write traffic from both regions (usually: users in both geographies need low write latency), not as a default upgrade from active-passive.
You operate an API behind an Azure Standard Load Balancer backed by a VM Scale Set. Traffic spikes predictably every day for 30 minutes and reaches 10x baseline. Design an autoscaling strategy to meet latency SLOs while controlling cost: specify scheduled scaling, metric-based policies, cooldowns, warm-up/instance-provisioning considerations, and minimum/maximum instance count choices.
Sample Answer
Direct answer
Because the spike is predictable, same time, same duration, every day, lead with scheduled scaling to pre-provision the extra capacity a few minutes before the spike starts, and layer metric-based autoscaling on top as a safety net for load that does not match the schedule exactly. Relying on reactive metric-based scaling alone carries an inherent lag, detect, then boot new instances, then wait for them to become healthy, which is exactly the latency-SLO (service-level objective) risk a known, recurring spike lets you design around instead of merely react to.
Structured elaboration
Scheduled scaling. Configure a recurring autoscale profile that raises the minimum instance count from baseline to a pre-calculated "spike-ready" count starting 10 to 15 minutes before the daily spike begins, enough lead time for new instances to provision, boot, and pass health probes before real traffic arrives, and lowers it back after the spike ends. This turns the spike from something the system reacts to into something it already expects.
Metric-based policy as the safety net. Layer CPU and request-queue-length-based scale-out rules on top of the scheduled baseline. A queue-length trigger, the depth of a Service Bus or Storage Queue in front of the API if requests are buffered, or the scale set's own request-queue metric if synchronous, is often a more direct signal of "customers are waiting" than CPU, since CPU can look fine while requests queue up behind a slow downstream dependency. This catches a spike that is 20 percent larger than yesterday's, or starts 5 minutes early, without over-provisioning for that uncertainty in the schedule itself.
Cooldowns and instance protection. Use a short scale-out cooldown, the minimum time between the last scale action and the next, so the system keeps adding capacity if a spike keeps growing, and a longer scale-in cooldown so instances are not removed the moment load dips for one measurement interval only to be needed back 90 seconds later. The classic failure mode this whole design avoids is thrashing, rapid scale-out followed by scale-in followed by scale-out again. Instance protection is the specific guard against it: mark newly scaled-out instances with scale-in protection for a grace period after they join, so the next autoscaler evaluation cannot immediately remove an instance that just finished warming up and has not yet taken meaningful traffic.
Warm-up and instance-provisioning considerations. A scale set instance is not ready for real traffic the moment it boots; it needs the OS to finish booting, the application to start, and, if the app does any lazy initialization such as loading a cache or warming a connection pool, that too, before it should receive production requests. Configure the load balancer's health probe against an application-level endpoint that only returns success after warm-up completes, not an OS-level "is a socket open" check, otherwise the autoscaler and load balancer both believe capacity exists several seconds or more before it actually does, precisely when latency SLOs get breached during a scale event.
Minimum and maximum instance counts. Set the daily baseline minimum to handle normal off-peak traffic with headroom for a single-instance failure, never a minimum of 1, which has zero fault tolerance. Set the scheduled spike-ready minimum to the pre-calculated count for expected 10x load with some margin, since "average" spikes will sometimes be worse than average. Set a hard maximum from a genuine cost and risk ceiling, since a runaway metric-based scale-out with no ceiling can turn a traffic spike into a cost incident.
Worked example
Baseline traffic needs 4 instances to stay under the latency SLO with N+1 fault tolerance. The daily spike reaches 10x load for 30 minutes, and load testing showed 30 instances are needed to hold the SLO at that traffic level. A scheduled autoscale profile sets the minimum to 30 starting at 8:45 a.m. for a 9:00 a.m. spike, 15 minutes of lead time against an observed instance boot-to-healthy time of 4 to 6 minutes, and back to the baseline of 4 at 9:35 a.m., 5 minutes after the spike's observed end as a buffer against it running slightly long. On top of that scheduled floor, a queue-length-based rule adds up to 10 more instances (max cap 40) if request queue depth exceeds a threshold indicating the schedule under-provisioned for that particular day, with a 2-minute scale-out cooldown to react quickly to a bigger-than-expected spike and a 15-minute scale-in cooldown plus a 10-minute scale-in-protection grace period on newly added instances, so capacity is not removed within the same spike window just because one measurement interval looked calmer.
Trade-offs and pitfalls
Relying on metric-based scaling alone for a known, recurring spike reacts only after load has already started climbing, and can spend the first several minutes of the daily spike under-provisioned and breaching the SLO before capacity catches up, the main defect this design avoids. A health probe set to a shallow check that returns healthy before the application has actually finished warming up routes real traffic to instances that are not ready, causing exactly the tail-latency spikes autoscaling was supposed to prevent. And setting scale-in cooldown too short relative to how spiky load actually is within the 30-minute window creates thrashing that wastes both the compute cost of repeated boot cycles and the latency cost of repeated cold instances.
You're handed an enterprise Azure invoice that shows unexpectedly high compute and storage costs. Describe a step-by-step approach to analyze the bill, identify hotspots (e.g., idle VMs, oversized disks, retention policies), estimate savings potential from reserved instances and spot VMs, and propose a prioritized implementation plan with ROI for each recommendation.
Sample Answer
Direct answer
Work top-down from the bill, not bottom-up from guesses: use Cost Management's cost analysis to find which resource groups and services actually drove the increase, drill into the specific resources inside those, then apply resource-specific checks (idle compute, oversized disks, stale retention) only to the hotspots the data pointed at, and size the savings and the implementation order by expected dollar impact divided by effort, not by which fix is most familiar.
Structured elaboration: a step-by-step approach
1. Establish the baseline and the delta. In Cost Management, group cost by service and by resource group over the last 3 months, and identify which specific service or resource group's cost curve actually inflected upward, and when. This turns "the bill is unexpectedly high" into "compute in resource group X roughly doubled starting the week of the 14th," which is a findable, explainable fact instead of a vague impression.
2. Attribute the delta to specific resources. Within the resource group or service that inflected, group by resource (not just service) to find the specific VM, disk, or database instance(s) responsible. A jump that is spread evenly across 40 VMs suggests a platform-wide change (a SKU-wide price change, a new region's pricing, a policy that stopped a discount from applying); a jump concentrated in 2 VMs suggests those two specifically changed behavior (someone resized them, a workload moved onto them, they stopped getting shut down on schedule).
3. Check the classic hotspots, informed by what step 2 found, not blindly.
- Idle or oversized compute: pull average CPU/memory utilization for the flagged VMs over the same window (Azure Monitor metrics, or Azure Advisor's own "low-utilization VM" recommendations, which already do this analysis for you). A VM sized for peak load that never approaches that peak is the single most common and highest-value finding in this kind of review.
- Oversized or orphaned disks: managed disks billed at their provisioned size regardless of how full they are, and a disk detached from a deleted VM keeps billing until it is explicitly deleted; both are easy to miss because neither shows up as "a resource that's obviously broken," only as a line item that quietly never goes away.
- Retention and duplication: Log Analytics/Application Insights ingestion at a default or forgotten-about long retention, unused snapshots, or backup vaults retaining far more restore points than the actual recovery policy requires, are all silent, compounding monthly costs with no functional owner actively watching them.
- Missing reservations or savings plans on stable, always-on workloads: the highest-value structural fix is often not "turn something off" but "the always-on baseline is paying full pay-as-you-go price when it has been running steadily for months."
4. Estimate savings potential, grounded in real numbers, not a memorized percentage. Microsoft's own published pricing states Reserved Instances (RIs) save "up to 72%" compared to pay-as-you-go, with typical realized savings in the 36-72% range depending on term length, region, and instance family; Spot VMs are marketed as "up to 90%" off pay-as-you-go, though the realized discount is workload- and region-dependent and can be smaller. As one concrete, currently-measured data point (Azure Retail Prices API, eastus, checked live for this analysis): a Standard_D4s_v5 Linux VM lists at $0.192/hour pay-as-you-go and $0.040531/hour as Spot, a 78.9% discount for that specific SKU and region at the time of the check, which sits inside Microsoft's advertised "up to 90%" range but is a real, not a rounded-headline, number. Apply the RI/Spot decision correctly: RIs (or savings plans, which are more flexible across SKU/family changes) suit steady, predictable, always-on workloads; Spot suits interruptible, fault-tolerant, or batch/dev workloads that can absorb an eviction, never a stateful production database.
5. Prioritize and propose, with ROI shown per recommendation, not just a total. Rank recommendations by (estimated monthly savings) against (implementation effort and risk), and separate "safe to do immediately" (deleting an orphaned disk with zero attached VM, right-sizing a VM that Advisor already flagged at 3% average CPU) from "needs validation before committing" (buying a 3-year RI locks in a capacity commitment; right-sizing a VM that occasionally does need its current size for an unmodeled peak needs a load-pattern check first, not just an average-CPU glance).
Worked example: sizing one recommendation
An idle VM found in step 3, a Standard_D4s_v5 running 24/7 at under 5% average CPU for the last 60 days, currently on pay-as-you-go: its current cost is 0.192/hour x 730 hours/month = $140.16/month. Two candidate fixes: right-size it down to a Standard_D2s_v5 (roughly half the vCPU/memory of a D4s_v5, since the workload clearly does not need 4 vCPUs at 5% utilization) or move it onto a 1-year Reserved Instance at its current size if the workload genuinely needs to stay always-on at this size for a reason the utilization graph does not show (a fixed baseline requirement, not just historical accident). If right-sizing is correct, the fix saves roughly half of $140.16 (~$70/month, ~$840/year) for one VM; if this pattern repeats across 15 similarly oversized VMs found in the same resource group, that is roughly $12,600/year from a single, low-risk, low-effort change category, which is exactly the kind of number that should be presented and prioritized ahead of a more complex, higher-risk architectural change with a similar dollar impact.
Trade-offs and pitfalls
The most common mistake in this kind of review is starting from a checklist of "things that are usually wasteful" and applying it uniformly across the whole subscription, instead of letting the actual cost delta point at where to look; that wastes the reviewer's time auditing resources that were never the problem and can miss the real driver entirely if it is not on the generic checklist (a forgotten large Log Analytics retention setting, for instance, rarely makes a generic "reduce cloud waste" checklist but can be a bigger line item than every idle VM combined). A second common mistake is recommending a 3-year Reserved Instance purchase for a workload whose long-term shape is not actually known yet; a savings plan (more flexible, applies across a broader set of matching compute regardless of exact SKU/family/region within its scope) or a shorter 1-year term is the more defensible recommendation until the workload's stability is proven over a longer observation window.
Describe Azure Virtual Network fundamentals: address spaces, subnets, Network Security Groups (NSGs), User-Defined Routes (UDRs), service tags, and Azure-provided DNS. Provide an example CIDR allocation for production with three subnets (web, app, db) and explain how NSGs can isolate tiers while allowing required connectivity.
Sample Answer
Direct answer
A Virtual Network (VNet) is a private address space you carve into subnets, each of which can carry its own Network Security Group (NSG) for allow/deny packet filtering and its own User-Defined Route (UDR) to override Azure's default routing. Service tags let those rules reference a named group of Microsoft-maintained IP prefixes (like "Storage" or "Internet") instead of hardcoded addresses, and Azure-provided Domain Name System (DNS) resolves VM names inside the VNet automatically without you running your own DNS server.
The building blocks
- Address space: the VNet's overall private Classless Inter-Domain Routing (CIDR) range, typically drawn from the private ranges reserved by RFC 1918 (
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16). - Subnets: subdivisions of that address space; every subnet lives entirely within one VNet and one region, and cannot span multiple VNets or regions.
- Network Security Groups (NSGs): a stateful, priority-ordered list of allow/deny rules for layer 3/4 traffic (source, destination, port, protocol), attached to a subnet or a network interface. Azure adds default rules at the lowest priority, including
AllowVnetInBound,AllowAzureLoadBalancerInBound, andDenyAllInBound, so anything you don't explicitly allow above those is denied by default. - User-Defined Routes (UDRs): override Azure's automatic system routes, most commonly used to force a subnet's traffic through a firewall or network virtual appliance (NVA) by setting a route's next hop type to "Virtual appliance" instead of the internet directly.
- Service tags: named, Microsoft-maintained groups of IP prefixes (
Storage,Sql,Internet,VirtualNetwork,AzureLoadBalancer, and others) that NSG and UDR rules can reference directly, so a rule keeps working as the underlying IP ranges for a service change over time. - Azure-provided DNS: a platform-managed resolver (at the well-known address
168.63.129.16) that resolves VM names within the VNet and forwards internet lookups, with no DNS server to deploy or patch; cross-VNet name resolution or custom domains typically move to Azure Private DNS zones or your own DNS servers instead.
Worked example: CIDR allocation for a three-tier production network
A 10.0.0.0/16 VNet (65,536 addresses) split into three /24 subnets:
| Subnet | CIDR | Usable addresses |
|---|---|---|
| Web | 10.0.1.0/24 | 251 |
| App | 10.0.2.0/24 | 251 |
| DB | 10.0.3.0/24 | 251 |
Azure reserves 5 addresses per subnet regardless of size (the network address, .1 for the default gateway, .2 and .3 for Azure's internal DNS mapping, and the broadcast address), so a /24's usable count is:
For p = 24: 28−5=251, verified directly (10.0.1.0/24 has 256 total addresses; 256 minus the 5 Azure reserves leaves 251).
Isolating tiers with NSGs while allowing required connectivity
| Subnet | Inbound allow | Inbound deny (default) | Outbound |
|---|---|---|---|
Web (10.0.1.0/24) | Port 443/80 from Internet (or narrower, from a load balancer's subnet only) | Everything else | To App subnet on the app's port |
App (10.0.2.0/24) | App port, from Web subnet's prefix only | Everything else, including direct Internet | To DB subnet on the database port |
DB (10.0.3.0/24) | Database port (for example, 1433 for SQL), from App subnet's prefix only | Everything else | Deny to Internet explicitly |
The database tier's explicit outbound deny to the internet matters as much as its inbound restriction: a compromised database tier reaching out to the internet is a common data-exfiltration path, and NSGs are stateful but don't stop an allowed inbound connection's application from opening its own outbound one.
Trade-offs and pitfalls
- Sizing subnets too tightly (a
/28for a tier expected to autoscale) is a common planning mistake; leave headroom, since resizing a subnet with resources already in it is disruptive. - Referencing a service tag instead of a hardcoded IP range is almost always the right call for anything Microsoft manages (
Storage,Sql), since the underlying addresses do change over time and a hardcoded rule silently goes stale. - A UDR forcing traffic through a firewall or NVA adds a real network hop and a potential single point of failure; plan its own high availability before making it mandatory for every subnet's egress (its outbound traffic).
Unlock Full Question Bank
Get access to all Microsoft Azure Services and Architecture interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.