📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

The interviewer points at your design diagram and asks: "Where are the security boundaries?" How do you design security boundaries into a system? Explain trust zones, private networking, how services prove their identity to each other, and how you limit the blast radius when one component is compromised, using Azure as the example.

Security boundaries in system design: trust zones and where to enforce them, private networking (VNets, private endpoints, egress control), workload identity between services, least privilege, data segmentation and blast-radius reduction on Azure.

Senior Architecture Advanced azure managed-identity private-endpoints security-boundaries system-design zero-trust

🎯 Key points

  • Draw trust zones on the diagram: internet, edge (Front Door + WAF), application, data, management/admin, third parties; every arrow crossing a zone is a boundary to defend
  • Zero trust with Microsoft Entra ID as the identity plane: verify every user, workload and admin call explicitly (Conditional Access, MFA); the network is an extra layer, not the boundary
  • Private networking: VNet integration, private endpoints for PaaS (Azure SQL, Storage, Key Vault, Service Bus), public network access disabled, NSGs, egress through Azure Firewall
  • Service identity: managed identities and Entra ID tokens (client credentials) instead of shared secrets; validate audience and roles in the callee
  • Least privilege: RBAC scoped to the resource, separate identities per service, database roles per service, PIM just-in-time admin (Essential Eight)
  • Blast radius: separate subscriptions per environment, per-tenant or per-domain data segmentation, short-lived credentials, separate keys
  • Sensitive data: classify it, keep it in the fewest stores, encrypt with keys you can rotate, avoid copying PII into events and logs (Privacy Act APP 11)
  • Enforce and detect: Azure Policy to deny insecure configurations (public endpoints, missing private DNS), Defender for Cloud for posture and threat alerts, central audit logs, an incident runbook

⏱ 30-second answer

I draw trust zones on the diagram — internet, edge, application, data, admin and third parties — and treat every arrow that crosses a zone as a boundary with explicit controls. I design for zero trust: the network isn't the security boundary, so every call is authenticated and authorised with Microsoft Entra ID identities, and private networking is an extra layer. In Azure that means Front Door with WAF at the edge, private endpoints with public access disabled for SQL, Storage, Key Vault and Service Bus, managed identities with Entra tokens between services instead of shared secrets, least-privilege RBAC and PIM for admins. Azure Policy enforces those rules on every new resource and Defender for Cloud watches for drift and threats. To limit blast radius I separate environments into subscriptions, give each service its own identity and database role, and keep sensitive data in as few places as possible. The trade-off: every boundary adds friction, so the strongest ones go around the most sensitive data.

🗣 Full answer (senior)

How I would answer this in an interview

"I'd draw the zones on the diagram first. Internet; the edge, which is Front Door with the WAF; the application zone, where the APIs and workers run; the data zone with Azure SQL, Storage and Key Vault; the admin zone, which is how engineers and pipelines get in; and third parties like the payment provider. Every arrow that crosses a zone line is a boundary, and for each one I say how the caller is authenticated, what it's allowed to do, and how the traffic is protected.

The principle is zero trust: being inside the VNet doesn't make a caller trusted. So service to service, each workload has its own managed identity, gets an Entra ID token for the callee's audience, and the callee checks the audience and an app role — no shared API keys in config. The network is the second layer: PaaS services sit behind private endpoints with public network access disabled, the apps use VNet integration, and outbound traffic goes through Azure Firewall so a compromised container can't send data anywhere it likes. For example, at [company] we [found during a pen test that a reporting service had a connection string with db_owner on the main database and the storage account allowed public access]. I [moved each service to its own managed identity with a database role limited to the tables it needed, put storage behind a private endpoint, and moved admin access to PIM with approval], [and the pen test retest closed all [N] high findings].

The mistake I see is a flat design: one identity for everything, one database user with owner rights, PaaS on public endpoints 'protected' by a firewall rule, and engineers with standing admin. Then one leaked secret opens everything. So I design for blast radius: separate subscriptions per environment, one identity per service, per-tenant or per-domain data separation where the data is sensitive, and the fewest possible copies of personal data. Boundaries should be strongest where the data is most valuable, and everything that crosses one should be authenticated, authorised and logged."


Trust zones and controls

 Internet
    |  TLS 1.2+, WAF, rate limits, bot protection
 [Front Door + WAF] ---------------------------- edge zone
    |  Private Link origin / access restrictions
 [API (Container Apps / App Service, VNet-integrated)] --- app zone
    |  managed identity + Entra token      |  egress via Azure Firewall
 [Worker]  [Service Bus PE]                  -> [payment provider]  third party
    |  managed identity, DB role per service
 [Azure SQL PE] [Storage PE] [Key Vault PE] ----- data zone (public access off)

 Admin zone: Entra ID + MFA + PIM -> Bastion / pipelines with workload identity federation
