How can we improve Azure API Management?

Add reusability mechanism for policies

Give us some mechanism to create our own <policy-expression> type steps. For example, we need some snippet to be applied to multiple scopes, today we have to copy/paste all of that. It would be great to have some way to encapsulate custom policy expression logic and reuse it across multiple scopes.

59 votes
Vote
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
You have left! (?) (thinking…)
Bill McCrary shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...
  • Adam Weigert commented  ·   ·  Flag as inappropriate

    Create the ability to create a policy snippet that is then referenced from other policies to build larger, reusable snippets.

    Use case is around avoiding copy/paste of policy definitions across multiple policies, typically operations. This would simplify the development process of policies as well as reduce the chance that mistakes are made.

    Example:

    Policy Name: rewrite-location
    Definition: <set-header name="Location" action="override">...</set-header>

    Snippet Usage in an actual policy:

    <inbound>
    <base />
    <import-policy name="rewrite-location" />
    </inbound>

    This would produce an actual policy:

    <inbound>
    <base />
    <set-header name="Location" action="override">...</set-header>
    </inbound>

    Optionally, being able to nests a snippet would be helpful for composing functionality. Example:

    Snippet Definition:
    <set-header name="x-custom-header" action="override">...</set-header>
    <import-policy name="rewrite-location" />

Feedback and Knowledge Base