Deleting Azure Function Published by Visual Studio

After we publish code from VS, Azure portal will set functions to be Read Only to prevent us editing pre-compiled assets in portal.

If we use web deploy(didn't check Run from package file),

enter image description here

Here are two choices:

  1. Delete all functions directly in portal. In portal, stop Function app then Platform features> App Service Editor, delete everything except host.json.

    Note: I once provided a plausible solution--Platform features> Function app settings, change Function app edit mode to Read/Write, then we are able to click delete button. In this way we can delete specific functions but actually we didn't delete pre-compiled dlls which may accumulate and cause trouble.

  2. Delete all old functions the next time we publish new ones. On publish panel, click Manage Profile Settings and check Remove additional files at destination.

    enter image description here

If we have checked Run from package file when publishing, then none of those means could work. In addition to publish again, we can go to Platform features> Application settings, remove WEBSITE_RUN_FROM_PACKAGE under Application settings section and function app will become empty. Refer to announcement of Run from package for more info.

With this approach, file will also accumulate in silence but it won't cause error to new functions. To remove old files, Platform features> Advanced tools (Kudu)> Debug console(CMD) and navigate to d:\home\data\SitePackages to delete zips not in use.