Unable to delete or disable an azure function in Azure function App(Consumption Plan)

Vivek Kumar 45 Reputation points
2025-02-18T15:35:51.45+00:00

Hi everyone,

I created the Azure function app using the consumption plan and then added a function inside it using the Azure portal. However, I'm facing an issue where I'm unable to delete or disable the function. Both options are visible in the pane but appear faded and are not clickable.
User's image

User's image

I can disable the function by creating an app setting(environment variable) in the format AzureWebJobs.<FUNCTION_NAME>.Disabled and setting it to true. But still Enable and Delete are disabled after creating this setting.

**Note: We can only disable a function if the function app is running. Not sure about Delete though (I have tried with both after starting and stopping the app)
Also, going through previous posts, I noticed that the line "Your app is currently in read-only mode because you are running from a package file." this issue is not present on my app.

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

1 answer

Sort by: Most helpful
  1. Khadeer Ali 5,990 Reputation points Microsoft External Staff Moderator
    2025-02-20T12:44:21.3066667+00:00

    @Vivek Kumar ,

    Thanks for your response. Since WEBSITE_RUN_FROM_PACKAGE is not present and you already have the Contributor role, let’s explore alternative ways to delete the function and troubleshoot the disabled buttons further.

    Deleting Function from Function App

    You can delete the function using either the Azure REST API or Azure CLI:

    Using REST API:

    DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions/{functionName}?api-version=2024-04-01

    Replace {subscriptionId}, {resourceGroupName}, {name}, and {functionName} with the correct values.

    Using Azure CLI:

    az functionapp function delete --function-name <FunctionName> --name <FunctionAppName> --resource-group <ResourceGroupName>

    Reference :

    https://learn.microsoft.com/en-us/cli/azure/functionapp/function?view=azure-cli-latest#az-functionapp-function-delete
    https://learn.microsoft.com/en-us/rest/api/appservice/web-apps/delete-function?view=rest-appservice-2024-04-01#code-try-0


    Checking "Remove Additional Files at Destination" & Deployment Profile

    Since you deployed via VS Code, this setting is not directly available. However, in Visual Studio, you can find it in the Publish Profile:

    1. Open Visual Studio.
    2. Go to Solution Explorer → Right-click on your Function App project → Click Publish.
    3. Under Deployment Settings, look for "Remove additional files at destination" and enable it before redeploying.

    Since you used VS Code, you may need to manually clean up the function files using Kudu or Azure CLI before redeploying.


    Why are the Delete & Disable Buttons Disabled?

    This seems to be an issue with RBAC roles or permissions. Can you try the following and let us know if the issue persists?

    1. Try adding the Website Contributor role and check whether the "Disable" and "Delete" buttons become enabled. If the issue persists, try removing the Website Contributor role.
    2. Try creating a custom role using the following permissions:
      • microsoft.web/sites/functions/delete
      • microsoft.web/sites/functions/action
      • microsoft.web/sites/functions/write

    Let me know how it goes or if you need further assistance!


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.