Deleting Azure Function Published by Visual Studio
Asked Answered
E

3

12

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?

Exequies answered 18/8, 2018 at 12:14 Comment(0)
P
14

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.

Perished answered 18/8, 2018 at 13:49 Comment(0)
C
1

It seems this issue has been resolved in Azure.

  1. Remove the unwanted functions from code
  2. STOP your Azure function App in Azure portal
  3. Enable "Remove additional files at destination" option in profile settings popup
  4. Republish the solution again and all the removed functions will be deleted from Azure Portal.
Convoluted answered 8/9, 2020 at 16:25 Comment(0)
R
0

The simplest way is to delete all functions is to do this:

  1. Change WEBSITE_RUN_FROM_PACKAGE to 0 in the portal for the function application you want to deal with
  2. This will allow you to create a scripted function in the portal for the given application
  3. Create one function and this actions will delete all other functions that came from the package.
Rawdan answered 3/9, 2019 at 12:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.