We understand that you were trying to associate a public IP address with your Azure Application Gateway after disassociating it from a VM. The error message you're seeing ("This Public IP cannot be associated with this gateway") typically happens due to IP constrains:
When you disassociate a Public IP from a VM NIC, Azure still considers that IP as "in use" or not eligible for Application Gateway if:
- The IP is not Standard SKU (AG requires Standard SKU).
- The IP is not in the same region or resource group as the AG.
- The IP is still linked to a resource in the background (e.g., NIC, DNS label).
- The IP was created as Dynamic, not Static.
Here’s what you need to check:
- Check the Public IP SKU
- Go to the Public IP resource in Azure Portal.
- Ensure it is Standard SKU and Static.
- If it's Basic, you cannot use it with Application Gateway.
- You’ll need to create a new Standard SKU Static IP.
- Ensure It’s Fully Disassociated
- Go to the VM’s NIC and confirm the IP is fully removed.
- Also check:
- No DNS label is set; No Load Balancer or NAT Gateway is using it.
- Same Region and Resource Group
- The Public IP must be in the same region and preferably the same resource group as the AG.
- Public IP SKU: Ensure that the public IP you’re trying to associate is of the correct SKU.
- The Application Gateway V2 supports only standard SKU public IPs. If your disassociated VM's public IP was standard, you’d be fine; however, if it was a basic dynamic IP or not in the right SKU, it won't work.
- The public IP must not be associated with any other resource at the time of trying to attach it to the Application Gateway. Make sure it's entirely disassociated from any other services.
- You can only associate a certain number of frontend IPs with each Application Gateway. Ensure you haven't hit the limits in your configuration.
Additionally we have suggested you create the support ticket for the IP issue as you need to use the old IP.
Please submit a support ticket for further investigation and share the SR# with us.
I hope this helps! If these answers your query, do click the "Upvote" and click "Accept the answer" of which might be beneficial to other community members reading this thread.