Exam AZ-204 All QuestionsBrowse all questions from this exam
Question 179

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:

    Correct Answer:

    Box 1: Inbound.

    A set-variable policy to store the detected user identity.

    Example:

    name="enduserid"

    value="@(context.Request.Headers.GetValueOrDefault("Authorization","").Split(' ')[1].AsJwt()?.Subject)" />

    Box 2: Inbound -

    A cache-lookup-value policy -

    Example:

    parameter name

    Box 3: Outbound -

    A cache-store-value policy.

    Example:

    Box 4: Outbound -

    A find-and-replace policy to update the response body with the user profile information.

    Example:

    from='"$userprofile$"'

    to="@((string)context.Variables["userprofile"])" />

    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

Discussion
ave

Inbound Inbound Inbound Outbound

russellg

how would you cache the value on an inbound request? yo don’t have the value yet!

Tommy202024

Look at this example https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#architecture

[Removed]

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.

pac1311

Think it's great that he disproved his own claim :).

Azprep

https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key

Azprep

Answers are Inbound Inbound Inbound Outbound

SachinV

looks correct, in Nov182023, scored 962

Ciupaz

Best score ever, compliments.

1CY1

Inbound, Inbound, Outbound, Outbound. Cache store S/B outbound. https://learn.microsoft.com/en-us/azure/api-management/cache-store-policy#examples

taupokk

The answer provided is correct.

robertob

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>

cbn

This is not cache-store-value. However the answer seems correct as per @profesorklaus answer below.

kkop

Here is Answer:https://learn.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#architecture inbound, inbound, inbound outbound

FeriAZ

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.

JH81

Got this on 6/28/2023 and passed with 850. Went with highly voted answer.

Esward

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

NombreFalso

>> 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

elequiel

Got it in exam 20/10/2022

Azprep

Inbound Inbound Inbound Outbound

Prasu69

Inbound Inbound Inbound Outbound

[Removed]

Incorrect

manopeydakon

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.

11_NickName_11

Inbound Inbound Inbound Outbound https://learn.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#fragment-caching

dddddd111

Inbound Inbound Outbound Outbound Reference: https://learn.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key#architecture

dddddd111

Sorry, the 3rd one is Inbound.

Knightie

see the xml tag of inbound and outbound https://docs.microsoft.com/en-us/azure/api-management/api-management-sample-cache-by-key

Lucky_me

<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>

vavra

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.

kjfdzkkbsm

Your'e at the wrong question, mate

petitbilly

According to this docs from Microsoft, the third box (cache-store-value) could be: inbound or outbound. https://docs.microsoft.com/en-us/azure/app-service/faq-app-service-linux#i-m-using-my-own-custom-container--i-want-the-platform-to-mount-an-smb-share-to-the---home---directory-