skip to Main Content

I have imported an Azure Function app into Azure API Management service, which automatically generates a host key on the Function app for authorizing calls against it.

I would like to inspect the associated policy (if one exists) and edit it, but I can’t find it anywhere – it’s not shown in "Policy fragments".

How can I view/edit the policy that adds the generated function key to calls against the Function app?

enter image description here

enter image description here

2

Answers


  1. I would start with checking Effective policy view to check if it’s added by the policy. I’m guessing this is the case.

    Select All operations or any operation, select the code view for policies and then select "calculate effective policy", this should show all the policies related to that operations.

    I’m guessing that’s either API level policy or Product level. Product policies can be checked and changed from Products-view and API lelve from "All operations" -level. There are also global policies but I don’t think tis’ there.

    Code view for policies
    Calculate effective policy

    Login or Signup to reply.
    • Navigate to any operation which got added post importing a Function App in APIM. Lets say, in my case its HttpTrigger1. Then, click on Inbound processing policies –> </>.

    enter image description here

    • This will give you below policy.
    <policies>
        <inbound>
            <base />
            <set-backend-service id="apim-generated-policy" backend-id="afreeen-fa" />
        </inbound>
        <backend>
            <base />
        </backend>
        <outbound>
            <base />
        </outbound>
        <on-error>
            <base />
        </on-error>
    </policies>
    
    • This policy signifies that, the operation is referring to a backend Id afreeen-fa which is created in APIs --> Backends blade of APIM instance.

    enter image description here

    • Click on the backend name and then navigate to Authorization credentials to access the x-function-key which is being passed in request header when you invoke an operation in APIM test console.

    • This is how APIM is storing the function key after importing a function app and using it via set-backend-service policy.

    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search