Filler to delete Public IP prefix (InternalServerError)

Wasim Al Sabbouh 1 Reputation point
2022-05-23T18:22:29.477+00:00

Hi,

After creating resources using Terraform, I tried to destroy (delete) them using terraform destroy command, however, the Public IP Prefix is having trouble getting deleted, This is the error:

204792-image.png

The same error appears on the Azure console when trying to delete the Public IP prefix:
204679-image.png

Part of the JSON output that shows the error:

"properties": {  
        "statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\",\"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"InternalServerError\",\"message\":\"An error occurred.\",\"details\":[]}]}}",  
        "eventCategory": "Administrative",  
        "entity": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/xxxxxx/providers/Microsoft.Network/publicIPPrefixes/publicIpPrefixSpot01",  
        "message": "Microsoft.Network/publicIPPrefixes/delete",  
        "hierarchy": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxxxxx/xxxxxxxx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"  
    },  
    "relatedEvents": []  
}  

Trying to delete the resource from the Azure CLI results in the same error:
204803-error.png

I usually create the same infrastructure every day for development purposes and destroy it by the end of the day, never had an issue. This is the first time I get such error! The error is vague and has no details.

Does anyone have any idea of what I may have done wrong here?

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.
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. ChaitanyaNaykodi-MSFT 27,646 Reputation points Microsoft Employee Moderator
    2022-05-23T20:45:46.38+00:00

    Hello @Wasim Al Sabbouh , Welcome to the Microsoft Q&A forum.

    As I understand from the question above you are unable to delete a public IP prefix using both AZ CLI and Terraform and you are receiving an InternalServerError. You can try below mentioned steps and see if this helps resolve the issue.

    • As documented here you can't delete a prefix if any addresses within it are assigned to public IP address resources associated to a resource. Dissociate all public IP address resources that are assigned IP addresses from the prefix first. This is the most common issue if you are unable to delete any public IP prefix. Although when deleting such public IP prefix we get an intelligent error like InUsePublicIpPrefixCannotBeDeleted (as shown in screenshot below), but it might help if you can check if the Public IPs are still associated with any resource like a VM, Azure Firewall, any DNAT rule etc.

    204796-image.png

    • If any of the IP's are not associated with any resource and as the error received is not helpful. Can you try deleting the IP prefix again and see if that resolves this issue as this might be a transient error.
    • If this does not resolve the issue, it might be helpful if you could create a support ticket in this case. Please let me know if you do not have support plan.

    Hope this helps! Thank you!


  2. Wasim Al Sabbouh 1 Reputation point
    2022-05-26T06:58:33.663+00:00

    Hi @ChaitanyaNaykodi-MSFT , thanks, and sorry for my late response!

    I tried to update the IP Prefix as advised, it took the resource's ProvisioningState from Failed to Succeeded, however, as soon as I perform delete action from the CLI or the portal it fails and the state goes back to Failed. See the below screenshot:

    205725-image.png

    I also tried to add a Public IP address to the Prefix, however, it returned an error because the Prefix is in Failed state. I Updated the Prefix, created a Public IP, tried to delete the Prefix, and got InUsePublicIpPrefixCannotBeDeleted, deleted the IP Address, while the Prefix was still in Succeded state I tried to delete the Prefix again and got the same error.

    205772-image.png

    I don't see any private messages; not sure if I'm missing something here as I'm new to this platform. Please advise!


  3. Wasim Al Sabbouh 1 Reputation point
    2022-06-23T15:35:38.487+00:00

    Just an update if anyone in the future has the same issue. Deleting the resource from the Azure portal, CLI or SDK was not possible. Microsoft support team (Product Group) had to manually remove the existing allocation for the Public IP Prefix to make me able to delete the resource.

    Maybe it's worth mentioning that it took them 21 days to solve it, from the day I opened the ticket till the day it was resolved.

    0 comments No comments

Your answer

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