Microsoft Azure Developer Associate AZ-204 Practice Question
You deploy a .NET 6 Web API to Azure App Service. The API must read a database connection string that is stored as a secret in Azure Key Vault at runtime. A system-assigned managed identity is enabled for the App Service instance and granted access to the vault. Which authentication approach should you implement in the code to retrieve the secret without adding any credentials or configuration values to the application?
Create a ClientSecretCredential with the App Service application ID and a new client secret, then use it with SecretClient.
Configure EnvironmentCredential with the vault URL in an environment variable and use it to access Key Vault.
Instantiate SecretClient by passing the Key Vault URI and an instance of DefaultAzureCredential.
Authenticate with AzureCliCredential, then call SecretClient to get the secret.
DefaultAzureCredential automatically attempts several credential types in a fixed order. When the code runs inside an Azure-hosted service that has a managed identity enabled, DefaultAzureCredential detects the managed identity endpoint and acquires a token on behalf of the resource. By passing an instance of DefaultAzureCredential to SecretClient, the Web API can authenticate to Key Vault with its system-assigned managed identity and read the secret without storing client IDs, secrets, or other credentials. AzureCliCredential requires an interactive developer sign-in and is not suitable in production. ClientSecretCredential and EnvironmentCredential still require you to supply or configure sensitive values, defeating the goal of removing credentials from the application configuration.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is DefaultAzureCredential in Azure SDK?
Open an interactive chat with Bash
What does 'system-assigned managed identity' mean in Azure?
Open an interactive chat with Bash
How does SecretClient interact with Azure Key Vault?
Open an interactive chat with Bash
Microsoft Azure Developer Associate AZ-204
Implement Azure security
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .