Managed Identity for Passwordless Azure Resource Access
Fast recall
Quick revision
Core answer
Security awareness — whether the candidate understands credential management best practices and Azure's identity model.
Creating a service principal with a client secret for every application instead of using Managed Identity, leading to credential rotation overhead and secret sprawl.
Distinguish system-assigned vs. user-assigned identities, explain workload identity for AKS pods, and mention how DefaultAzureCredential works locally vs. in Azure.
Interview-ready guide
Interview answer
Managed Identity is Azure's solution to the credential management problem — instead of storing a client secret or storage account key in your application, Azure provides an identity to the compute resource that the application uses to authenticate to other Azure services.
System-assigned vs user-assigned
- System-assigned Managed Identity is tied to the lifecycle of one resource — enabling it on an App Service creates an identity with the same name; deleting the App Service deletes the identity
- User-assigned Managed Identity is an independent resource — you create it separately, assign it to one or more compute resources, and it persists when any individual resource is deleted; the right choice when multiple services share the same identity or the identity outlives the compute resource
How Spring Boot uses it
- The Azure Identity SDK's
DefaultAzureCredentialautomatically detects and uses the Managed Identity when running on Azure — which meansBlobServiceClientBuilder().credential(new DefaultAzureCredential()).buildClient()works without any credential configuration - Spring Cloud Azure starters use
DefaultAzureCredentialby default — no client secret in application.properties for Key Vault, Service Bus, or Blob Storage
RBAC — assigning permissions to the identity
- Grant the Managed Identity the appropriate RBAC role on the target resource:
Storage Blob Data Contributorfor read/write on a storage account;Service Bus Data Senderfor publishing to Service Bus - RBAC roles on Azure resources are more fine-grained than a storage account key — a key grants full access; a role can grant read-only or write-only access to specific containers or queues
Local development with `DefaultAzureCredential`
DefaultAzureCredentialfalls back to Azure CLI credentials (az login) for local development — the same code path works locally and in production; no separate local credential configuration needed
Managed Identity for Passwordless Azure Resource Access
Direct Answer
Managed Identity is an Azure AD identity automatically managed by Azure for a resource (VM, App Service, AKS pod). It eliminates credentials in code — you use DefaultAzureCredential in the Azure SDK, and Azure handles token acquisition using the resource's identity.
Common Mistakes & Pitfalls
Creating a service principal with a client secret for every application instead of using Managed Identity, leading to credential rotation overhead and secret sprawl.
Check your understanding
Answer these without looking back at the article.
- What is the difference between system-assigned and user-assigned Managed Identity?
- How does AKS Workload Identity differ from node-level Managed Identity?
- How do you test Managed Identity locally during Spring Boot development?
Related interview prep categories
1Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.