How To Figure Out IP Address For Azure Functions

How To Figure Out IP Address For Azure Functions

In this Azure tutorial, we will discuss How To Figure Out IP Address For Azure Functions. Along with this, we will also discuss a few other topics Azure Function Static Outbound IP, Azure Function Outbound IP Addresses using PowerShell and we also discussed Azure Function Whitelist IP Address.

How To Figure Out IP Address For Azure Functions? You can find out the IP Address of the Azure Function using the Azure Portal and also, you can find the Outbound Ip Address of the Azure Functions using the Azure Resource Explorer.

Below we will discuss the steps to figure out the IP Addresses of the Azure Function App in detail.

How To Figure Out IP Address For Azure Functions

Well, Let me make you clear one thing here when we are thinking of the IP Address for Azure Functions, It is actually the IP address of the Azure Function App, not the individual Azure Function.

When we are discussing the IP address of the Azure Function App, two categories of IP Address are coming into the picture. InBound IP address and OutBound IP Address.

How To Figure Out InBound IP Address For Azure Functions

Ok, let’s see How to figure out inbound IP address for Azure Functions using the Azure Portal. Follow the below steps to figure out the inbound IP address for the Azure Functions using the Azure Portal.

Log in to the Azure Portal (https://portal.azure.com/)

The next step is to navigate to the Azure Function App for which you want to figure out

azure functions static ip

Then the next step is to click on the Properties link from the left navigation on the Azure Function App page. Now you can see the IP Address under the Virtual IP Address as highlighted below.

How To Figure Out IP Address For Azure Functions

This is how you can Figure Out InBound IP Address For Azure Functions using the Azure Portal.

How To Figure Out OutBound IP Address For Azure Functions

Above we discussed, How To Figure Out InBound IP Address For Azure Functions. Now we will discuss How To Figure Out OutBound IP Address For Azure Functions using the Azure Resource Explorer.

Log in to the Azure Resource Explorer (https://resources.azure.com/)

Once you are logged in to the Azure Resource Explorer, The next step is to Expand the Subscription node and then select your correct Subscription.

azure function get ip address

Now you need to select Microsoft.Web and then choose Sites.

Azure Function Static Outbound IP

Now search for the Azure Function for which one, you want to see the outboundIpAddress. You can able to see the IP Address for the outboundIpAddresses and possibleOutboundIpAddresses in the JSON panel as mentioned below.

azure function ip address

This is how you can figure out the OutBound IP Address For Azure Functions.

Azure Function Outbound IP Addresses using PowerShell

You can also able to get the Outbound IP Addresses of the Azure Function using PowerShell. You can use the below PowerShell cmdlets to get the OutboundIpAddresses

(Get-AzWebApp -ResourceGroup newresgroup -name BlobTriggerAzureFunctionApp).OutboundIpAddresses

The complete script will be as below. For Tenant (Provide the tenant ID) and Subscription (Provide the Subscription ID)

Connect-AzAccount -Tenant xxxxx-0310-474d-xxxx-42df2d549228 -Subscription rttyyu-fggg-4518-9c9c-hjjkjhhhjj
(Get-AzWebApp -ResourceGroup newresgroup -name BlobTriggerAzureFunctionApp).OutboundIpAddresses

You can see the Output as below

azure function app ip address

You can able to retrieve the PossibleOutboundIpAddress for the Azure Functions using the below PowerShell cmdlets

(Get-AzWebApp -ResourceGroup newresgroup -name BlobTriggerAzureFunctionApp).PossibleOutboundIpAddresses

The Complete script will be as below

Connect-AzAccount -Tenant xxxxx-0310-474d-xxxx-42df2d549228 -Subscription rttyyu-fggg-4518-9c9c-hjjkjhhhjj
(Get-AzWebApp -ResourceGroup newresgroup -name BlobTriggerAzureFunctionApp).PossibleOutboundIpAddresses

You can see the output as below

How retrieve Azure Function Outbound IP Addresses using PowerShell

This is how you can able to retrieve Azure Function Outbound IP Addresses using PowerShell

Figure Out IP Address For Azure Functions – Video Tutorial

IP Addresses In Azure Functions

One point to note down here is, IP addresses are associated with the Function app, not with the individual functions. The incoming HTTP requests use the custom domain name (functionappname.azurewebsites.net) or a custom domain name to call individual functions as they can’t use the inbound IP address.

Azure Function Whitelist IP Address

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.

In order to whitelist IP address for the Azure function, Follow the below steps

Log in to the Azure Portal (https://portal.azure.com/)

Once you logged in to the Azure Portal, Navigate to the Azure Function App

Azure Function Whitelist IP Address

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

How to Whitelist IPs in Azure Functions

On the Access Restrictions page, Click on the + Add rule button to add a new rule for this Azure Function App.

azure function app outbound ip address

Now on the Add Access Restriction page, Provide the below details

  • Name: Provide the name Add Access Restriction rule.
  • Action: Choose the Action based on your business need. You can choose the Allow or Deny option.
  • Priority: You need to provide the value as a number to set the Priority.
  • Description: This is optional. If you want you can put a description of the rule.
  • Type: You can choose the Type IPV4.
  • IP Address Block: For this option, we need to provide the IP address value that we want to allow or deny.

Finally, click on the Add Rule button to add the rule

Azure Function Whitelist IP Address

You can able to see the New rule has been added successfully. The deny-all rule will be added automatically.

azure function app static ip

Now You can update the rule also by clicking on the rule and modifying the value Finally, click on the Update Rule button to save the changes. Now I have updated the action value from Allow to Deny.

azure function fixed ip

Now when I am trying to access the Azure Function App from the IP mentioned above, You can able to see below, it is not allowing me to access the Azure Function and showing me Error 403 – Forbidden.

azure app service whitelist ip

This is how You can now able to secure your Azure Functions app by using the whitelisting IP address method.

You may also like Following the Below Articles

Wrapping UP

Well, In this article, we have discussed How To Figure Out IP Address For Azure Functions, How To Figure Out InBound IP Address For Azure Functions, How To Figure Out OutBound IP Address For Azure Functions, Azure Function Static Outbound IP and we also discussed Azure Function Outbound IP Addresses using PowerShell, Azure Function Whitelist IP Address. Hope you have enjoyed this article!!!