How can we improve Azure API Management?

Code re-use in API policies using of custom functions or expressions

I find myself regularly copying and pasting generic code functions across policies. It would be great if there was a policy where you add custom code functions or expressions to call in other policies. Maybe in the base policy or a new "custom expressions" policy.

For example, I have generic code for policies fronting SOAP services that determines date timezones before converting dates to UTC. This code is duplicated across various APIs.

Another example is a piece of code I add to each policy for error handling and recording to the event hub via logger.

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


Sign in
Sign in with: Microsoft
Signed in as (Sign out)
  • Anonymous commented  ·   ·  Flag as inappropriate

    Hi Microsoft,

    Any chance that this will be made available ? We are going thru something very similar. Due to lack of this feature, we have to implement complex and reusable data format validation logic as Azure Functions or end up copy pasting it across each operations. Both have a lot of drawbacks. Wondering when Microsoft would consider this!!

  • Jorge Arteiro commented  ·   ·  Flag as inappropriate

    I am using "Properties" feature of APIM to simulate this code reuse.
    You can have policy expressions in Properties.
    <log-to-eventhub logger-id="IgniteLogger001">

    and create Propertie like that:
    @( String.Join(",",@"{""dateTime.UtcNow"""+":"+@""""+DateTime.UtcNow+@"""",

    But i really think we need something more powerful than this work around.

Feedback and Knowledge Base