Unable to delete Public IP resource

Callum Bradford 46 Reputation points
2022-07-28T11:29:36.273+00:00

Hi,

I have a public ip resource that I can't delete in azure, getting following errros:

CoreServicesVnetGateway-IP2: Public IP address /resourceGroups/ContosoResourceGroup/providers/Microsoft.Network/publicIPAddresses/CoreServicesVnetGateway-IP2 can not be deleted since it is still allocated to resource resourceGroups/ContosoResourceGroup/providers/Microsoft.Network/virtualNetworkGateways/CoreServicesVnetGateway/ipConfigurations/default. In order to delete the public IP, disassociate/detach the Public IP address from the resource. To learn how to do this, see aka.ms/deletepublicip. (Code: PublicIPAddressCannotBeDeleted)

However, the associated resource is already deleted and if I try to navigate to it I get a 404 error, there is no way for me to delete it myself.

I have spoken to the support chat and tried the usual Powershell cmds to remove the Vnet Gateway and Public IP via this method but neither of these work.

Please help, thanks.

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,762 questions
{count} votes

Accepted answer
  1. Jackson Martins 10,606 Reputation points MVP Volunteer Moderator
    2022-07-28T11:57:49.927+00:00

    Hi @Anonymous

    Have you tried using the -force parameter? like?

    Remove-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -Force

    Best Regards

    2 people found this answer helpful.

4 additional answers

Sort by: Most helpful
  1. Callum Bradford 46 Reputation points
    2022-07-29T12:58:36.11+00:00

    Microsoft support ended up removing the Public IP resource manually on the backend.

    1 person found this answer helpful.

  2. Mohammed Altamash Mohammed Suleman Khan 2,331 Reputation points
    2022-07-28T11:40:41.83+00:00

    Hi

    • Make sure you have dis-associated your public from VM / Vnet / or any other recourses which it was connected before.
    • Go to resource and delete the Public IP . If you dont need the resource group , review and delete the complete RG.
    • If you get error while doing these operation , make sure your resource group has no locks.
    • Log out and login again , maybe your portal is not updating or check if you have any network issue.

    Regards,
    Mohammed Altamash

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

  3. Callum Bradford 46 Reputation points
    2022-07-28T12:06:47.447+00:00

    Hi @Jackson Martins

    I have tried the -Force flag but to no avail unfortunately.

    @Mohammed Altamash Mohammed Suleman Khan I can't disassociate the Public IP from the VNet Gateway as the VNet Gateway has already been deleted. I have also tried to delete the whole resource group within Azure and on Powershell but it won't delete still.

    I believe support are going to esculate this as it sounds like an issue with the backend.

    Thanks


  4. Martin Meiner Tästensen 461 Reputation points
    2022-07-28T12:09:00.463+00:00

    Hi @Anonymous

    That is interesting and unexpected although there can be a slim delay but it should not be hours.

    Could you try to connect to Azure using powershell, switch to the correct subscription and paste the value under the "IpConfiguration" on the resource. You need to use the AZ module for this

    Connect az-account  
    Select-AzSubscription -Subscription ("subscription ID where the PIP is located")  
    Get-AzPublicIpAddress -Name "CoreServicesVnetGateway-IP2"  
    

    It should show you the following properties.

    Name
    ResourceGroupName
    Location
    Id
    Etag
    ProvisioningState
    Tags
    PublicIpAllocationMethod
    IpAddress
    PublicIpAddressVersion
    IdleTimeoutInMinutes
    IpConfiguration
    DnsSettings
    Zones
    Sku
    IpTags
    ExtendedLocation

    What value does it show under the IpConfiguration attribute? Is it empty, or does it show the ID of the virtual network gateway that you have deleted?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.