Set-AzApiManagementPolicy - How to set policy on multiple Operations

Viewed 42

I am trying to understand how to apply custom policies (ie. Caching) to target each operations within an given API. Below is a sample cache policy file (xml) for a "Get Test1" policy:

<policies>
<inbound>
    <base />
    <cache-lookup vary-by-developer="false" vary-by-developer-groups="false" allow-private-response-caching="false" must-revalidate="false" downstream-caching-type="none" />
</inbound>
<backend>
    <base />
</backend>
<outbound>
    <base />
    <cache-store duration="3600" />
</outbound>
<on-error>
    <base />
</on-error>

So based on the above, I have several other operations within the same API that I want to apply unique policy to (Get Test2, Get Test3...). My understanding is that I need to execute a new Set-AzApiManagementPolicy for each operation I want to apply a policy to. Is this correct? This seem a bit tedious.

Can Set-AzApiManagementPolicy take a single XML file with various scopes defined within it?

Thanks

0 Answers
Related