A company uses Azure API Management to expose APIs. They need to enforce rate limiting per subscription key and also allow a burst of requests for a short period. Which policy should they apply?
The `rate-limit-by-key` policy is the correct choice as it specifically enforces request limits on a per-subscription-key basis, ensuring each individual API consumer is independently governed. This policy allows precise control over the number of API calls permitted within a defined time window for a unique subscriber, identified by their distinct subscription key. Its support for burst limits further enhances flexibility by allowing temporary spikes in traffic while maintaining overall rate adherence.
Why this answer
The `rate-limit-by-key` policy is correct because it allows rate limiting based on a specified key, such as a subscription key, and supports a burst configuration via the `renewal-period` and `retry-after` attributes. This policy enforces a per-key counter that resets after a defined period, enabling a burst of requests (e.g., 10 requests in 60 seconds) while still enforcing an overall limit.
Exam trap
The trap here is that candidates confuse `rate-limit-by-key` with `rate-limit (per product)`, assuming product-level limits automatically apply per subscription, but product limits aggregate all subscriptions under that product, not per individual key.
How to eliminate wrong answers
Option A is wrong because `limit-concurrency` throttles the number of simultaneous requests, not the rate over time, and does not support burst behavior or key-based scoping. Option B is wrong because `rate-limit (per product)` applies limits at the product level, not per individual subscription key, and cannot enforce per-key bursts. Option D is wrong because `rate-limit-by-ip` limits based on the caller's IP address, not the subscription key, and cannot differentiate between different subscribers behind the same IP.