I created a Azure Private Endpoint for a storage account. When I deleted the resource group it seems the storage got deleted first and Private endpoint still points to stale storage account. I could not delete the private endpoint any more.
I cannot delete even with force option.
PS /home/user1> Remove-AzResource -ResourceId /subscriptions/subcription-id/resourceGroups/Testing007/providers/Microsoft.Network/privateEndpoints/pe022 -Force
Remove-AzResource: InternalServerError : An error occurred.
CorrelationId: 45bf24f4-7198-4893-9aa0-5cb527874ba7
PS /home/user1> Remove-AzPrivateEndpoint -ResourceGroupName Testing007 -Name pe022 -Force
Remove-AzPrivateEndpoint: Long running operation failed with status 'Failed'. Additional Info:'An error occurred.'
StatusCode: 200
ReasonPhrase: OK
Status: Failed
ErrorCode: InternalServerError
ErrorMessage: An error occurred.
I couldn't reproduce your scenario but would be interested in knowing more about the "internal error". Could you please run the
Remove-AzPrivateEndpoint
cmdlet passing-Debug
along? Did you see the same error when deleting it from Azure portal?I also found that clearing the
PrivateLinkServiceConnections
property or updatingPrivateLinkServiceId
manually does not help.Looks like there was a similar incident in the past that was fixed, but I'm afraid reaching out to Support is the only way out if it's a dangling endpoint not fixable from the command line.