您好,我有一个 Azure 函数计时器,我正在尝试通过 ZIP 部署进行部署,它成功了,但 Azure 中的函数是空的。
我用于部署的 cmd 是 az functionapp deployment source config-zip -g $resourceGroupName -n $functionName --src $sourceZipPath
来自 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"
}
Run Code Online (Sandbox Code Playgroud)
不知道我哪里出错了。从 Visual Studio 2019 部署时它可以完美运行。
我确实检查了帖子“/sf/ask/4482303171/”并按照步骤操作,但没有运气。
谁能建议我还能尝试什么。
小智 3
我尝试在本地 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"
Run Code Online (Sandbox Code Playgroud)


根据此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
Run Code Online (Sandbox Code Playgroud)
Function Apps 的 zip 推送部署的替代解决方法是使用 PowerShell 命令并且运行良好。
启用应用程序设置并使用 部署 Azure Function Zip 后SCM_DO_BUILD_DURING_DEPLOYMENT,true部署AZ CLI成功并显示 Azure 门户中的函数以及文件夹中的文件wwwroot。

AZ CLI 命令:
az functionapp deployment source config-zip -g HariTestRG -n KrishNet6FuncApp --src "C:/Users/Hari/source/repos/DotNet6/TimerTrigger1205.zip"
Run Code Online (Sandbox Code Playgroud)

从这份Microsoft 文档中,我们了解到,在将 Function App 部署为 Zip Push 之前,必须完成一些部署自定义,即默认情况下应用程序设置SCM_DO_BUILD_DURING_DEPLOYMENT为 false,这将启用持续集成部署。
有关 PowerShell 解决方法,请参阅此GitHub 页面。
| 归档时间: |
|
| 查看次数: |
6580 次 |
| 最近记录: |