One function app may contain multiple functions and hence deleting the whole function app if only one function is corrupted may be overkill. For those in this situation deleting the function folder in the Kudu console/using powershell is a better way.
USING KUDU CONSOLE
- Go to
https://<yourFunctionApp>.scm.azurewebsites.net
- Click on
DEBUG(top bar) -> CMD
and in the new page that appears navigate to site -> wwwroot
- Find your function there and delete it (click on the icon to the right of the Edit/pencil icon)
USING POWERSHELL
(based on this)
$username = '<publish username>' #IMPORTANT: use single quotes as username may contain $
$password = "<publish password>"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$commandBody = @{
command = "rm -d -r myAzureFunction"
dir = "site\\wwwroot"
}
$deleteUrl = "https://<myFunctionApp>.scm.azurewebsites.net/api/command"
Invoke-RestMethod -Uri $deleteUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method POST `
-ContentType "application/json" -Body (ConvertTo-Json $commandBody)
The publish username and publish password can be obtained as detailed here
$creds = Invoke-AzureRmResourceAction -ResourceGroupName YourResourceGroup -ResourceType Microsoft.Web/sites/config -ResourceName YourWebApp/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force
$username = $creds.Properties.PublishingUserName
$password = $creds.Properties.PublishingPassword