AZ-204 · Question #487
Drag and Drop Question You are developing an Azure solution. You need to develop code to access a secret stored in Azure Key Vault. How should you complete the code segment? To answer, drag the…
The correct answer is SecretClient; ClientSecretCredential; DefaultAzureCredential. To access a secret in Azure Key Vault, you first instantiate a SecretClient (the class that provides methods to interact with Key Vault secrets), then provide the vault URI along with a credential object. DefaultAzureCredential is the recommended credential type as it…
Question
Exhibit
Answer Area
Drag items
Correct arrangement
- SecretClient
- ClientSecretCredential
- DefaultAzureCredential
Explanation
To access a secret in Azure Key Vault, you first instantiate a SecretClient (the class that provides methods to interact with Key Vault secrets), then provide the vault URI along with a credential object. DefaultAzureCredential is the recommended credential type as it automatically tries multiple authentication methods (environment variables, managed identity, Visual Studio, Azure CLI, etc.) in sequence, making it ideal for both local development and production Azure environments. ClientSecretCredential is a valid credential class but requires explicit client ID, tenant ID, and client secret parameters - it is not the preferred modern approach when DefaultAzureCredential can handle the authentication chain automatically.
Topics
Community Discussion
No community discussion yet for this question.
