List all App Service web apps outbound IP addresses used in a subscription

If you want to perform IP whitelisting against an App Service, you'll discover that on public instances of App Service (not App Service Environment) you have 4 or more outbound IP addresses.

I was in a situation where I needed to get all outbound IP addresses over multiple subscriptions for IP whitelisting purposes. With the help of PowerShell I created a little script that will do just that here is an example of the output:

.\Get-AppServiceWebAppsOutboundIpAddresses.ps1' -SubscriptionName 'mysub1','mysub2

Switching to subscription mysub1  
Switching to subscription mysub2

Count IpAddress       Sites  
----- ----            -----                                                                                                                                                           
    2     {sub1-bi-dev-as-webapp, sub2-bi-prod-as-webapp}                                                                                                     
    2    {sub1-bi-prod-as-webapp, sub1-bi-dev-as-webapp}                                                                                                     
    2    {sub2-bi-prod-as-webapp, sub1-bi-dev-as-webapp}                                                                                                     
    2    {sub1-bi-dev-as-webapp, sub2-bi-prod-as-webapp}                                                                                                     
    2    {sub1-bi-dev-as-webapp, sub2-bi-prod-as-webapp}                                                                                                     
    1    {sub1-dev-functions-mmckydd}                                                                                                                                
    1   {sub1-dev-functions-mmckydd}                                                                                                                                
    1   {sub1-dev-functions-mmckydd}                                                                                                                                
    1    {sub1-dev-functions-mmckydd}                                                                                                                                
    5    {sub1-stg-webapp-web-n7wfdda, sub1-stg-functions-n7wfdda, sub1-stg-webapp-admin-n7wfdda, sub1-dev-ops-functions-stl4tn5...}                  

If you are interested to have a sorted, unique list of IPs used in your App Services, this script is for you.

You can get it on the Script Center:

I am the proud father of two little gems. A beer & wine enthusiasm. For everything else, I work and play with Azure at day, and I am an Azure MVP & Advisor at night.
Montreal, Canada