When updating an Azure app service there was an unexpected error when swapping the slots over as part of the deployment. The deployment was run again and was successful but it lost the connection to its fixed public IP address. What would be the reason for this?
I looked at the VNET associated with the service and noticed that the "Outbound internet traffic" box wasn’t ticked like other services I have deployed. I manually ticked it and applied the changes and the IP address was re-associated. Why would this have been undone by the failed deployment?
2
Answers
Thanks to Vinay's answer I was able to identify my issue
In my case the staging slots were not in the VNET which may have been changed when the error occurred, leaving the app service with no outbound settings configured
When updating an Azure App Service, the loss of a fixed public IP address during a slot swap can be attributed to multiple factors. This breakdown explains why this might occur and the potential connection to the "Outbound internet traffic" setting.
Understanding IP Addresses in Azure App Services
Azure App Services generally utilize dynamic IP addresses for both inbound and outbound connections, which are managed via Azure’s infrastructure.
Slot Swap Implications
During a slot swap in Azure, the configurations such as connection strings and other settings are exchanged, but custom domain names are not. Typically, IP addresses remain unchanged since they are associated with the service rather than the deployment slots.
Step 1
Create an App Service with VNet Integration
Resource Group >> Create an App Service Plan >> Deploy an app to this service >> Integrate with a VNet
Step 2
Configure a Fixed Public IP
Attach a NAT gateway with a static public IP to your VNet & Ensure that outbound internet traffic is allowed via the NAT gateway in your VNet settings.
Step 3
Set Up Deployment Slots
Add a new deployment slot to your App Service for staging & Make sure that both the production and staging slots have the same VNet and outbound settings.
By this you can set up an environment to test how IP addresses behave during slot swaps and ensure that network settings are consistent across your deployment slots.
Reference:
https://learn.microsoft.com/en-us/azure/nat-gateway/nat-overview
https://learn.microsoft.com/en-us/azure/virtual-network/manage-virtual-network
https://learn.microsoft.com/en-us/azure/app-service/
https://learn.microsoft.com/en-us/azure/app-service/overview-vnet-integration