Boundary Authentication Authorisation Protection
User → edge OIDC (Entra External ID), MFA where needed Scopes / roles in token TLS, WAF, rate limiting
Edge → API Private Link origin or header check + access restrictions Only Front Door may reach the API No public origin
Service → service Managed identity → Entra token App roles, audience validation Private networking, mTLS in a mesh if used
Service → data Managed identity (Entra auth for SQL) DB role per service, RBAC data roles Private endpoints, TDE, Always Encrypted for the most sensitive columns
App → third party Provider credentials in Key Vault Least scope API keys Egress allow-list, webhook signature checks
Human → production Entra ID + MFA PIM just-in-time roles with approval Bastion, audit logs

Blast-radius techniques

Technique Limits Cost
Subscription per environment A dev compromise reaching prod More subscriptions to manage
Identity per service Lateral movement More role assignments
DB role per service, no db_owner at runtime Data access to what the service needs Migration identity separate
Per-tenant data separation (DB or key) One tenant's breach exposing others Ops and cost
Short-lived tokens, no secrets Value of a leak Some setup
Egress control Data exfiltration Firewall cost, allow-list upkeep

Production example

After moving [12] services from shared SQL logins to managed identities with per-service roles and putting all PaaS behind private endpoints, the number of credentials stored anywhere dropped from [~40] to [3] third-party keys in Key Vault, and a pen test retest closed all [5] high findings with no performance impact beyond [~2 ms] of token caching on cold calls.

🔍 What the interviewer is checking

Checks whether the candidate builds security into the design as explicit boundaries with concrete controls, rather than a generic "we'll add HTTPS and a firewall".

Green flags

  • Draws trust zones and attaches authentication, authorisation and protection to each crossing
  • Uses managed identities and token validation instead of shared secrets
  • Mentions private endpoints, egress control and the admin/pipeline path
  • Talks about blast radius and data minimisation, with Australian privacy context

Red flags

  • Relies on the network perimeter alone
  • One shared credential or db_owner for everything
  • Forgets privileged access and CI/CD as attack paths

📚 Learn in depth

1. Why boundaries, not perimeters

The old model was a hard perimeter with a soft inside. Cloud systems have many entry points (public PaaS endpoints, pipelines, third-party webhooks, developer laptops), so attackers who get one foothold move laterally. Zero trust assumes breach: verify explicitly, use least privilege, and limit blast radius.

2. Finding the boundaries with a threat model

Use STRIDE on the data flow diagram: for each element and each arrow crossing a trust boundary, ask about Spoofing, Tampering, Repudiation, Information disclosure, Denial of service and Elevation of privilege. The output is a list of controls tied to specific arrows, which is exactly what an interviewer wants to hear.

3. Network layer on Azure

  • Private endpoints give a PaaS resource a private IP in your VNet; with public network access disabled, the resource is unreachable from the internet. DNS (private DNS zones such as privatelink.database.windows.net) must resolve to the private IP — the most common setup mistake.
  • VNet integration lets App Service / Container Apps reach private endpoints.
  • NSGs filter traffic between subnets; Azure Firewall (or an NVA) controls egress with FQDN allow-lists.
  • Front Door with Private Link origins stops anyone bypassing the WAF to hit the origin directly.

4. Identity layer

Worker (managed identity)
   -> Entra ID: client credentials, scope api://orders/.default
   <- JWT (aud=api://orders, roles=[Orders.Read])
   -> Orders API validates issuer, audience, signature, role

In .NET, DefaultAzureCredential (or ManagedIdentityCredential in production) gets and caches tokens; Azure SDK clients and Microsoft.Data.SqlClient (Authentication=Active Directory Managed Identity) use them directly. No secret exists to leak or rotate.

5. Data layer

  • Classify data (public, internal, confidential, sensitive personal information).
  • Keep sensitive data in the fewest stores; events and logs carry ids, not records.
  • Encrypt at rest (TDE, Storage service encryption) and, for the most sensitive fields, with customer-managed keys or Always Encrypted.
  • Australian context: the Privacy Act's APP 11 requires reasonable steps to protect personal information; a breach likely to cause serious harm triggers the Notifiable Data Breaches scheme. Smaller blast radius = smaller notifiable breach.

6. Admin and pipeline boundary

Most serious breaches go through privileged access. Use PIM for just-in-time roles, MFA for all admins, workload identity federation (OIDC) for GitHub Actions or Azure Pipelines instead of stored service principal secrets, and separate the identity that runs migrations from the runtime identity. These map to the ACSC Essential Eight controls on restricting administrative privileges and MFA.

7. Try it yourself

  1. Draw a data flow diagram for one of your systems, mark trust boundaries, and run STRIDE on each crossing.
  2. Put a storage account behind a private endpoint with public access disabled and confirm nslookup from inside and outside the VNet resolves differently.
  3. Replace a SQL connection string password with a managed identity and a contained database user with only db_datareader on one schema.
  4. Call one API from another with DefaultAzureCredential and validate the audience and an app role in the callee.
  5. Run Defender for Cloud's recommendations on a test subscription and fix the top three.

💻 Code

Service-to-service calls with managed identity on both sides: no secrets, explicit audience and role checks.

// Caller (Worker): gets a token for the Orders API using its own managed identity.
namespace Billing.Worker;

using System.Net.Http.Headers;
using Azure.Core;
using Azure.Identity;

public sealed class OrdersApiAuthHandler(TokenCredential credential) : DelegatingHandler
{
    private static readonly TokenRequestContext Scope = new(["api://orders-api/.default"]);

    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken ct)
    {
        // Azure.Identity caches the token and refreshes it before expiry.
        var token = await credential.GetTokenAsync(Scope, ct);
        request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token.Token);
        return await base.SendAsync(request, ct);
    }
}

