The symptom
A partner API, SFTP server or on-premises firewall allowlists your app by source IP. Calls work for weeks, then start failing with connection timeouts or 403s after a scale-out, a plan change or a redeployment. Or the partner asks "which IP should we allow?" and you need an answer that won't change next month.
App Service does not give each app its own outbound address. Outbound traffic leaves from a shared set of IPs that belong to the scale unit, and that set can change. Use this checklist to see what you have today and move to a single static address when the partner needs one.
1. List the IPs the app uses now
RG=rg-web
APP=app-prod
# IPs currently used for outbound calls
az webapp show -g $RG -n $APP --query outboundIpAddresses -o tsv
# Every IP the app could use in its current pricing tier
az webapp show -g $RG -n $APP --query possibleOutboundIpAddresses -o tsv
-
outboundIpAddressesis the set in use right now. -
possibleOutboundIpAddressesis the full set for the scale unit, including the IPs the app can move to when you change tier. - If a partner must allowlist the shared IPs, give them all of
possibleOutboundIpAddresses, not just the current list. A partial list breaks after the next scale event.
Tip
Functions on Consumption-style plans and apps without VNet integration have the same behaviour: shared, changeable outbound IPs. Don't promise a partner a single IP unless you have done section 3.
2. Know what changes the outbound IPs
| Event | What happens to outbound IPs | What to do |
|---|---|---|
| Scaling out or in within the same tier | Stays inside the possibleOutboundIpAddresses set | Nothing, if the partner allowlisted the full set |
| Moving between tiers in different hardware groups (for example Basic/Standard to Premium v3) | The whole set can change | Re-read both properties after the change and tell the partner first |
| Deleting the last app in a resource group and region combination, then recreating it | The app may land on a different scale unit with new IPs | Avoid tear-down-and-recreate for apps behind allowlists |
| Moving the app to another region | New IPs | Treat as a new allowlist request |
| VNet integration with Route All and a NAT gateway | Internet-bound traffic uses the NAT gateway's public IP | The fix in section 3 |
Before any planned tier change, export the current values so you can diff them:
az webapp show -g $RG -n $APP \
--query "{current:outboundIpAddresses, possible:possibleOutboundIpAddresses}" -o json > ips-before.json
3. Give the app one static outbound IP
The pattern is: VNet integration → Route All enabled → NAT gateway on the integration subnet → Standard static public IP on the NAT gateway. The partner then allowlists a single address you own.
Prerequisites
- App Service plan tier supports VNet integration (Basic and above; check current docs for your plan).
- A dedicated integration subnet delegated to
Microsoft.Web/serverFarms. Size it for scale-out: plan for at least one address per instance plus headroom for upgrades;/26is the common recommendation. - Nothing else in that subnet needs a different egress path.
- If the app also writes to Azure Storage in the same region, plan private endpoints or service endpoints for that traffic; the NAT gateway docs call this out as a limitation.
Build it
VNET=vnet-web
SUBNET=snet-appsvc-int
# Static Standard public IP for the NAT gateway
az network public-ip create -g $RG -n pip-nat-web \
--sku Standard --allocation-method Static
# NAT gateway with that IP
az network nat gateway create -g $RG -n nat-web \
--public-ip-addresses pip-nat-web --idle-timeout 4
# Attach the NAT gateway to the integration subnet
az network vnet subnet update -g $RG --vnet-name $VNET -n $SUBNET \
--nat-gateway nat-web
# Integrate the app with the subnet (skip if already integrated)
az webapp vnet-integration add -g $RG -n $APP --vnet $VNET --subnet $SUBNET
# Send all outbound traffic through the VNet, not just private ranges
az webapp config set -g $RG -n $APP --vnet-route-all-enabled true
Read the address to give the partner:
az network public-ip show -g $RG -n pip-nat-web --query ipAddress -o tsv
Warning
Route All changes the path for all outbound traffic, not only the partner call. If the VNet has a route table sending
0.0.0.0/0to a firewall or NVA, that route wins over the NAT gateway and the partner will see the firewall's public IP instead. Check the subnet's route table before you flip the setting, and make sure the firewall allows the app's other dependencies.
Need more than one IP?
A single public IP gives a fixed number of SNAT ports. For heavy outbound volume, attach a public IP prefix instead and give the partner the whole prefix:
az network public-ip prefix create -g $RG -n ippre-nat-web --length 30
az network nat gateway update -g $RG -n nat-web --public-ip-prefixes ippre-nat-web
Check the current NAT gateway limits for IPs per gateway and ports per IP before sizing.
4. Prove the egress IP from inside the app
Don't trust the configuration alone. Open the Kudu console (https://<app>.scm.azurewebsites.net) on Windows, or SSH on Linux (az webapp ssh -g $RG -n $APP), and ask an external echo service which address it sees:
curl -s https://ifconfig.me
On Windows Kudu (PowerShell console):
(Invoke-WebRequest -UseBasicParsing https://ifconfig.me).Content
- The result matches the NAT gateway public IP.
- Repeat on more than one instance if the plan runs several. In Kudu, use the instance picker; with
az webapp ssh, connect again until you land on another instance, or check instance names under Diagnose and solve problems.
If you still see one of the shared App Service IPs:
| Symptom | Likely cause | Fix |
|---|---|---|
| Shared App Service IP | Route All is off | az webapp config set ... --vnet-route-all-enabled true |
| Shared App Service IP on some instances only | Integration change still rolling out, or the app restarted only partly | Restart the app and test again |
| Firewall's public IP | UDR on the subnet sends 0.0.0.0/0 to a firewall | Remove that route for this subnet, or have the partner allowlist the firewall IP |
| Timeouts to everything | NSG on the integration subnet blocks outbound, or the firewall denies it | Check effective NSG rules and firewall logs |
| Partner sees the right IP but still blocks | Partner allowlist not applied yet, or they allowlisted a different IP | Send them the IP from az network public-ip show, not from memory |
Check what the integration looks like:
az webapp vnet-integration list -g $RG -n $APP -o table
az webapp config show -g $RG -n $APP --query vnetRouteAllEnabled
az network vnet subnet show -g $RG --vnet-name $VNET -n $SUBNET \
--query "{nat:natGateway.id, rt:routeTable.id, nsg:networkSecurityGroup.id}" -o json
5. Cut over without breaking the partner
- Send the partner the new NAT gateway IP before enabling Route All, and ask them to add it alongside the old shared IPs.
- Enable Route All during a quiet period and run the section 4 test.
- Watch partner-call failures for a day (Application Insights dependency failures, or your own logs).
- Ask the partner to remove the old shared IPs only after the test passes on every instance.
Caution
Deleting or recreating the public IP gives you a new address and breaks every allowlist that references it. Put a
CanNotDeletelock on the public IP and the NAT gateway:az lock create -g $RG -n lock-pip-nat --lock-type CanNotDelete \ --resource-type Microsoft.Network/publicIPAddresses --resource pip-nat-web
Prevent it next time
- Record which apps sit behind partner allowlists, and which IP or prefix each one uses, in the app's runbook or as a tag on the app.
- Add a pre-change step to any App Service plan tier change: export
possibleOutboundIpAddresses, change, diff, notify. - For new apps that call allowlisted endpoints, build VNet integration, Route All and the NAT gateway from day one in Bicep or Terraform, so nobody hands a partner shared IPs that will move.
- Lock the public IP so a clean-up script can't delete it.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get