I have published an Azure Function through visual studio. Now I want to delete the published Azure function and the button to delete is disabled. Is there a way to delete the azure function published from VS?
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
),
Here are two choices:
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
, changeFunction app edit mode
toRead/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.Delete all old functions the next time we publish new ones. On publish panel, click
Manage Profile Settings
and checkRemove additional files at destination
.
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.
It seems this issue has been resolved in Azure.
- Remove the unwanted functions from code
- STOP your Azure function App in Azure portal
- Enable "Remove additional files at destination" option in profile settings popup
- Republish the solution again and all the removed functions will be deleted from Azure Portal.
The simplest way is to delete all functions is to do this:
- Change WEBSITE_RUN_FROM_PACKAGE to 0 in the portal for the function application you want to deal with
- This will allow you to create a scripted function in the portal for the given application
- Create one function and this actions will delete all other functions that came from the package.
© 2022 - 2024 — McMap. All rights reserved.