exam questions

Exam AZ-203 All Questions

View all questions & answers for the AZ-203 exam

Exam AZ-203 topic 4 question 3 discussion

Actual exam question from Microsoft's AZ-203
Question #: 3
Topic #: 4
[All AZ-203 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: Explanation
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)" />
Etc.

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>
References:
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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Sam1101
Highly Voted 4 years, 10 months ago
1. Inbound 2. Inbound 3. Inbound 4. Outbound
upvoted 33 times
...
TaiH
Highly Voted 5 years, 3 months ago
#3: cache-store value should be inbound. Ref: https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key
upvoted 19 times
LEOPOLD
5 years ago
Hold up in that link it says: Usage This policy can be used in the following policy sections and scopes. Policy sections: inbound, outbound, backend, on-error Policy scopes: all scopes
upvoted 2 times
LEOPOLD
5 years ago
Read this: To avoid API Management from making this HTTP request again, when the same user makes another request, you can specify to store the user profile in the cache. XML Copy <cache-store-value key="@("userprofile-" + context.Variables["enduserid"])" value="@((string)context.Variables["userprofile"])" duration="100000" /> API Management stores the value in the cache using the exact same key that API Management originally attempted to retrieve it with. The duration that API Management chooses to store the value should be based on how often the information changes and how tolerant users are to out-of-date information. It is important to realize that retrieving from the cache is still an out-of-process, network request and potentially can still add tens of milliseconds to the request. The benefits come when determining the user profile information takes longer than that due to needing to do database queries or aggregate information from multiple back-ends. The final step in the process is to update the returned response with the user profile information.
upvoted 3 times
LEOPOLD
5 years ago
update the returned response = outbound
upvoted 4 times
...
...
...
oxaytol
4 years, 10 months ago
it is outbound as balddie sent in the following url https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache
upvoted 2 times
...
balddie
5 years, 3 months ago
I think its outbound - https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-cache
upvoted 5 times
...
...
dev_nathan_sg
Most Recent 4 years, 5 months ago
The value is only available after processing, so the storing of the value has to be Outbound, therefore the answer of Inbound, Inbound, Outbound, Outbound is correct.
upvoted 5 times
...
Santosh564
4 years, 6 months ago
<outbound> <cache-store duration="seconds" /> <base /> </outbound>
upvoted 4 times
Satheesh88
4 years, 4 months ago
https://docs.microsoft.com/en-us/azure/api-management/api-management-caching-policies#example
upvoted 1 times
...
...
MrMohan
4 years, 8 months ago
cache-store value should be outbound
upvoted 3 times
...
UomoLumaca
4 years, 8 months ago
I think the wording is ambiguous in this one. Do I need to cache the individual API's response or the user's profile? The question says both things, which can contradict each other. If it is the first one, the cache store value must be outbound (I cannot know what to store if I don't have the API's response - yes, I could call the individual API in the inbound policy but then it would mean that I would never use the real underlying API call in any case, and I don't think that's intended). Otherwise, the procedure in the link rrongcheng provided must be followed (which makes a call to the user profile data API in the inbound policy). I would go with the second one (so, inbound) since it references an existing procedure in Microsoft's documentation.
upvoted 1 times
...
Steve_az
4 years, 8 months ago
Options - https://www.examtopics.com/assets/media/exam-media/03135/0006700001.jpg
upvoted 11 times
...
hertino
4 years, 8 months ago
Today I got 900, I had this question, my answer: A set-variable Inbound. cache-lookup-value Inbound cache-store-value Inbound Find-and-replace Outbound
upvoted 18 times
sinh
4 years, 6 months ago
Even a score of 900 doesn't necessarily mean your answer is correct.
upvoted 9 times
bhushan_786
4 years, 4 months ago
He is just guiding us to the most possible and correct answer. We know it can be wrong also. If you are not agreeing with him, ignore it. No need of taking a dig at him. :)
upvoted 11 times
...
...
...
rrongcheng
4 years, 8 months ago
The answer should be: 1. set-variable -> Inbound 2. cache-lookup-value -> Inbound 3. cache-store-value -> inbound 4.find-and-replace -> outbound Example from doc: "Once you combine all these steps together, the end result is a policy that looks like the following one." https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#:~:text=To%20avoid%20API%20Management%20from,user%20profile%20in%20the%20cache.&text=API%20Management%20stores%20the%20value,attempted%20to%20retrieve%20it%20with.
upvoted 6 times
...
anishk
4 years, 11 months ago
Here the user ID of the client must be detected and then the response must be cached for the given user ID. vs General caching output for all users. So to detect userid, its inbound . Check code on the following site (bottom of the page) for this scenario https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key
upvoted 2 times
...
Dumindu
5 years, 1 month ago
given ans is correct
upvoted 7 times
...
gssicftohbcrcsgtjg
5 years, 2 months ago
options https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQa0WK1UePzrGPAJgWxnZJP5tVh4aRossPenlrzT4AXtipbsnT2
upvoted 15 times
...
JohnyT
5 years, 3 months ago
cache-store-value is inbound. It must have corresponding cache-lookup. cache-store is outbound. It only sets the max-age header. https://docs.microsoft.com/en-us/azure/api-management/api-management-caching-policies#GetFromCacheByKey
upvoted 7 times
Coder1
4 years, 8 months ago
Indeed its Inbound, link : https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key
upvoted 1 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