Can not delete a Function

Vadym Tarasov 0 Reputation points
2024-12-22T08:43:14.6966667+00:00

Hi there,

Removing a function failed with an error:

An operation on the Virtual Network has failed. Details: {"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.Network/virtualNetworks/vnet-myvnetname' under resource group 'rg-mygroupname' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}}

To create a function I followed Tutorial: Integrate Azure Functions with an Azure virtual network by using private endpoints. After testing I tried to clean up the resources using az cli

as group delete --name 'rg-mygroupname'

The same error when using Azure Portal and az functionapp delete

It took 12 hours to run but a function and application service plan are not removed but all other resources are deleted. And resource group status is success again not deleting.

As I understand the problem is vnet-myvnetname is removed but myfunction is still referring to one of the subnet. But vnet is already removed.

az functionapp vnet-integration list --name myfunction -g rg-mygroupname

I am getting an error above when trying to remove vnet-integraion:

az functionapp vnet-integration remove --name myfunction -g rg-mygroupname

How can I remove an Azure Function app in this situation?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,248 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vadym Tarasov 0 Reputation points
    2024-12-22T09:57:11.5033333+00:00

    Found a solution to resolve my issue:

    1. Create a new Azure VNet and subnet with the exact same names
    2. Run az functionapp vnet-integration remove --name myfunction -g rg-mygroupname
    3. Run az functionapp delete --name fnapp-vivethere3 -g rg-vivethere3

    Reason of issue:

    I have tried to delete an Azure Function without disconnecting the VNet integration first.

    0 comments No comments

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.