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.
Architect a secure multi-tenant SaaS platform on Azure. Cover tenant isolation options (shared schema with tenant IDs, schema-per-tenant, DB-per-tenant), authentication and authorization using Azure AD (multi-tenant app vs tenant-isolated apps), encryption and key management via Key Vault (per-tenant keys vs shared key), and compliance needs such as audit logging and tenant-scoped RBAC.
Sample Answer
Direct answer
Do not pick one tenant-isolation model for the whole platform: default new, low-risk tenants to a shared schema with a tenant identifier column for cost efficiency, and give high-risk or high-revenue tenants their own schema or database, automated through the same provisioning pipeline. Authenticate through a single multi-tenant Microsoft Entra ID (Azure's cloud identity and directory service) application so the product has one codebase and one identity model, encrypt with per-tenant keys in Key Vault wherever the tenant's contract requires it, and put the tenant identifier in every log line and every role check so isolation is enforced at every layer, not just in the database.
Structured elaboration
Tenant isolation, compared.
| Model | Isolation strength | Cost and ops overhead | When to use |
|---|---|---|---|
| Shared schema, tenant identifier column | Weakest: a single bug in a query's filter can leak across tenants | Lowest: one database serves all tenants | Many small, low-risk tenants where cost per tenant must stay near zero |
| Schema-per-tenant | Stronger logical isolation; per-tenant backup and restore is straightforward | Moderate: schema count grows with tenant count inside one database server | Mid-tier tenants needing better isolation without full database overhead |
| Database-per-tenant | Strongest: a tenant's data physically cannot leak into another tenant's queries; can place the database in the tenant's required region | Highest: connection limits, per-database cost, and operational overhead scale with tenant count | High-risk, regulated, or high-revenue tenants, or any tenant with its own data-residency requirement |
Authentication and authorization. A single multi-tenant Microsoft Entra ID application registration lets any organization's users sign in with an admin-consent flow, keeping one codebase and one permission model; include the tenant identifier and role claims directly in the issued token so the application never has to look them up separately on every request. Reserve fully tenant-isolated app registrations for the rare case where a specific enterprise customer contractually requires their own application object; it is stronger administrative separation at real operational cost, since every tenant-isolated app needs its own lifecycle management.
Encryption and key management, per-tenant versus shared. A shared customer-managed key is simpler to operate but means every tenant's blast radius is the same key; a per-tenant key in Key Vault or Managed HSM lets you revoke or rotate one tenant's access independently and supports contractual bring-your-own-key requirements, at the cost of managing one key lifecycle per tenant. Use envelope encryption (a per-record data key wrapped by the tenant's key) so rotating a tenant's key never means re-encrypting that tenant's entire dataset.
Per-tenant network segmentation. For the tenants on database-per-tenant isolation, extend the segmentation past the database itself: place each such tenant's data store behind its own private endpoint and restrict the application tier's outbound rules so one tenant's compute path cannot reach another tenant's database subnet even if application-layer isolation were ever bypassed. This defense-in-depth layer is what keeps a single application-tier bug from becoming a cross-tenant data breach.
Compliance: audit logging and tenant-scoped role-based access control (RBAC). Every log line, from application telemetry to Key Vault access logs, carries the tenant identifier, so a single query can produce a tenant's complete audit trail on request, which is what most compliance frameworks and enterprise customer contracts actually ask for. Implement tenant admin roles as application-level roles backed by Microsoft Entra ID groups, and log every administrative action (a tenant admin changing another user's permissions, for example) to an append-only store.
Admin and provisioning automation. Automate tenant onboarding end to end through Infrastructure as Code (a template or module invoked by the provisioning pipeline, not a manual runbook): create the schema or database, create the tenant's Key Vault key if per-tenant encryption applies, provision the network segmentation if the tenant is on database-per-tenant isolation, and seed the default roles, all from one pipeline run so a human never has to remember every step for every new tenant.
flowchart TD
U[User] --> ENTRA[Microsoft Entra ID: multi-tenant app]
ENTRA --> API[API layer: reads tenant_id + role from token]
API --> POLICY[Tenant-scoped RBAC check]
POLICY --> SHARED[Shared-schema tenants]
POLICY --> DEDICATED[Database-per-tenant, private endpoint]
SHARED --> KVSHARED[Shared CMK in Key Vault]
DEDICATED --> KVPT[Per-tenant key in Key Vault]
Worked example
Trace a new enterprise customer's onboarding that contractually requires a dedicated database and its own encryption key from day one. The provisioning pipeline receives the signup event, creates a dedicated database in the tenant's required region, creates a new Key Vault key scoped to that tenant, provisions a private endpoint restricting network access to that database, provisions a Microsoft Entra ID security group for the tenant's admins, and seeds the tenant's default roles, all as one automated run rather than a manual checklist. Contrast that with the more common growth path: a different, existing tenant that started on the shared schema six months earlier outgrows it and signs a contract requiring dedicated isolation. For that tenant, the same pipeline runs its migration path instead of its onboarding path: it copies the tenant's rows out of the shared schema into a newly created dedicated database, re-encrypts them under a newly created per-tenant key, cuts the application over to the new connection string, and only then decommissions the tenant's rows from the shared schema, all without touching any other tenant's data or downtime for other tenants still sharing the original database.
Trade-offs & pitfalls
The pitfall that shows up most in real platforms is picking one isolation model up front and being unable to move a tenant later without a painful, bespoke migration; build the migration path (shared to dedicated) as a first-class, tested capability from day one, not an emergency project when the first enterprise customer signs a contract requiring it. The second is treating a shared customer-managed key as good enough for every tenant by default; the moment one enterprise contract requires an independently revocable key, retrofitting per-tenant keys onto an architecture that never planned for them is significantly harder than building the per-tenant key path from the start, even if most tenants never use it.
Design a hub-and-spoke network architecture for a global enterprise with central security controls in the hub and multiple spoke VNets for apps across regions. Include ExpressRoute/VPN connectivity from on-prem, firewall placement (Azure Firewall vs NVA), VNet peering vs hub routing, and how to manage transitive routing and costs.
Sample Answer
Direct answer
Put shared security and connectivity services (a firewall, the ExpressRoute (a private, dedicated circuit connecting on-premises to Azure) or VPN gateway, and Azure Bastion, a managed service that gives browser-based remote access to virtual machines without exposing them via a public IP) in a central hub virtual network (VNet), connect each application or region's spoke VNet to the hub via VNet peering, and force all spoke-to-spoke and spoke-to-internet traffic through the hub's firewall using User-Defined Routes (UDRs), since VNet peering is non-transitive and spokes cannot reach each other directly without it.
Topology
flowchart TB
OnPrem[On-premises] --> GW[ExpressRoute or VPN Gateway]
subgraph Hub[Hub VNet]
GW
FW[Azure Firewall or NVA]
Bastion[Azure Bastion]
end
Hub <-->|VNet peering| Spoke1[Spoke VNet: App A, Region 1]
Hub <-->|VNet peering| Spoke2[Spoke VNet: App B, Region 2]
Spoke1 -. forced via UDR through firewall .-> Hub
Spoke2 -. forced via UDR through firewall .-> Hub
Because peering doesn't transit through the hub automatically, each spoke needs a UDR whose next hop is the firewall's private IP for any traffic destined for another spoke, the internet, or on-premises, and the hub-to-spoke peerings need "use remote gateways" and "allow gateway transit" configured correctly so on-premises traffic can actually reach the spokes through the hub's gateway.
Firewall placement: Azure Firewall versus a network virtual appliance (NVA)
Both live in a dedicated subnet in the hub (for Azure Firewall, a subnet named AzureFirewallSubnet sized at least /26 (CIDR notation for a block of 64 IP addresses) to leave room for the service's own autoscaling instances). Azure Firewall is a managed, autoscaling platform-as-a-service (PaaS) offering with no patching burden, billed on deployment and throughput, and it integrates natively with Azure Monitor and Firewall Manager for policy management across multiple hubs. A third-party NVA matches an existing on-premises firewall vendor's rule syntax and can cover an advanced feature (a specific intrusion detection and prevention signature set, for example) that Azure Firewall doesn't yet offer, at the cost of the team owning the NVA's own high availability (typically an active/active pair behind a load balancer), patching, and scaling.
Transitive routing and cost
Because all inter-spoke traffic hairpins through the hub, the firewall or NVA's throughput and cost scale with total inter-spoke traffic volume, not just north-south traffic (traffic to the internet or on-premises); this is easy to underestimate if spokes host microservices that talk to each other heavily. VNet peering itself bills per gigabyte transferred across the peering link in both directions, so a hub-and-spoke topology carries a real, volume-based networking cost layered on top of the firewall's own compute cost. If spoke-to-spoke traffic volume is high and latency-sensitive, that hairpin-through-the-hub cost and latency is worth surfacing as an explicit trade-off, not something the topology hides.
Worked example: a Payment Card Industry (PCI)-scoped spoke
For a spoke that must meet Payment Card Industry Data Security Standard (PCI DSS) scope requirements, route both its east-west traffic (to other spokes) and its north-south traffic (to the internet or on-premises) through the hub firewall, with logging retained specifically for that spoke's traffic to satisfy PCI DSS audit requirements, rather than relying on generic hub-wide logs alone. Use Azure Bastion, deployed once in the hub, for all administrative Remote Desktop Protocol (RDP) or Secure Shell (SSH) access into the PCI-scoped spoke's virtual machines (VMs), so no VM in that spoke ever needs a public IP address or a separately-managed jump box, centralizing both traffic inspection and administrative-access auditing at the hub boundary instead of duplicating firewall and bastion resources per spoke.
Trade-offs and pitfalls
- Forgetting that VNet peering is non-transitive is the most common hub-and-spoke design mistake; without explicit UDRs through the firewall, spokes simply cannot reach each other, full stop.
- A hub firewall that becomes a throughput bottleneck for heavy spoke-to-spoke traffic is a real, foreseeable failure mode; size it (or its autoscale ceiling) against actual east-west volume, not just expected internet-bound traffic.
- Placing Bastion or the firewall per-spoke instead of once in the hub duplicates cost and audit surface without adding real security; centralize shared services in the hub deliberately.
Enumerate possible failure modes for Azure Availability Zones and Region-level outages. For each failure mode describe detection signals, immediate mitigation steps, recovery procedures, and how you would validate runbooks. Then outline a test plan to regularly rehearse DR playbooks (automated failovers, blue/green rehearsals) without impacting production.
Sample Answer
Direct answer
Treat availability zone (AZ) failures and region failures as two different classes of event with different response mechanics, not points on the same severity scale: a zone failure should be absorbed automatically by zone-redundant resources with no human action, while a region failure requires a deliberate, rehearsed failover decision because it usually involves some acceptable data loss. The DR rehearsal program has to actually exercise failing over, not just verify that a runbook document exists, because runbooks rot the moment nobody has run them since they were written.
Failure modes, by scope
| Failure mode | Detection signal | Immediate mitigation | Recovery procedure |
|---|---|---|---|
| Single AZ down | Zone-redundant resource's health probes show one zone's instances unhealthy; Azure Service Health posts a zone-level advisory | None needed if resources are zone-redundant (VMSS across zones, zone-redundant Azure SQL, zonal load balancer); traffic already avoids the bad zone | Azure restores the zone; zone-redundant resources rebalance automatically. Verify no capacity was silently lost (e.g., an autoscale rule that assumed 3 zones' worth of capacity is now running on 2) |
| Region-wide outage, primary | Azure Service Health region-level incident; synthetic monitoring from outside Azure shows the region unreachable; failover group replication lag spikes | Redirect users via Front Door/Traffic Manager health probe failing the primary origin; this can be automatic if configured, or a one-click manual trigger | Execute the documented failover runbook (fail the SQL failover group, confirm the secondary region's App Service is receiving traffic, validate a smoke-test transaction); declare the incident and start the clock on RTO/RPO tracking (RTO: Recovery Time Objective, how fast you must be back up; RPO: Recovery Point Objective, how much data loss is acceptable) |
| Partial region degradation (one service down, not the whole region) | Resource-specific health endpoint or Azure Monitor alert fires, but Service Health shows the region otherwise healthy | Depends on which service; often a targeted mitigation (e.g., fail just the database, leave compute in place) rather than a full regional failover | Same as above but scoped; this is the case runbooks most often get wrong because teams only rehearse "the whole region is down" |
| Runbook itself is wrong or stale | Only discovered by actually running it; this is why rehearsal matters | N/A, this is a process failure, not an infrastructure one | Fix the runbook, re-rehearse, and treat "the runbook was wrong" as an incident worth its own retro |
Rehearsal program: exercising DR without touching production
- Blue/green DR drills: stand up the "green" (secondary region) environment fully, run synthetic transactions against it in isolation (not yet receiving real user traffic), and validate it independently before ever touching the live failover switch. This catches configuration drift (a setting changed in the primary region months ago that was never replicated to the secondary's IaC) with zero production risk.
- Automated, scheduled failover drills: on a cadence (quarterly is a reasonable floor for most teams; more often for anything with a tight regulatory RTO), actually execute the failover runbook against a non-production environment that mirrors production topology, timed and logged. The goal is a real, current RTO/RPO measurement, not a guess based on how the architecture is supposed to behave.
- Chaos-style partial-failure injection: deliberately fail one dependency at a time (kill the primary database connection, block one AZ's outbound traffic with an NSG rule) in a lower environment to validate the specific failure modes in the table above, not just the "everything is down" scenario, since partial degradation is actually the more common real-world case.
- Game days with production read-only traffic: for teams mature enough, briefly redirect a small, monitored slice of real read traffic to the secondary region during a drill window, which is the only way to catch problems that only appear under real production load and data shapes, not synthetic data.
Worked example
A team schedules a quarterly failover drill: fail the SQL failover group to the secondary region, confirm Front Door routes traffic there, run a smoke-test checkout, then fail back. The first drill takes 40 minutes end to end and surfaces that the secondary region's App Service had a stale app setting (an API key that had been rotated in the primary region six months earlier but never updated in the secondary, because nobody's deployment pipeline touched the passive region). That's exactly the kind of defect a tabletop review of the architecture diagram would never catch, because the diagram is correct; only the live secondary environment was wrong. After fixing it and adding the secondary region's settings to the same deployment pipeline as the primary (so drift like this can't recur), the next quarter's drill completes in 11 minutes with no surprises, and that 11 minutes is now the team's real, evidence-based RTO instead of an estimate.
Trade-offs and pitfalls
The most common failure in DR programs isn't the architecture, it's that the rehearsal never actually happens because "we can't risk touching production," which guarantees the runbook is wrong by the time it's needed for real. The mitigation is exactly the blue/green pattern above: rehearse against an isolated or drilled-into-production-carefully environment, not never. The second pitfall is drilling only the full-region-down scenario because it's the most dramatic, while partial degradations (one dependent service failing, not the whole region) are statistically more common and often demand a different, more surgical response than "fail everything over." A team that has only ever rehearsed the dramatic, whole-region scenario tends to freeze or over-react the first time the real page is for something narrower, like one dependency degrading while the rest of the region is healthy, because the rehearsed muscle memory doesn't match the actual failure shape in front of them.
You inherited a large monolithic Terraform codebase that manages hundreds of Azure resources across multiple subscriptions. Propose a migration plan to modularize the code into reusable modules, implement remote state with locking, adopt a module registry, and integrate with CI/CD. Describe steps to avoid accidental resource recreation during refactoring and how to stage the migration with minimal disruption.
Sample Answer
Direct answer
Modularize by extracting behind a stable interface, not by refactoring in place: write each new module so its planned resource addresses match what Terraform already tracks in state for that resource, then use terraform state mv to relocate the existing resources into the new module's state paths without touching the real infrastructure at all. The single rule that prevents accidental recreation is checking terraform plan shows zero create/destroy actions after every state move, only address changes; if a plan ever shows a resource being destroyed and recreated during this migration, stop, because that's real infrastructure being torn down, not a refactor.
Migration plan
- Stop the bleeding first: remote state with locking, before touching modularization. If the monolith isn't already on remote state (Azure Storage backend with a lease-based lock), migrate to that first, in isolation, as its own change. This is the highest-leverage single step, since it's what makes safe concurrent work (multiple engineers, or a later CI pipeline) possible at all, and it carries zero resource-recreation risk since it only moves state storage location, not resource addresses.
- Establish a module boundary by domain, not by resource type. Group resources the way the organization actually reasons about them (e.g., "the networking module," "the AKS module," "the shared Key Vault module"), matching subscription/resource-group boundaries where they already exist, rather than an abstract "one module per resource type" scheme that doesn't map to how anyone will actually use or reason about it later.
- For each module, in order of lowest risk first:
- Write the new module with resource blocks that, when planned, will produce the exact same resource addresses and arguments Terraform already has in state (same names, same
for_each/countkeys if used), which requires reading the current state (terraform state list,terraform show) as the source of truth, not the old monolithic.tffiles, since those can have drifted from what's actually deployed. - Run
terraform state mv 'module_root.resource_type.name' 'module.new_module_name.resource_type.name'for each resource (or-dry-runfirst, always) to relocate it in state. - Immediately run
terraform planand confirm it shows no changes (or only genuinely intended changes, kept as a separate, explicit step, never bundled into the same plan as a state move). Any create/destroy pair here means the new module's resource definition doesn't actually match what's in state, and needs fixing before proceeding, not overriding with-targetor forcing through. - Only after the plan is clean, commit the new module and the updated root configuration together, so the repository's history reflects "this was purely a state reorganization" as one atomic, reviewable change.
- Write the new module with resource blocks that, when planned, will produce the exact same resource addresses and arguments Terraform already has in state (same names, same
- Adopt a module registry once a module is used more than once, not before; a private registry (Terraform Cloud/Enterprise's registry, or a Git-tag-based source reference as a lighter-weight interim step) matters once you're versioning a module independently of the root configuration that consumes it, which is premature for a module still being extracted for the first time.
- Integrate with CI/CD incrementally, module by module, running
planon every PR against the affected module's state, and requiring a human review of the plan output (not just an automated apply) for the first several migrations, until the team has confidence the state-move process is being applied correctly and consistently.
Worked example: avoiding accidental recreation
The concrete failure this guards against: an engineer extracts a virtual network resource into a new networking module but writes the new resource block with a slightly different for_each key expression than the original (say, keying by list index in the old code versus a named map key in the new module). Terraform sees this as a different resource identity entirely, and terraform plan will show it as destroy-then-create, not a rename, because from Terraform's perspective the address changed. The moment plan shows that, before ever running apply, is where the mistake is caught: the fix is either to match the original for_each/count scheme exactly in the new module (preferred, since changing key schemes on live infrastructure is a separate, deliberate decision to make later, not a side effect of a refactor), or to add explicit moved blocks (Terraform's declarative alternative to imperative state mv, which documents the old-to-new address mapping directly in code and is reviewable in a pull request) if the key scheme genuinely needs to change as part of this work.
Trade-offs and pitfalls
The most damaging mistake is treating "the code looks cleaner now" as sufficient validation and skipping the zero-diff plan check before applying; Terraform will happily destroy and recreate a resource if the address or a force-new argument changed, often with no warning beyond the plan output itself, which is exactly why that plan output has to be read carefully every single time, not skimmed. The second common mistake is doing the full migration in one large PR across every module at once, which makes a mistake in one module hard to isolate and revert independently from the rest; staging the migration module by module, each with its own clean-plan checkpoint, keeps blast radius small and keeps rollback (reverting one module's state moves) actually feasible.
Describe the authentication flow when an Azure Function on a Consumption plan uses its system-assigned managed identity to access a secret in Key Vault. Cover token acquisition from the Instance Metadata Service (IMDS), token caching/refresh behavior, and common failure modes such as network restrictions or insufficient RBAC permissions.
Sample Answer
Direct answer
A worthwhile correction to the premise first: on a Consumption-plan Function, the token is not actually fetched from the raw platform Instance Metadata Service (IMDS, 169.254.169.254) the way an IaaS VM or VM Scale Set would; App Service and Functions expose their own local token endpoint (the IDENTITY_ENDPOINT/IDENTITY_HEADER environment variables, sometimes called the "App Service MSI extension"), which is a different mechanism serving the same purpose. Knowing that distinction is itself a senior-level signal, since the two failure modes (a VNet [Virtual Network, Azure's private network boundary] blocking outbound to IMDS's link-local address versus a missing App Service environment variable) are different problems with different fixes.
The actual flow
- Environment variables, set automatically when the identity is enabled:
IDENTITY_ENDPOINT(a URL likehttp://127.0.0.1:<port>/msi/token, local to the sandbox the Function runs in) andIDENTITY_HEADER(a rotating secret value used to authenticate the local call and mitigate server-side request forgery against that local endpoint). - Token request: the Azure Identity SDK (or a raw HTTP client) makes a
GETtoIDENTITY_ENDPOINTwith the resource URI to get a token for (https://vault.azure.netfor Key Vault), theapi-versionquery parameter (2019-08-01), and theX-IDENTITY-HEADERheader set to the value ofIDENTITY_HEADER. - What answers that request: the App Service/Functions host's local identity service (not Key Vault, not Entra ID directly) which itself holds a certificate or exchanges with Entra ID (Microsoft's cloud identity service, formerly Azure AD) on the platform's behalf, and returns a bearer token scoped to the requested resource, along with an
expires_ontimestamp. - Using the token: the caller (typically the Azure Identity SDK's
SecretClient, not hand-rolled code) attaches the token as aBearerheader on the actual call to Key Vault's REST API to read the secret. - Authorization check at Key Vault: Key Vault checks whether the token's principal (the Function's managed identity's object ID) has been granted an RBAC (Role-Based Access Control) role (or, on the older access-policy model, an access policy) allowing
get/liston secrets. This is a separate check from "the token was issued successfully"; a perfectly valid token for a principal with no grant on this vault gets a 403, not a 401.
sequenceDiagram
participant F as Function code
participant L as Local identity endpoint (IDENTITY_ENDPOINT)
participant KV as Key Vault
F->>L: GET ?resource=vault.azure.net&api-version=2019-08-01, X-IDENTITY-HEADER
L-->>F: access_token, expires_on
F->>KV: GET secret, Authorization: Bearer <token>
KV-->>F: secret value (if RBAC grants get/list)
Token caching and refresh
The Azure Identity SDK's credential objects cache the token in memory for the life of the process and refresh proactively, typically requesting a new one a few minutes before the cached one expires, rather than on every single call. Two consequences worth knowing: first, a Consumption-plan Function that goes cold and gets a fresh instance also gets a fresh in-memory cache, so cold starts always pay the token-acquisition round trip; second, if an admin changes the managed identity's role assignment (grants or revokes access), the token the app already holds is still valid until it expires, since revocation doesn't invalidate already-issued tokens, and the platform's group/role membership cache for managed identities can itself take up to roughly 24 hours to reflect the change even for a brand-new token request in some cases, so "I just added the role assignment and it still fails" for a short window afterward is expected behavior, not a bug.
Common failure modes
- Missing or absent
IDENTITY_ENDPOINT/IDENTITY_HEADER: happens when running the same code locally (outside Azure) withoutlocal.settings.jsonproviding an alternative credential path, or when the managed identity was never actually enabled on the Function App; the Azure Identity SDK'sDefaultAzureCredentialwill fail through its whole credential chain and surface a fairly generic "no credential available" error, which is easy to misdiagnose as a Key Vault problem when it's actually an identity configuration problem. - Network restrictions: if the Function App has VNet integration and a route that forces all outbound traffic through an NVA (Network Virtual Appliance)/firewall or a restrictive NSG (Network Security Group, a per-subnet/NIC firewall rule set), calls to Key Vault's public endpoint (or, if Key Vault has a Private Endpoint, calls that aren't routed correctly to it) can time out; this looks identical to an RBAC failure from the error message alone (both surface as the SDK failing to get the secret) unless you check whether the failure happens before or after a token was actually issued.
- Insufficient RBAC: a valid token but no
Key Vault Secrets User(or equivalent) role assignment on the vault (or the specific secret, if using more granular access controls) for that identity's object ID; this returns a 403 from Key Vault itself, not an SDK-level credential error, which is the fastest way to tell it apart from the two failure modes above. - Wrong identity used: on a Function App with both a system-assigned and one or more user-assigned identities,
DefaultAzureCredentialwithout an explicit client ID can pick the wrong one (or fail ambiguously); when more than one identity exists, always specify which one explicitly (ManagedIdentityCredential(client_id=...)) rather than relying on the default resolution.
Trade-offs and pitfalls
The most common misdiagnosis is treating every "can't get the secret" failure as an RBAC problem and re-granting roles repeatedly, when the actual cause is a network path issue or a missing identity configuration; check whether a token was even issued (App Service diagnostic logs, or a deliberate try/except around just the credential acquisition step versus the Key Vault call) before assuming the permission model is wrong. The role-membership propagation delay is also a frequent source of false alarms right after granting access; if it's been minutes, not hours, since the role assignment, the fix might already be correct and just not yet visible everywhere.
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.