An enterprise application uses Azure API Management (APIM). You need to configure an inbound policy that evaluates the 'X-Client-Type' request header. If the header value is 'Internal', the request must route to an internal backend service. Otherwise, it should route to the default backend service. Which XML element names must be used to complete the conditional logic in the policy snippet?
Answer:xml
<inbound>
<base />
<【choose】>
<【when】 condition="@(context.Request.Headers.GetValueOrDefault('X-Client-Type') == 'Internal')">
<set-backend-service base-url="https://internal-api.service.local" />
</【when】>
</【choose】>
</inbound>
<inbound>
<base />
<【choose】>
<【when】 condition="@(context.Request.Headers.GetValueOrDefault('X-Client-Type') == 'Internal')">
<set-backend-service base-url="https://internal-api.service.local" />
</【when】>
</【choose】>
</inbound>
Answer
blank_1: choose, blank_2: when
The choose element evaluates nested when elements sequentially from top to bottom. The first when element with a condition that evaluates to true is applied. This conditional routing structure allows policies to dynamically change backend targets or execute specific operations based on headers.
Step-by-Step Solution
Key Concept
Conditional policy execution in Azure API Management
Estimated Time:1m 30s