Search code examples
azureazure-functionsazure-api-managementazure-rm-template

Runtime whitelist APIM IP on function App using ARM


We are provisioning APIM service first(apim.json), Post which we provision multiple function App. All the ARM templates are separate with their respective parameter file. We are using Azure Pipelines for CI/CD.

  • Pipeline1 functionapp1.json
  • Pipeline2 functionapp2.json
  • Pipeline3 functionapp3.json
  • Pipeline4 apim.json

We have an requirement of applying Access restriction on Function Apps. We want to add Access Restriction using ARM templates.

How can we get VIP of APIM on run time so that we can white list VIP of APIM in access restriction section of Function app. All the pipeline are separate for each function app and APIM

Using API and get the value on runtime(Powershell) is one of the option. But we want to handle it using ARM templates.

Any inputs would be highly appreciated.


Solution

  • Used the following to whitelist at runtime. "ipAddress": "[concat(reference(resourceId('Microsoft.ApiManagement/service', parameters('apimName')),'2019-01-01').publicIPAddresses[0], '/32')]"