Azure 启动脚本未执行
我已经学到了如何使用Azure Cli 部署.sh脚本到Azure。但是似乎我对它们的工作方式没有清楚的了解。
我正在创建脚本,该脚本仅在Azure Web应用程序当前目录中简单地将.tgz档案归档,然后将其删除。非常简单:
New-Item ./startup.sh
Set-Content ./startup.sh '#!/bin/sh'
Add-Content ./startup.sh 'tar zxvf archive.tgz; rm-rf ./archive.tgz'
然后我这样部署脚本:
az webapp deploy --resource-group Group
--name Name
--src-path ./startup.sh
--target-path /home/site/wwwroot/startup.sh
--type=startup
据说,它应该出现在/home/site/wwwroot/
中,但由于某种原因,它永远不会。不管我怎么尝试。我认为它只是被执行然后自动删除(因为我将其指定为 startup
脚本),但是存档在那里,根本不是不算什么。
我的堆栈是.NET核心。
我在做什么错,正确做我需要做的正确方法是什么?谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道这是否有意义,但我认为问题可能是您在使用
target-path
参数时,应该使用path
。来自,在描述Azure CLI功能时,他们说:
指示,描述类型的不同值,尤其是
启动
:注意
路径
的使用:我从未对其进行测试,我知道在接受
az webapp部署
命令本身,它可能只是文档中的一个错误,但它可能会工作:请注意:您提供的路径是默认的路径;结果,您可以在需要时安全地将其删除:
最后,尝试在脚本中包括一些调试或
echo
命令:也许可以激发任何权限问题的问题,并在日志中有一些痕迹也有帮助。I don't know if it makes sense, but I think the problem might be that you're using the
target-path
parameter while you should be usingpath
instead.From the documentation you cited, when describing the Azure CLI functionality, they state:
The Kudu publish API reference indicates, when describing the different values for type and especially
startup
:Note the use of
path
:I never tested it, I am aware that the option is not described when taking about the
az webapp deploy
command itself, and it may be just an error in the documentation, but it may work:Note that the path you are providing is the default one; as a consequence, you could safely delete it if required:
Finally, try including some debug or
echo
commands in your script: perhaps the problem can be motivated for any permissions issue and having some traces in the logs could be helpful as well.