Microsoft Azure Developer Associate AZ-204 Practice Question
During debugging of an Azure Function written in C#, you notice that the following code loads jwtSigningCert without its private key:
var client = new CertificateClient(new Uri(vaultUrl), new DefaultAzureCredential());
var cert = await client.GetCertificateAsync("jwtSigningCert");
var x509 = new X509Certificate2(cert.Value.Cer);
The certificate was imported into Azure Key Vault together with its private key. Which change will ensure that the private key is included when the certificate is loaded?
Call GetCertificateVersionAsync with the latest version instead of GetCertificateAsync; the private key will be included automatically.
Use a SecretClient, call GetSecretAsync("jwtSigningCert"), convert the returned base-64 string to bytes, and create the X509Certificate2 from those bytes.
Give the function app the Key Vault Crypto Officer role instead of Key Vault Secrets User; the existing code will then retrieve the private key.
Call GetCertificatePolicyAsync and set the policy's content type to Pkcs12 before calling GetCertificateAsync so that the SDK returns the private key.
A certificate stored in Azure Key Vault is exposed in three forms: as a certificate, as a key, and as a secret. The CertificateClient returns a public-key only representation (the CER bytes), so the resulting X509Certificate2 lacks the private key. Retrieving the certificate as a secret returns the base-64-encoded PFX package that contains both public and private keys. Therefore, switching to SecretClient and calling GetSecretAsync for the same name, then constructing the X509Certificate2 from the decoded secret value, provides the private key. The other options do not affect the payload that CertificateClient returns, nor do they cause the SDK to include the private key that is stored only in the secret object.
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 Azure Key Vault used for?
Open an interactive chat with Bash
What is the difference between CertificateClient and SecretClient in Azure?
Open an interactive chat with Bash
What is an X509Certificate2 in C#?
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 .