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,337 questions
0 comments No comments
{count} votes

2 answers

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

  2. VenkateshDodda-MSFT 23,691 Reputation points Microsoft Employee
    2024-12-23T03:55:31.17+00:00

    @Vadym Tarasov

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Unable to delete the function App integrated with Vnet.

    Solution:

    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.

    If you have any other questions or are still running into more issues, please let me know. Thank you again for your time and patience throughout this issue.

    Please accept as Yes if the answer is helpful so that it can help others in the community.

    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.