Use Custom Variables in Policy Expressions


How to use custom variables created by "set-variable" statements in policy expressions?



If you want to access custom variables created by "set-variable" statements, you can use the IReadOnlyDictionary object through "context.Variables".

For example, the following policy creates a custom variable during the inbound processing step and used it in the output processing step:

    <set-variable name="method" value="@(context.Request.Method)"/>
    <trace source="DEBUG">@(context.Variables["method"])</trace>


'choose ... when ...' Statements to Control Execution Flows

'set-variable' Statement to Create Custom Variables

Using Azure API Policy

⇑⇑ Microsoft Azure API Management Tutorials

2018-01-24, 2476🔥, 0💬