Rather than setting it at app config, why not consider setting it at named value in api management which then can be used in the policy. See this
Is it possible to set rate limit value using app config in APIM policy
<send-request mode="new" timeout="20" ignore-error="false" response-variable-name="ResponseKey">
<set-url>@("{{BaseUrl}}ConnectionKey")</set-url>
<set-method>GET</set-method>
<authentication-managed-identity resource="https://azconfig.io" ignore-error="false" />
</send-request>
<set-variable name="keyValue" value="@(((IResponse)context.Variables["ResponseKey"]).Body.As<JObject>()["value"])" />
<rate-limit calls="@(context.Variables.GetValueOrDefault("keyValue"))" renewal-period="60" />
I want to set rate-limit calls value from app config.
1 additional answer
Sort by: Most helpful
-
MuthuKumaranMurugaachari-MSFT 22,421 Reputation points
2023-08-07T15:11:38.5433333+00:00 Neethu Nath Thanks for posting your question in Microsoft Q&A. It is possible to retrieve the value from azure app configuration using the sample policy snippet above and the detailed steps are described in other thread discussion. However, unfortunately,
calls
attribute in therate-limit
policy doesn't allow policy expression and it has to be a static value or a named value. So, you cannot set the value usingcontext.Variables
policy expression in thecalls
attribute.If you are interested in this feature or any feedback, please submit it directly to our product team via https://aka.ms/apimwish and others with similar interest can upvote too. I will also share it internally and add a note in the doc. I hope this helps and let me know if any questions.
If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.