Microsoft Azure Developer Associate AZ-204 Practice Question

You develop a C# Azure Function that runs on a Linux Consumption plan. A Storage account connection string is stored as the secret "StorageConn" in Azure Key Vault. At runtime the function must read the secret without storing any client secrets, certificates, or other credentials in code or settings. Which code fragment should you use?

  • var credential = new ClientSecretCredential(tenantId, clientId, clientSecret); var client = new SecretClient(new Uri(vaultUrl), credential); string connString = (await client.GetSecretAsync("StorageConn")).Value;

  • var token = Environment.GetEnvironmentVariable("ACCESS_TOKEN"); var client = new SecretClient(new Uri(vaultUrl), new TokenCredential(token)); string connString = (await client.GetSecretAsync("StorageConn")).Value;

  • var client = new SecretClient(new Uri(vaultUrl), new DefaultAzureCredential()); KeyVaultSecret secret = await client.GetSecretAsync("StorageConn"); string connString = secret.Value;

  • During CI/CD, run "az keyvault secret show" to export the secret and write it to an APPSETTING named STORAGE_CONN; read Environment.GetEnvironmentVariable("STORAGE_CONN") at runtime.

Microsoft Azure Developer Associate AZ-204
Implement Azure security
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot