Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting Azure Function Published by Visual Studio

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?

like image 298
Shiju Samuel Avatar asked Aug 18 '18 12:08

Shiju Samuel


People also ask

How do I delete files from Azure function app?

If you cannot have a DevOps pipeline, use Azure CLI or Powershell to deploy your code. This will create a publish package in bin\release\<framework>publish folder. Zip the content of the publish folder. This should clear the files that are not part of your currently deploying zip.

How do I change the Azure function in Visual Studio?

In the Azure portal, browse to your function app. Under Settings, choose Configuration. In the Function runtime settings tab, locate the Runtime version. Note the specific runtime version.


Video Answer


1 Answers

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.

like image 75
Jerry Liu Avatar answered Oct 13 '22 17:10

Jerry Liu