简体   繁体   English

Zip 部署 Azure function 成功但 Azure 中的函数为空

[英]Zip deploy of Azure function was a success but Functions in Azure is empty

Hi I have a Azure function timer which I am trying to deploy via ZIP deploy, it succeeds but Functions in Azure is empty.嗨,我有一个 Azure function 计时器,我正在尝试通过 ZIP 部署来部署它,它成功了,但是 Azure 中的函数是空的。

在此处输入图像描述

The cmd I am using for the deployment is az functionapp deployment source config-zip -g $resourceGroupName -n $functionName --src $sourceZipPath我用于部署的 cmd 是az functionapp deployment source config-zip -g $resourceGroupName -n $functionName --src $sourceZipPath

The JSON response from the cmd is as below.来自 cmd 的 JSON 响应如下。

{  "active": false,
  "author": "N/A",
  "author_email": "N/A",
  "complete": true,
  "deployer": "ZipDeploy",
  "end_time": "2022-03-25T12:37:54.9247211Z",
  "id": "373e929429a14bee8b6368949e922789",
  "is_readonly": true,
  "is_temp": false,
  "last_success_end_time": "2022-03-25T12:37:54.9247211Z",
  "log_url": "https://xxxx.scm.azurewebsites.net/api/deployments/latest/log",
  "message": "Created via a push deployment",
  "progress": "",
  "provisioningState": "Succeeded",
  "received_time": "2022-03-25T12:33:05.5662452Z",
  "site_name": "xxxx",
  "start_time": "2022-03-25T12:33:17.5130554Z",
  "status": 4,
  "status_text": "",
  "url": "https://xxxx.scm.azurewebsites.net/api/deployments/latest"
}

I can see all the files inside the file structure (screen shots below)我可以看到文件结构中的所有文件(下面的屏幕截图) 在此处输入图像描述 在此处输入图像描述

Not sure where I am going wrong.不知道我要去哪里错了。 It works perfectly when deployed from Visual Studio 2019.从 Visual Studio 2019 部署时,它可以完美运行。

I did check on the post "https://stackoverflow.com/questions/64032902/az-functionapp-deployment-reports-success-but-functions-view-in-azure-is-empt" and followed the steps but no luck.我确实检查了帖子“https://stackoverflow.com/questions/64032902/az-functionapp-deployment-reports-success-but-functions-view-in-azure-is-empt”并按照步骤操作但没有运气.

Can anyone suggest what else can I try.谁能建议我还能尝试什么。

I tried to reproduce the same issue while deploying the Azure Function using AZ CLI both from Local CLI and Azure CloudShell:我在使用本地 CLI 和 Azure CloudShell 中的 AZ CLI 部署 Azure Function 时尝试重现相同的问题:

az functionapp deployment source config-zip -g HariTestRG -n KrishNet6FuncApp --src "C:/Users/Hari/source/repos/DotNet6/TimerTrigger1205.zip"

在此处输入图像描述

在此处输入图像描述

As Per this GitHub Discussion , I came to know that the command az functionapp deployment source config-zip having the issue with AZ CLI versions and tried by downgrading to 2.28 version of Azure CLI but not succeeded the desired result.根据这个GitHub 讨论,我了解到命令az functionapp deployment source config-zip存在 AZ CLI 版本的问题,并尝试降级到 Azure CLI 的 2.28 版本,但没有取得预期的结果。

Command to downgrade the Azure CLI version:

$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://azcliprod.blob.core.windows.net/msi/azure-cli-2.28.0.msi -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi

Alternative workaround to this zip push deploy of Function Apps is using PowerShell Commands and working well . 886982359588 应用程序的 zip 推送部署的替代解决方法是使用 PowerShell 命令并且运行良好

Updated Answer更新的答案

After enabling the application setting SCM_DO_BUILD_DURING_DEPLOYMENT to true and deploying the Azure Function Zip using AZ CLI , it deployed successfully and shows the functions in the Azure Portal along with the files in the wwwroot folder.在启用应用程序设置SCM_DO_BUILD_DURING_DEPLOYMENTtrue并使用AZ CLI部署 Azure Function Zip 后,它成功部署并显示 Azure 门户中的功能以及wwwroot文件夹中的文件。

在此处输入图像描述

AZ CLI Command: AZ CLI 命令:

az functionapp deployment source config-zip -g HariTestRG -n KrishNet6FuncApp --src "C:/Users/Hari/source/repos/DotNet6/TimerTrigger1205.zip"

在此处输入图像描述

From this Microsoft Documentation , we came to know that some deployment customization has to be done before deploying the Function App as a Zip Push, ie, by default the app setting SCM_DO_BUILD_DURING_DEPLOYMENT is false which enables the continuous integration deployment.从这个Microsoft Documentation中,我们了解到在将 Function App 部署为 Zip Push 之前,必须进行一些部署自定义,即默认情况下,应用程序设置SCM_DO_BUILD_DURING_DEPLOYMENT为 false,从而启用持续集成部署。

For the PowerShell Workaround, refer this GitHub Page .对于 PowerShell 解决方法,请参阅此GitHub 页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure DevOps 部署到 function - 多个 zip 包 - Azure DevOps deploy to function - multiple zip packages Zip 从存储帐户部署 azure function - Zip deploy azure function from storage account 当 zip 使用 Azure CLI 或 PowerShell 部署 function 应用程序时,功能会被删除 - Functions get Remove when zip deploy function app using Azure CLI or PowerShell Zip-deploy Azure 在公共访问被禁用时运行(访问限制到位) - Zip-deploy Azure functions while public access is disabled (access regstrictions are in place) 部署Azure function到微软Azure中的应用服务 - Deploy Azure function to app service in Microsoft Azure mvn azure-functions:部署不适用于 docker - mvn azure-functions:deploy not working with docker 使用 bitbucket 管道在 .netcore 3 中部署 Azure 函数 - Deploy Azure Functions in netcore 3 with bitbucket pipeline Azure Function ServiceBusReceivedMessage 应用程序属性为空 - Azure Function ServiceBusReceivedMessage ApplicatonProperties are empty Azure 函数 HttpTrigger 404 在 Application Insights 中显示为成功 - Azure functions HttpTrigger 404 shows as success in Application Insights 如何将python app部署到Azure Function - How to deploy python app to Azure Function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM