A single Azure virtual machine must read blobs from a storage account without storing any passwords, keys, or connection strings. The identity should be removed automatically if the VM is deleted. Which option should you use?
A system-assigned managed identity creates an Azure AD service principal that is directly tied to the VM's lifecycle; when the VM is deleted, the identity is automatically removed as well. Because it is inherently bound to that specific VM, you can grant it the Storage Blob Data Reader role on the storage account without ever storing a secret on the VM. The VM authenticates via the Azure Instance Metadata Service and receives an Azure AD access token to read blobs securely, with credential rotation handled automatically by the platform.
Why this answer
System-assigned managed identity is tied directly to the lifecycle of the Azure VM. When the VM is deleted, the identity is automatically removed. It allows the VM to authenticate to Azure Storage without storing any credentials, using Azure AD tokens obtained via the Azure Instance Metadata Service (IMDS).
Exam trap
The trap here is that candidates often confuse user-assigned managed identities with system-assigned ones, assuming user-assigned identities are also automatically deleted with the VM, when in fact they are independent resources that must be manually cleaned up.
Why the other options are wrong
Using a storage account access key requires storing the key in code or configuration, violating the requirement to avoid storing passwords, keys, or connection strings. It also does not automatically remove the identity when the VM is deleted.
A shared access signature (SAS) requires storing a token (key) in the application or configuration, violating the requirement to avoid storing passwords, keys, or connection strings. Additionally, SAS tokens are not automatically removed when the VM is deleted.
A user-assigned managed identity is not automatically deleted when the VM is deleted; it persists independently until explicitly removed. The question requires automatic removal with the VM, which only a system-assigned managed identity provides.
When would these options actually be correct?
A question that asks for the simplest method to authenticate to a storage account from a VM, with no restrictions on storing keys or automatic identity removal, would make the storage account access key correct.
A shared access signature would be correct when you need to grant time-limited, delegated access to a storage account for a client that does not support managed identities (e.g., an external application) and you can securely manage the token lifecycle outside the VM.
A user-assigned managed identity would be correct if the question required a single identity to be shared across multiple Azure resources (e.g., multiple VMs and a function app) that all need to access the same storage account, and the identity must remain available even after one VM is deleted.
Why candidates pick the wrong answer
Candidates may think the access key is the easiest and most familiar authentication method, overlooking the security and lifecycle management requirements specified in the question.
Candidates may think SAS eliminates the need for identity management because it provides token-based access without requiring a user or service principal, but they overlook the requirement to avoid storing secrets and the automatic cleanup condition.
Candidates may confuse user-assigned with system-assigned managed identities, assuming both are automatically deleted with the VM, or they may think user-assigned is more flexible and still meets the deletion requirement.