AZ-204 Practice Question: Connect to and consume Azure services and third-party services
You manage an API in Azure API Management. You need to cache API responses such that different responses are returned based on the product subscription key used by the caller. Which set of policies should you implement?
⚠ Common exam trap
It's easy for candidates to assume caching policies must both be in the inbound section, not realizing that 'cache-lookup' must run before the backend call and 'cache-store' must run after the response is generated, requiring them in inbound and outbound respectively.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Set a 'cache-lookup' policy in the inbound section and a 'cache-store' policy in the outbound section, using the subscription key as a cache vary-by parameter.
Caching API responses based on the subscription key ensures that each caller receives a cached response unique to their subscription. The 'cache-lookup' policy in the inbound section checks the cache before forwarding the request, and the 'cache-store' policy in the outbound section stores the response after it is generated. By specifying the subscription key as a vary-by parameter, the cache key includes the subscription key, so different keys produce different cached entries.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Set a 'cache-lookup' policy in the inbound section and a 'cache-store' policy in the outbound section, using the subscription key as a cache vary-by parameter.
Why this is correct
This configuration correctly implements response caching in Azure API Management. The 'cache-lookup' policy in the inbound section efficiently checks for a cached response before forwarding the request to the backend, optimizing performance. If no cached entry is found, the request proceeds, and upon receiving a successful response from the backend, the 'cache-store' policy in the outbound section saves this response for future requests. Using the subscription key as a 'vary-by' parameter ensures that different API consumers receive their specific cached data, maintaining data isolation and correctness.
- ✗
Set a 'cache-store' policy in the inbound section and a 'cache-lookup' policy in the outbound section.
Why it's wrong here
This policy placement reverses the fundamental logic of API response caching. Placing 'cache-store' in the inbound section would attempt to cache a response before the actual backend service has been invoked and returned any data, leading to an empty or invalid cached entry. Conversely, a 'cache-lookup' policy in the outbound section would only attempt to retrieve a cached response after the backend has already processed the request and generated a response, negating any performance benefits of caching.
- ✗
Set both 'cache-lookup' and 'cache-store' policies in the inbound section.
Why it's wrong here
Placing both 'cache-lookup' and 'cache-store' policies exclusively within the inbound section is an incorrect approach for caching API responses. While 'cache-lookup' is appropriately positioned in the inbound flow to check for existing cached items, the 'cache-store' policy must reside in the outbound section. Attempting to store a response in the inbound section would occur before the backend service has processed the request and returned any meaningful data, resulting in the caching of an empty or incomplete response.
- ✗
Set only a 'cache-store' policy in the backend section.
Why it's wrong here
The backend section in Azure API Management policy definitions is specifically designed for policies that modify the request before it reaches the backend service or modify the response after it leaves the backend but before it's processed by the outbound policies. It does not support caching policies like 'cache-lookup' or 'cache-store'. Caching operations, which involve storing and retrieving responses, are explicitly handled within the 'inbound' and 'outbound' policy sections to manage the flow of requests and responses through the API Management gateway.
Go deeper
Related to this question
About these practice questions
One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.