exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 4 question 35 discussion

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

HOTSPOT -
You are developing a web application that makes calls to the Microsoft Graph API. You register the application in the Azure portal and upload a valid X509 certificate.
You create an appsettings.json file containing the certificate name, client identifier for the application, and the tenant identifier of the Azure Active Directory (Azure
AD). You create a method named ReadCertificate to return the X509 certificate by name.
You need to implement code that acquires a token by using the certificate.
How should you complete the code segment? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: ConfidentialClientApplicationBuilder
Here's the code to instantiate the confidential client application with a client secret: app = ConfidentialClientApplicationBuilder.Create(config.ClientId)
.WithClientSecret(config.ClientSecret)
.WithAuthority(new Uri(config.Authority))
.Build();

Box 2: scopes -
After you've constructed a confidential client application, you can acquire a token for the app by calling AcquireTokenForClient, passing the scope, and optionally forcing a refresh of the token.
Sample code: result = await app.AcquireTokenForClient(scopes)
.ExecuteAsync();
Reference:
https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-app-configuration https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-acquire-token

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
aradice
Highly Voted 3 years, 5 months ago
correct https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-app-configuration?tabs=dotnet#instantiate-the-confidential-client-application-with-a-client-certificate https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-daemon-acquire-token?tabs=dotnet#acquiretokenforclient-api
upvoted 55 times
Esward
1 year, 10 months ago
Given answers are correct! agreed.
upvoted 2 times
...
...
MK22
Highly Voted 3 years, 4 months ago
Provided answer is correct.
upvoted 13 times
...
J_obando13
Most Recent 1 month ago
Got this in the exam today! May 15, 2025. Went most voted. 940/1000. 50 of 51 from examtopics. Cases Munson’s Pickles and Preserves Farm (7) and Fourth Coffee (3)
upvoted 1 times
...
bgbgvfvf
12 months ago
correct answer
upvoted 1 times
...
BaoNguyen2411
1 year, 4 months ago
got this question on 06-29-2023
upvoted 5 times
...
tmuras
1 year, 10 months ago
This question was on exam on 17/02/23.
upvoted 4 times
...
bertwin
2 years ago
Absolute correct
upvoted 1 times
...
TheExamMaster2020
2 years, 1 month ago
Did my exam on 15th November 2022. This question was on it.
upvoted 5 times
...
lugospod
2 years, 11 months ago
Got this one 01/2022. Went with most voted (to avoid writing answers again)
upvoted 9 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 ...