exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 4 question 27 discussion

Actual exam question from Microsoft's AZ-204
Question #: 27
Topic #: 4
[All AZ-204 Questions]

DRAG DROP -
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 appropriate code segments to the correct location. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
NOTE: Each correct selection is worth one point.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: SecretClient -

Box 2: DefaultAzureCredential -
In below example, the name of your key vault is expanded to the key vault URI, in the format "https://<your-key-vault-name>.vault.azure.net". This example is using 'DefaultAzureCredential()' class from Azure Identity Library, which allows to use the same code across different environments with different options to provide identity. string keyVaultName = Environment.GetEnvironmentVariable("KEY_VAULT_NAME"); var kvUri = "https://" + keyVaultName + ".vault.azure.net"; var client = new SecretClient(new Uri(kvUri), new DefaultAzureCredential());
Reference:
https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-net

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
mlantonis
Highly Voted 2 years, 11 months ago
Answer is correct. string keyVaultName = Environment.GetEnvironmentVariable("KEY_VAULT_NAME"); var kvUri = "https://" + keyVaultName + ".vault.azure.net"; var client = new SecretClient(new Uri(kvUri), new DefaultAzureCredential()); Box 1: SecretClient Box 2: DefaultAzureCredential Reference: https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-net
upvoted 79 times
Esward
1 year, 3 months ago
Agreed
upvoted 1 times
...
SachinV
5 months, 1 week ago
Agreed looks correct, in Nov182023, scored 962
upvoted 2 times
...
...
oescm
Highly Voted 2 years, 2 months ago
Got this one 02/2022. Went with most voted
upvoted 9 times
...
JH81
Most Recent 10 months ago
Got this on 6/28/2023 and passed with 850. Went with answer.
upvoted 2 times
...
Saluk_DE
1 year, 1 month ago
Question was on exam 2023-03-30
upvoted 1 times
...
mabdo
1 year, 2 months ago
on exam 02/23
upvoted 1 times
...
kociuba
1 year, 4 months ago
got it on my exam 30-12-2022 score: 818
upvoted 3 times
adilkhan
1 year, 3 months ago
are all these questions enough to pass the exam?
upvoted 2 times
...
...
OPT_001122
1 year, 4 months ago
1: SecretClient 2: DefaultAzureCredential
upvoted 2 times
...
vcfvct
1 year, 6 months ago
Had this question on 10/21/22
upvoted 2 times
...
Eltooth
1 year, 10 months ago
Secret Default
upvoted 2 times
...
edengoforit
2 years, 4 months ago
DefaultAzureCredential DefaultAzureCredential is appropriate for most scenarios where the application is intended to run in the Azure Cloud. This is because the DefaultAzureCredential determines the appropriate credential type based of the environment it is executing in. It supports authenticating both as a service principal or managed identity, and can be configured so that it will work both in a local development environment or when deployed to the cloud. The DefaultAzureCredential will first attempt to authenticate using credentials provided in the environment. In a development environment you can authenticate as a service principal with the DefaultAzureCredential by providing configuration in environment variables as described in the next section. If the environment configuration is not present or incomplete, the DefaultAzureCredential will then determine if a managed identity is available in the current environment. Authenticating as a managed identity requires no configuration, but does require platform support. See the managed identity documentation for more details on this.
upvoted 8 times
...
ADJ85
2 years, 8 months ago
Correct
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago