How to update app config value against a key via APIM

Amit Srivastava 60 Reputation points
2023-04-11T13:20:54.64+00:00

Hi Team, Can you please help me , how can I update an app config key- val via APIM? I need to make an operation/API in APIM to be able to update the value of an app config key. Thanks in Advance

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,912 questions
Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
214 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,261 Reputation points
    2023-04-11T19:41:34.02+00:00

    Amit Srivastava Thanks for posting your question in Microsoft Q&A. You can create an API with Web service URL points to Azure App Configuration (`https://<appconfig-name>.azconfig.io) and add an operation for PUT method with template parameters as shown below (refer doc: Create an API).User's image

    Add a policy to get authorization token and set it in Authorization header before calling backend API and also set query parameter api-version. Follow other thread for the detailed instructions related to this.

    <authentication-managed-identity resource="https://azconfig.io" ignore-error="false" output-token-variable-name="msi-access-token" />
            <set-header name="Authorization" exists-action="override">
                <value>@("Bearer " + (string)context.Variables["msi-access-token"])</value>
            </set-header>
            <set-query-parameter name="api-version" exists-action="override">
                <value>1.0</value>
            </set-query-parameter>
    

    While calling API, make sure you set content type as application/vnd.microsoft.appconfig.kv+json and pass the request body in the format specified in Set key API. Note, the above code snippet is a sample policy for your reference. 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.