删除损坏的Azure功能应用程序

时间:2016-08-16 17:35:12

标签: azure azure-functions

我创建了一个函数应用程序然后创建了一个函数,函数名默认为TriggerCSharp1或类似。

添加代码后,我想知道如何更改函数名称,所以我尝试了Ftp进入函数应用程序并手动更改了文件夹名TriggerCSharp1。我回到了Azure门户,现在当我点击功能应用程序时,我收到错误The access token is invalid.,下面没有任何内容,请参阅下面的屏幕截图。

enter image description here

我不知道如何删除此功能应用程序,因为我无法进入其刀片。我现在能想到的唯一方法就是删除包含这个功能应用程序的资源组,但这不是我可以做的事情,因为我也有很多其他资源。

3 个答案:

答案 0 :(得分:1)

修改 正如大卫所建议的,resources.azure.com更容易,不需要客户端位。

使用命令azure site delete <site name>

使用Azure-CLI解决

答案 1 :(得分:1)

一个功能应用程序可能包含多个功能,因此如果只有一个功能被破坏,则删除整个功能应用程序可能过度。对于那些在这种情况下删除Kudu控制台中的函数文件夹/使用powershell是一种更好的方法。

使用KUDU CONSOLE

  1. 转到https://<yourFunctionApp>.scm.azurewebsites.net
  2. 点击DEBUG(top bar) -> CMD,然后在显示的新页面中导航至site -> wwwroot
  3. 在那里找到你的功能并将其删除(点击编辑/铅笔图标右侧的图标)
  4. 使用POWERSHELL  (基于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) 
    

    发布用户名和发布密码可以按详细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
    

答案 2 :(得分:0)

如果您想在PowerShell中执行此操作,则以下内容应该有效...

Login-AzureRmAccount  #Enter your username / pw
$funcApp = Get-AzureRmWebApp -Name "Your Function App Name"
Remove-AzureRmWebApp -WebApp $funcApp

如果您有多个订阅,请确保使用正确的订阅。如果您不想要检查提示,也可以在remove命令中添加-Confirm:$ true。