1.1 Manage security controls for identity and access
1.You have an Azure subscription containing a key vault named KV1. You have a virtual machine named VM1. You need to enable VM1 to authenticate to KV1 to retrieve secrets without storing credentials in the code running on VM1. What should you do first?
- A.Enable a system-assigned managed identity on VM1.
- B.Create a service principal in Microsoft Entra ID for VM1.
- C.Create an access policy in KV1 for the VM1 local administrator.
- D.Store the tenant ID and client secret in the VM1 environment variables.
Show answer & explanation
Correct answer: A — Enable a system-assigned managed identity on VM1.
- A. Correct. Enabling a system-assigned managed identity gives the VM an identity within Microsoft Entra ID (formerly Azure AD). This identity can be used to authenticate to Azure Key Vault and other services without needing to manage or store credentials (like client secrets) in your code or configuration files.
- B. Incorrect. While a service principal is an identity used by applications, creating one manually typically requires generating and managing a Client ID and Secret (or certificate). Using these would require storing credentials in the application or environment, which violates the scenario's requirement.
- C. Incorrect. Azure Key Vault access policies are granted to Microsoft Entra ID identities (users, groups, service principals, or managed identities). Local administrator accounts exist only on the VM's operating system and are not recognized by the Key Vault control plane for access policies.
- D. Incorrect. Storing tenant IDs and client secrets in environment variables is a form of credential storage. The requirement explicitly asks to avoid storing credentials. Managed identities eliminate the need for this entirely.