You are developing a C# application that runs on an Azure Virtual Machine (VM). The application uses the Azure.Identity library to authenticate to an Azure Key Vault using DefaultAzureCredential. Both a system-assigned managed identity and a user-assigned managed identity are enabled on the VM. The user-assigned managed identity is granted the Key Vault Secrets User role on the Key Vault, but the system-assigned managed identity has no permissions. When the application runs, it fails to retrieve secrets because DefaultAzureCredential attempts to authenticate using the system-assigned managed identity. You need to configure the environment so that DefaultAzureCredential uses the user-assigned managed identity without modifying the code that instantiates DefaultAzureCredential. Which of the following actions should you perform?
- Set the AZURE_CLIENT_ID environment variable on the Virtual Machine to the Client ID of the user-assigned managed identity.Answer
- BSet the AZURE_CLIENT_ID environment variable on the Virtual Machine to the Resource ID of the user-assigned managed identity.
- CSet the AZURE_TENANT_ID environment variable on the Virtual Machine to the Principal ID of the user-assigned managed identity.
- DCreate an Azure Key Vault access policy that grants the Get secret permission to the VM's system-assigned managed identity.