exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 4 question 57 discussion

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

HOTSPOT -

You develop and deploy the following staticwebapp.config.json file to the app_location value specified in the workflow file of an Azure Static Web app:



For each of the following statements, select Yes if the statement is true. Otherwise, select No.

NOTE: Each correct selection is worth one point.

Show Suggested Answer Hide Answer
Suggested Answer:

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
drkpnsh
Highly Voted 1 year, 8 months ago
It should be: 1. N In the example written here: https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#example-configuration-file - If you go to the login page, you redirect to Github, just like in the question. - If the request got a 401 error (Unauthorized), it redirects the user to the login route (with 302 response), which then redirects to the GitHub login. But in this question, if you check what happens when the request got a 401 error (Unauthorized), it redirects to the AAD route (with 302 response), not to Github. So this part of the question and the example are different. 2. Y That part of the question seems the same as the example above. A non-existent file in the /images/ folder -> A 404 error. 3. Y That part of the question seems the same as the example above. GET requests from authenticated users in the registeredusers role are sent to the API. Authenticated users not in the registeredusers role and unauthenticated users are served a 401 error. 4. N It overrides the 401 error to the 302 and redirects the user to the AAD URL.
upvoted 24 times
overhill
5 months, 3 weeks ago
Thanks for the help
upvoted 1 times
...
...
mabdo
Highly Voted 2 years, 2 months ago
1) Y. login with github 2 ) Y. true because it is excluded from returning index.html in navigation fallback, so the other option is a 404 not found 3) Y. straight forward from first routes object 4) N. from https://learn.microsoft.com/en-us/azure/static-web-apps/configuration 401 is for requesting when unauthenticated but here are you are authenticated and so the error should be 403, because you are authenticated but don't have authorization ( due to not having the registeredusers role)
upvoted 20 times
fuji36850
11 months, 4 weeks ago
Unauthorized(401) are redirected to /.auth/login/aad, not github, also you don't get 404 error, instead you get page 404.html
upvoted 8 times
...
oCaio
1 year, 8 months ago
Initially I thought YNYN (since only 3 types of images are excluded in /images/) because: https://learn.microsoft.com/en-us/azure/static-web-apps/configuration "In the following example, requests for certain routes in the /images folder and all files in the /css folder are excluded from returning the fallback file." JSON { "navigationFallback": { "rewrite": "/index.html", "exclude": ["/images/*.{png,jpg,gif}", "/css/*"] } } However I changed to YYYN, because of https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#example-configuration-file So this depends on which Microsoft article they are trying to test us.
upvoted 2 times
...
SachinV
1 year, 5 months ago
Agreed looks correct, in Nov182023, scored 962
upvoted 4 times
...
aboezebal
2 years, 1 month ago
1 should be no. Unauthenticated users get a 401 - Unauthorized response and are redirected by the responseOverrides to "/.auth/login/aad". I believe that is not Github. You will only be redirected to GitHub if the an unauthenticated user routes to "/login".
upvoted 30 times
...
...
Vegetta95
Most Recent 3 months ago
Answers are in documentation. It's 1 to 1 scenario from docs: 1. Yes (1 to 1 docs) 2. Yes (1 to 1 docs) 3. App allows "registeredusers" to open urls under /api/* but it does not redirect registered users there 4. Yes (1 to 1 docs) https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#example-configuration-file
upvoted 1 times
...
Vichu_1607
6 months ago
Unauthenticated users are challenged to authenticate with GitHub: Incorrect A non-existent file in the /images/ folder will generate a 404 response code: Correct HTTP GET method requests from authenticated users in the role named registeredusers are sent to the API folder: Correct Authenticated users that are not in the role named registeredusers and unauthenticated users are served a 401 HTTP error when accessing the API folder: Incorrect
upvoted 1 times
...
examprepau
6 months, 1 week ago
3. N ,Qustion does not specify request to api/, only user request to api/ with GetMethod and in registeredUser role will be set to api request to any other route will not be sent to api even if in registeredUser role
upvoted 1 times
...
gebpt
10 months, 1 week ago
1) NO - redirect to Ada 2) YES - redirect doesn't change response status 3) YES 4) NO - redirected to aad
upvoted 1 times
...
fuji36850
11 months, 4 weeks ago
Original answer seems correct. Remember that unautorized = getting 401. Also remember, that 404 error is not the same as page named 404.html
upvoted 2 times
...
Emil_Topics
1 year, 5 months ago
I don't get why everybody states that the third option should be yes. How I read the statement is that users in that role automaticly get redirected to the API path. But that is not what the configuration states. Only that users in that role have access to it. Not that they are redirected.
upvoted 4 times
oskx2
1 year, 1 month ago
Agreed. The users are NOT sent to the API folder. They are ALLOWED to the api folder.
upvoted 1 times
...
...
JH81
1 year, 10 months ago
Got this on 6/28/2023 and passed with 850. I went with Y,N,Y,N. No idea if that is correct.
upvoted 2 times
...
BikashKatwal
1 year, 10 months ago
https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#example-configuration-file I think based on the above config 1. Y - Unauthenticated users are challenged to authenticate with GitHub. 2. Y: An non-existent file in the /images/ folder results in a 404 error 3. Y: GET requests from authenticated users in the registeredusers role are sent to the API. 4. N: Authenticated users not in the administrator role and unauthenticated users are served a 401 error.
upvoted 2 times
...
nekkilodeon
2 years ago
N,Y,Y,N https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#example-configuration-file
upvoted 6 times
AndySmith
1 year, 6 months ago
Almost identical example from Microsoft with good explanation. No doubts about N Y Y N.
upvoted 1 times
...
...
adilkhan
2 years ago
N,Y,Y,N IS CORRECT
upvoted 4 times
...
DP_Bhatt
2 years ago
No - Unauthorized users receive a 401 response code, which subsequently redirects to "/.auth/login/aad" with a status code 302 (see responseOverrides). You will only be redirected to GitHub if the unauthenticated user routes to "/login". Yes - The files in the path "/images/*" with extensions png, jpg and gif are excluded from the fallback which means if the files with the mentioned extensions do not exist in the path, an 404 will be returned. The index.html fallback will be returned only if the file has an extension other than the excluded extensions. For example, if the file with name /images/xyz.svg will return index.html because the .svg extension is not excluded. But if the file is /images/unknown.jpg  and the file is not exist on the path will return 404. Yes -  No - In this case, if the user does not have registeredusers role, the 403 status code will be returned for the authenticated users.
upvoted 6 times
...
DP_Bhatt
2 years ago
No - Unauthorized users receive a 401 response code, which subsequently redirects to "/.auth/login/aad" with a status code 302 (see responseOverrides). You will only be redirected to GitHub if the unauthenticated user routes to "/login".Yes - The files in the path "/images/*" with extensions png, jpg and gif are excluded from the fallback which means if the files with the mentioned extensions do not exist in the path, an 404 will be returned. The index.html fallback will be returned only if the file has an extension other than the excluded extensions. For example, if the file with name /images/xyz.svg will return index.html because the .svg extension is not excluded. But if the file is /images/unknown.jpg  and the file is not exist on the path will return 404. Yes -  No - In this case, if the user does not have registeredusers role, the 403 status code will be returned for the authenticated users.
upvoted 2 times
...
Kluk_Kluk
2 years, 1 month ago
I saw the same configuration in this link. All answers are Yes. https://learn.microsoft.com/en-us/azure/static-web-apps/configuration
upvoted 2 times
courtguard
2 years, 1 month ago
the last one is No, as per your link. If they are not in role registeredusers they are served 403 error, and if they are unauthenticated they are redirected to /login
upvoted 1 times
...
...
erieri
2 years, 1 month ago
Haha, really different opinions about this one... really tricky, but I will giv it a try: 1) N . Unauthticated = 401 wich is redirected to .../login/aad (with 302 status). See aboezebal's comment. 2) Y. See rpatsev's comment below. Always returns 404 even though some are rewritten with index.html 3) Y. 4) N. Authenticated users but not in correct role = 403. Unautheticated user, see question.
upvoted 1 times
...
lixd
2 years, 1 month ago
Not sure 100% the answers, but all the cases are described and covered in https://learn.microsoft.com/en-us/azure/static-web-apps/configuration#example-configuration-file So, the answers with comments from the web-site 1. (Y ) /login : Unauthenticated users are challenged to authenticate with GitHub. 2. (Y) An non-existent file in the /images/ folder : A 404 error. 3. (Y) /api/admin : GET requests from authenticated users in the registeredusers role are sent to the API. 4. (Y) /api/admin : POST, PUT, PATCH, and DELETE requests from authenticated users in the administrator role are sent to the API. Authenticated users not in the administrator role and unauthenticated users are served a 401 error.
upvoted 2 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