Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find Azure Function App IP for white-listing

I have developed a PowerShell script to send mail to specified users using MX record DNS once in a day. Mails are delivered successfully but all mails are going in to Junk folder.

Exchange team have analyzed the message header and responded that sender IP addresses needs to be white-listed.

How to find Azure Function IP or IP range as I am using Consumption plan for my Function App.

Regards, K Senthilrajan

like image 480
K Senthilrajan Avatar asked Apr 24 '18 10:04

K Senthilrajan


People also ask

How to whitelist IP address for the Azure function?

In order to whitelist IP address for the Azure function, Follow the below steps Once you logged in to the Azure Portal, Navigate to the Azure Function App On the Azure Function App page, click on the Networking option from the left side navigation and then click on the Configure Access restrictions under the Access Restrictions options

What is whitelisting in azure function app?

In real-time, we will meet with the scenario where In order to Secure your Azure Function App, you need to allow some specific set range of IP addresses that are authorized by your Organisation and you need to restrict all other IP addresses that are unauthorized as per your organization. This is called whitelisting.

How do I find the IP address of an azure function?

To find that IP address: Sign in to the Azure portal. Navigate to the function app. Under Settings, select Properties. The inbound IP address appears under Virtual IP address.

How do I find the outbound IP address of an azure subscription?

1 Sign in to the Azure Resource Explorer. 2 Select subscriptions > {your subscription} > providers > Microsoft.Web > sites. 3 In the JSON panel, find the site with an id property that ends in the name of your function app. 4 See outboundIpAddresses and possibleOutboundIpAddresses.


2 Answers

Unfortunately things have changed since Kim's answer. You now have to go into a JSON file via Azure Resource Manager to find the possible outbound IP addresses. Per the current Microsoft documentation:

  1. Sign in to the Azure Resource Explorer.
  2. Select subscriptions > {your subscription} > providers > Microsoft.Web > sites.
  3. In the JSON panel, find the site with an id property that ends in the name of your function app.
  4. See outboundIpAddresses and possibleOutboundIpAddresses.

Alternatively, you can also do it via the Az Powershell Module:

az webapp show --resource-group <group_name> --name <app_name> --query outboundIpAddresses --output tsv

az webapp show --resource-group <group_name> --name <app_name> --query possibleOutboundIpAddresses --output tsv

like image 121
Elliott Avatar answered Sep 28 '22 03:09

Elliott


In the background behind an Azure Function is an Azure App Service. So, how do you find the IP addresses it use?

There is the section containing current outbound IP addresses in the App Service settings page, see

Azure App Service - Outbound IP Addresses

But keep in mind, since the platform is a PaaS service, it might, without any notice, move to other hardware and get a totally different set of outbound IP addresses.

See this twitter conversation with Azure Support, for more details. Conclusion of the discussion is the IP range is not static and may change.

The only surefire way to know what IP's an Azure Function may be using, is to refer to the XML document published by Microsoft Azure that contain the entire IP range of all data centers, making this task a little difficult to implement.

like image 23
kim Avatar answered Sep 28 '22 02:09

kim