Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 4 question 26 discussion

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

DRAG DROP -
Contoso, Ltd. provides an API to customers by using Azure API Management (APIM). The API authorizes users with a JWT token.
You must implement response caching for the APIM gateway. The caching mechanism must detect the user ID of the client that accesses data for a given location and cache the response for that user ID.
You need to add the following policies to the policies file:
✑ a set-variable policy to store the detected user identity
✑ a cache-lookup-value policy
✑ a cache-store-value policy
✑ a find-and-replace policy to update the response body with the user profile information
To which policy section should you add the policies? To answer, drag the appropriate sections to the correct policies. Each section 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: Inbound.
A set-variable policy to store the detected user identity.
Example:
<policies>
<inbound>
<!-- How you determine user identity is application dependent -->
<set-variable
name="enduserid"
value="@(context.Request.Headers.GetValueOrDefault("Authorization","").Split(' ')[1].AsJwt()?.Subject)" />

Box 2: Inbound -

A cache-lookup-value policy -
Example:
<inbound>
<base />
<cache-lookup vary-by-developer="true | false" vary-by-developer-groups="true | false" downstream-caching-type="none | private | public" must- revalidate="true | false">
<vary-by-query-parameter>parameter name</vary-by-query-parameter> <!-- optional, can repeated several times -->
</cache-lookup>
</inbound>

Box 3: Outbound -
A cache-store-value policy.
Example:
<outbound>
<base />
<cache-store duration="3600" />
</outbound>