// Program.cs (Worker)
// builder.Services.AddSingleton<TokenCredential>(new ManagedIdentityCredential(ManagedIdentityId.SystemAssigned));
// builder.Services.AddTransient<OrdersApiAuthHandler>();
// builder.Services.AddHttpClient("orders", c => c.BaseAddress = new("https://orders.internal.example"))
//        .AddHttpMessageHandler<OrdersApiAuthHandler>();
// Callee (Orders API): accept only tokens for this API that carry the right app role.
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Identity.Web;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd")); // validates issuer, audience, signature

builder.Services.AddAuthorizationBuilder()
    .AddPolicy("OrdersReader", p => p.RequireRole("Orders.Read")); // app role granted to the worker's identity only

var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();

app.MapGet("/orders/{id:guid}", (Guid id) => Results.Ok(new { id }))
   .RequireAuthorization("OrdersReader");

app.Run();
# Data zone: SQL reachable only through a private endpoint; the runtime identity is a least-privilege DB user.
az sql server update -g rg-prod -n sql-orders --set publicNetworkAccess=Disabled
# In the database (as the Entra admin):
#   CREATE USER [orders-api] FROM EXTERNAL PROVIDER;
#   ALTER ROLE db_datareader ADD MEMBER [orders-api];   -- no db_owner at runtime

⚠ Common mistakes

  • Mistake: Treating the VNet as the security boundary. Why it is wrong: Anything that gets inside (a compromised container, a misconfigured peering) can then call everything. Instead: Authenticate and authorise every call with Entra ID identities; use the network as a second layer.
  • Mistake: Shared secrets between services. Why it is wrong: API keys and passwords leak through config, logs and repos, and rotating them is painful, so in practice they are never rotated. Instead: Use managed identities and Entra ID tokens with audience and role checks.
  • Mistake: One database login with db_owner for every service. Why it is wrong: One SQL injection or leaked string exposes and can destroy all data, turning a single bug into a company-wide notifiable breach. Instead: One identity and least-privilege role per service; a separate identity for migrations.
  • Mistake: Leaving PaaS on public endpoints with IP firewall rules. Why it is wrong: Credentials alone then grant access from anywhere allowed, and rules drift. Instead: Private endpoints with public network access disabled, and correct private DNS.
  • Mistake: Configuring boundaries by hand. Why it is wrong: The next resource someone creates in the portal is public again, and nobody notices. Instead: Define them in IaC, enforce with Azure Policy (deny public network access, require private endpoints and tags), and track posture in Defender for Cloud.
  • Mistake: Letting the origin be reachable without the WAF. Why it is wrong: Attackers bypass Front Door and its protections. Instead: Private Link origins or access restrictions that accept only Front Door traffic.
  • Mistake: No egress control. Why it is wrong: A compromised workload can exfiltrate data to any host. Instead: Route egress through Azure Firewall with an allow-list.
  • Mistake: Standing admin rights for engineers and secrets in pipelines. Why it is wrong: Privileged access is the most common breach path. Instead: PIM just-in-time access with MFA, and workload identity federation for pipelines.
  • Mistake: Copying personal data into events, logs and caches everywhere. Why it is wrong: Every copy widens a breach under the Privacy Act and NDB scheme. Instead: Classify data and keep sensitive fields in the fewest stores.

🏛 Senior insight: trade-offs

Security boundaries are a design property, not a checklist added before go-live. Seniors draw the zones, attach controls to each crossing, and prioritise by data sensitivity and likelihood — privileged access and identity first, then network. They also accept that every control adds friction (private DNS, firewall rules, role assignments), so they automate it with infrastructure as code and Azure Policy rather than hand-configuring it.

