Amit Srivastava Thank you for posting your question in Microsoft Q&A.
Here are the steps you can follow to achieve this:
- Enable System-assigned Managed Identity for your APIM instance as described Use managed identities in Azure API Management.
- Assign
Azure App Configuration Data Reader
role for the managed identity as per doc: AD Authentication - Then write a custom policy to send request to Azure App Configuration Rest API (https://learn.microsoft.com/en-us/azure/azure-app-configuration/rest-api-key-value#get-key-value) to get the key value and use
authentication-managed-identity
policy to generate authorization token. Refer sample code snippet below: (replace <app-config-name> and testkeyname with actual value)
<send-request mode="new" timeout="20" ignore-error="false" response-variable-name="tokenstate">
<set-url>@("https://<app-config-name>.azconfig.io/kv/testkeyname?api-version=1.0")</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["tokenstate"]).Body.As<JObject>()["value"])" />
Note, the above code snippet is a sample policy for your reference, and you can customize it based on your need. If you face any issues, let me know. I hope this helps with your question.
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.