Microsoft Azure Developer Associate AZ-204 Practice Question

Your ASP.NET Core web API uses an X.509 certificate whose private key is stored in an Azure Key Vault certificate named "SigningCert". The API must load the certificate at startup so that it can create an X509Certificate2 object that includes the private key.

You add the Azure.Identity package and create the following code:

var vaultUri = new Uri(Environment.GetEnvironmentVariable("KEYVAULT_URI"));
var credential = new DefaultAzureCredential();

// TODO: add code here to load the certificate including the private key

Which code fragment should you use to meet the requirement?

  • var client = new KeyClient(vaultUri, credential); var key = await client.GetKeyAsync("SigningCert"); var cert = new X509Certificate2(key.Value.Key.N);

  • var client = new CertificateClient(vaultUri, credential); var pfx = await client.DownloadCertificateAsync("SigningCert"); var cert = new X509Certificate2(pfx.Value);

  • var client = new SecretClient(vaultUri, credential); var secret = await client.GetSecretAsync("SigningCert"); var cert = new X509Certificate2(Convert.FromBase64String(secret.Value.Value));

  • var client = new SecretClient(vaultUri, credential); var cert = await client.DownloadCertificateAsync("SigningCert");

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