Control When it fits Cost When not to
Managed identity + Entra tokens Any Azure-hosted service-to-service or service-to-data call Some setup, token caching Calls to third parties that only support keys (store in Key Vault)
Private endpoints, public access off Production data stores and brokers DNS complexity, per-endpoint cost Truly public content (use a CDN)
Service mesh mTLS Many services on AKS, need workload-level encryption and policy Mesh operations A handful of PaaS services
Subscription per environment / domain Clear blast-radius separation Governance overhead Tiny single-team projects
Customer-managed keys / Always Encrypted Highly sensitive data, regulatory need Key management, query limits General data where platform encryption suffices

🔗 Follow-ups the interviewer may ask

  1. When: Candidate mentions threat modelling or building security in from the start Why: Checks they can fold security and observability into the overall design method
    How to answer

    I treat security and observability as parts of the diagram, not footnotes.

    For security I draw trust boundaries, then say how each crossing is protected: users authenticate at the edge with Entra ID / OIDC, services use managed identities, data stores sit behind private endpoints, secrets live in Key Vault, and personal data is classified, minimised and kept in Australia East for Privacy Act obligations.

    For observability I add OpenTelemetry traces, metrics and structured logs with one trace id across services, define SLOs for the main user journeys, and alert on burn rate, not CPU.

    The trade-off is upfront effort and some cost (private networking, telemetry ingestion) against far cheaper incidents and audits later.

  2. When: Candidate mentions least privilege, RBAC or PIM Why: Checks they can apply least privilege to Azure and SQL in detail
    How to answer

    Least privilege means every identity gets only the permissions it needs, at the smallest scope, for the shortest time. For a .NET service in Azure I give each workload its own managed identity and assign data-plane roles at resource scope: Storage Blob Data Reader on one container, Key Vault Secrets User on one vault, never Contributor on the subscription. In Azure SQL the app is a contained user with read/write or object-level grants, not db_owner; migrations run under a separate identity in the pipeline. Humans have no standing admin rights: they elevate through Entra PIM, time-bound and audited. That maps to the Essential Eight's restrict administrative privileges strategy. The trade-off is operational friction: narrow scopes mean more role assignments and more "access denied" during development, so you codify them in Bicep or Terraform rather than clicking in the portal.

  3. When: Candidate mentions secrets, Key Vault or managed identity Why: Checks how they manage the secrets that still exist
    How to answer

    A secret is anything that grants access or proves identity: database passwords, API keys and tokens, client secrets, JWT signing keys, SAS tokens. The best secret is no secret at all: in Azure I use managed identity so the app authenticates to Azure SQL, Storage and Service Bus with Entra tokens, not stored credentials. What must remain a secret, typically a third-party API key that doesn't support Entra, goes in Azure Key Vault, read through the AddAzureKeyVault configuration provider using the app's managed identity, with Key Vault RBAC per app and a vault per environment. Locally, developers use dotnet user-secrets or their own Entra sign-in against a dev vault. Nothing goes in appsettings.json or the repo, and secret scanning blocks pushes. The trade-off: Entra and Key Vault become runtime dependencies with network hops and throttling limits, so you load at start-up, cache and reload on an interval, and automate rotation rather than doing it by hand.

🛠 Real-world problems: how you handle them

A pen test found one leaked connection string could open everything
Situation
[Financial services] platform with [12] .NET services on [App Service] sharing one SQL login with [db_owner], storage and Key Vault on public endpoints, engineers with standing Contributor rights.
Signals
Pen test report with [5] high findings: a connection string in an old pipeline variable, public storage access, lateral movement possible from any service; Defender for Cloud secure score at [48%].
Investigation
Drew the data flow diagram with trust zones and ran STRIDE on each boundary; inventoried every credential (pipelines, app settings, Key Vault) and every role assignment; checked which tables each service actually used from Query Store.
Resolution
Immediately rotated the SQL password and removed it from the pipeline. Then gave each service a managed identity and a least-privilege database role, moved SQL, Storage, Key Vault and Service Bus behind private endpoints with public access disabled, routed egress through Azure Firewall and moved admin roles to PIM with approval.
Prevention
Azure Policy denying public network access on data services, a pipeline check for secrets (secret scanning), workload identity federation for deployments, threat model review in every design, and Defender for Cloud alerts.

How to tell it (STAR)

**S:** A pen test on our [financial services] platform showed that one leaked connection string would open every service's data. **T:** I led the remediation across [12] services. **A:** I mapped the trust zones, gave each service its own managed identity and least-privilege database role, moved every data store behind private endpoints, controlled egress and moved admin access to just-in-time PIM. **R:** Stored credentials dropped from [~40] to [3], the retest closed all [5] high findings, and our secure score rose from [48%] to [82%].

More in Senior Design Focus

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me