使用Azure CLI或PowerShell时ZIP部署功能应用程序时,功能将删除

发布于 2025-01-22 15:35:55 字数 602 浏览 0 评论 0 原文

我在使用Azure CLI或Azure PowerShell部署Azure功能时面临问题。

我已经创建了所需的资源,例如资源组,功能应用和BLOB存储。

我的功能应用程序平台类型是 Linux 带有消耗计划和运行时Net6.0。我已经创建了Service Bus Trigger功能并使用Visual Studio Publish Profile部署,并且可以按预期工作。

但是,当我执行命令以使用CLI部署Azure函数时。命令正在成功执行,但是当我从Azure Portal打开函数应用程序并转到功能刀片时,部署的函数不会出现。

中所述的构建输出的文件夹结构

我还检查了link https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push

任何帮助都将不胜感激。

谢谢

I'm facing an issue while deploying the azure function using Azure CLI or Azure PowerShell.

I have already created needed resources like resource group, function app and blob storage.

My function app platform type is Linux with consumption plan and runtime net6.0. I have created Service Bus trigger function and deployed using Visual Studio Publish profile and it is working as expected.

But when I executed the command to deploy the Azure function using CLI. Command is executing successfully but when I open the function app from azure portal and go to functions blade the deployed functions do not appear there.

I also checked the folder structure of the build output as mentioned in the link

https://learn.microsoft.com/en-us/azure/azure-functions/deployment-zip-push

any help would be appreciated.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最单纯的乌龟 2025-01-29 15:35:56

使用az-cli

az functionapp deployment source config-zip -g <Resource Group> -n <Function App Name> --src <Function Project with Zip>

“

“


在设置 scm_do_do_build_derdury_deployment true true 在配置中的true az cli 命令再次部署,并在 wwwroot 文件夹的Portal和Kudu站点中显示了功能。

“在此处输入图像说明”

az cli命令:

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

”在此处输入图像描述

根据此 ms doc ,我们知道必须在将函数应用程序作为zip push(即,默认情况下)app app设置<代码 scm_do_build_dury_deployment 是false,可以连续集成部署。

对于PowerShell解决方法,请参阅

Reproduced the same issue from our end using Az-CLI

az functionapp deployment source config-zip -g <Resource Group> -n <Function App Name> --src <Function Project with Zip>

enter image description here

enter image description here


Workaround to fix the issue

After setting SCM_DO_BUILD_DURING_DEPLOYMENT to true in Configuration > Application Settings of the Azure Function App in Portal and deployed again using AZ CLI commands and shown the functions in Portal and in Kudu site of wwwroot folder.

enter image description here

AZ CLI Command:

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

enter image description here

According to this MS DOC, we came to know that some deployment customization has to be done before deploying the Function App as a Zip Push, i.e., by default the app setting SCM_DO_BUILD_DURING_DEPLOYMENT is false which enables the continuous integration deployment.

For the PowerShell Workaround, refer GitHub Page.

寻梦旅人 2025-01-29 15:35:56

在消费计划中运行Linux OS上的功能应用程序的部署选项有限,但仅支持远程构建。

要在Linux上启用远程构建,必须设置以下应用程序设置:

ENABLE_ORYX_BUILD=true
SCM_DO_BUILD_DURING_DEPLOYMENT=true

如果您的项目需要使用远程构建,请不要使用
weblition_run_from_package 应用程序设置。

功能核心工具是唯一的解决方案对我而言。
默认情况下,Azure函数核心工具部署到Linux时会执行远程构建。因此,它会在Azure自动为您创建这些设置。

func azure functionapp publish <FunctionAppName>

我的自定义脚本文件,

param(
[Parameter(Mandatory=$True)]
$AppName,
[Parameter(Mandatory=$True)]
$LocalProjectPath
)

cd "$($LocalProjectPath)"

func azure functionapp publish $AppName

cd ..

如果您需要 linux托管的更多帮助使用此链接 zip deploymnet 获取与 Azure函数部署有关的详细信息

Function App running on Linux OS in consumption plan has limited deployment options but supports only remote build.

To enable remote build on Linux, the following application settings must be set:

ENABLE_ORYX_BUILD=true
SCM_DO_BUILD_DURING_DEPLOYMENT=true

If your project needs to use remote build, don't use the
WEBSITE_RUN_FROM_PACKAGE app setting.

Functions Core Tools is the only solution work for me.
By default, Azure Functions Core Tool perform remote builds when deploying to Linux. Because of this, it automatically create these settings for you in Azure.

func azure functionapp publish <FunctionAppName>

my custom script file

param(
[Parameter(Mandatory=$True)]
$AppName,
[Parameter(Mandatory=$True)]
$LocalProjectPath
)

cd "$($LocalProjectPath)"

func azure functionapp publish $AppName

cd ..

if you need more help with Linux hosting use this link Zip Deploymnet to get detailed information related to Azure Functions Deployments.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文