Question 82 of 179 from exam AZ-204: Developing Solutions for Microsoft Azure

Question 82 of 179 from exam AZ-204: Developing Solutions for Microsoft Azure

Question

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:

Answer Area

Policy section Policy Policy section

Set-variable

Inbound Cache-lookup-value

Outbound | Cache-store-value

Find-and-replace

Explanations

Answer Area

Policy section Policy Policy section

Set-variable Inbound

Inbound | Cache-lookup-value Inbound

Outbound | Cache-store-value | Outbound

Find-and-replace | Qutbound

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.