Box 4: Outbound -
A find-and-replace policy to update the response body with the user profile information.
Example:
<outbound>
<!-- Update response body with user profile-->
<find-and-replace
from='"$userprofile$"'
to="@((string)context.Variables["userprofile"])" />
<base />
</outbound>
Reference:
https://docs.microsoft.com/en-us/azure/api-management/api-management-caching-policies https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Ave
Highly Voted 4 years ago
Inbound Inbound Inbound Outbound
upvoted 181 times
1CY1
4 months, 2 weeks ago
Inbound, Inbound, Outbound, Outbound. Cache store S/B outbound. https://learn.microsoft.com/en-us/azure/api-management/cache-store-policy#examples
upvoted 1 times
NetoZee
2 weeks, 3 days ago
it's wrong cache-store is diferente cache-store-value. you can see it here https://learn.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key
upvoted 1 times
...
...
russellg
4 years ago
how would you cache the value on an inbound request? yo don’t have the value yet!
upvoted 12 times
Tommy202024
3 years, 10 months ago
Look at this example https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#architecture
upvoted 9 times
[Removed]
3 years, 10 months ago
The example you provided is for caching user information from the incoming request. The question is about storing the outgoing response. So Inbound, Inbound, Outbound, Outbound is correct.
upvoted 27 times
pac1311
3 years, 9 months ago
Think it's great that he disproved his own claim :).
upvoted 6 times
...
...
...
...
Azprep
2 years, 10 months ago
https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key
upvoted 4 times
Azprep
2 years, 7 months ago
Answers are Inbound Inbound Inbound Outbound
upvoted 3 times
...
...
SachinV
1 year ago
looks correct, in Nov182023, scored 962
upvoted 6 times
Ciupaz
11 months, 1 week ago
Best score ever, compliments.
upvoted 4 times
...
...
...
taupokk
Highly Voted 4 years ago
The answer provided is correct.
upvoted 37 times
robertob
4 years ago
yes is correct: <policies> <inbound> <base /> <cache-lookup vary-by-developer="false" vary-by-developer-groups="false" downstream-caching-type="none" must-revalidate="true" caching-type="internal" > <vary-by-query-parameter>version</vary-by-query-parameter> </cache-lookup> </inbound> <outbound> <cache-store duration="seconds" /> <base /> </outbound> </policies>
upvoted 8 times
cbn
3 years, 9 months ago
This is not cache-store-value. However the answer seems correct as per @profesorklaus answer below.
upvoted 4 times
...
...
...
cmmr
Most Recent 2 days, 2 hours ago
the discussion on whether the 3rd option is inbound or outbound is valid since the cache-store-value can be used in both sections. In this case we don't want to store the result but rather which user the request is from without JWT parsing again. This saves computational effort
upvoted 1 times
...
Sinae
1 month ago
Answer should be Inbound, Inbound, Inbound, Outbound.
upvoted 1 times
...
FeriAZ
10 months, 1 week ago
Set-Variable Policy Purpose: To store the detected user identity, which is likely extracted from the JWT token. Placement: Inbound. You need to extract and store the user ID as the request comes in, before any caching logic is applied. Cache-Lookup-Value Policy Purpose: To check if there's a cached response available for the specific user ID. Placement: Inbound. This should happen early in the request processing to determine if a cached response can be used instead of forwarding the request to the backend. Cache-Store-Value Policy Purpose: To store the response in the cache associated with the specific user ID. Placement: Outbound. After the backend service generates a response, this policy stores it in the cache before sending it to the client. Find-and-Replace Policy Purpose: To update the response body with the user profile information. Placement: Outbound. This modification should be done after the backend service has generated the response and just before it's sent back to the client.
upvoted 5 times
...
manopeydakon
10 months, 1 week ago
The cache-store-value policy in Azure API Management (APIM) is used in the inbound policy section. This policy is typically applied before the request reaches the backend service, allowing you to cache the response based on the specified conditions or keys. In the context of caching, the inbound policy section refers to policies that are executed before the request is sent to the backend, and the outbound policy section refers to policies that are executed before the response is sent back to the client. So, when you use cache-store-value to cache a response, you want to do this on the inbound side, ensuring that the caching occurs before the request is forwarded to the backend service.
upvoted 1 times
...
11_NickName_11
11 months, 4 weeks ago
Inbound Inbound Inbound Outbound https://learn.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#fragment-caching
upvoted 1 times
...
dddddd111
1 year ago
Inbound Inbound Outbound Outbound Reference: https://learn.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#architecture
upvoted 1 times
dddddd111
1 year ago
Sorry, the 3rd one is Inbound.
upvoted 2 times
...
...
JH81
1 year, 4 months ago
Got this on 6/28/2023 and passed with 850. Went with highly voted answer.
upvoted 4 times
...
NombreFalso
1 year, 9 months ago
>> The caching mechanism must detect the user ID of the client that accesses data for a given location and *cache the response for that user ID.* Thus cache store should be outbound guys
upvoted 3 times
...
Esward
1 year, 10 months ago
Given answers are correct. Inbound Inbound outbound->in general the response come in oubound section outbound https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-cache
upvoted 4 times
...
kkop
1 year, 11 months ago
Here is Answer:https://learn.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#architecture inbound, inbound, inbound outbound
upvoted 5 times
...
elequiel
2 years, 1 month ago
Got it in exam 20/10/2022
upvoted 3 times
...
Knightie
2 years, 3 months ago
see the xml tag of inbound and outbound https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key
upvoted 1 times
...
Lucky_me
2 years, 5 months ago
<policies> <inbound> <base /> <cache-lookup vary-by-developer="false" vary-by-developer-groups="false" downstream-caching-type="none" must-revalidate="true" caching-type="internal" > <vary-by-query-parameter>version</vary-by-query-parameter> </cache-lookup> </inbound> <outbound> <cache-store duration="seconds" /> <base /> </outbound> </policies>
upvoted 1 times
...
vavra
2 years, 5 months ago
I think it's B, because of this: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Integrated-Windows-Authentication Federated users only, i.e. those created in an Active Directory and backed by Azure Active Directory. Users created directly in AAD, without AD backing - managed users - cannot use this auth flow. This limitation does not affect the Username/Password flow.
upvoted 1 times
kjfdzkkbsm
2 years, 5 months ago
Your'e at the wrong question, mate
upvoted 8 times
...
...
Azprep
2 years, 7 months ago
Inbound Inbound Inbound Outbound
upvoted 3 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 ...