如何在新的 Azure CLI 中自动生成 deploy.cmd?
How to auto-generate deploy.cmd in new Azure CLI?
我正在关注 this guide 创建一个带有自定义 deploy.cmd
文件的网络应用程序。文章建议我可以使用以下命令获取当前 deploy.cmd
文件的副本(然后我将对其进行修改):
azure site deploymentscript --python
不幸的是,当我使用文章中链接的 MSI 安装 Azure CLI 时,我的路径中没有 azure
二进制文件。我确实有 az
-- 这是同一 CLI 的更新版本吗? -- 但我找不到该可执行文件的等效部署脚本生成命令。
我找到了一个使用 Kudu 的 deploy.cmd
文件(在 D:\home\site\deployments\tools
下),但不确定该文件是否适合使用。任何人都可以建议正确的 Azure CLI 命令来生成部署脚本,或者确认我找到的 deploy.cmd
文件是要修改的正确文件吗?提前致谢!
据我所知,在 azure cli(2.0) 中没有等同于 azure site deploymentscript
的东西。因此,您无法使用 Azure CLI 2.0 部署自定义脚本。
你最好知道Azure cli 2.0(az)和Azure cli 1.0(azure)的区别。
Azure CLI 2.0: Our next-generation CLI written in Python, for use with
the Resource Manager deployment model.
Azure CLI 1.0: Our CLI written in Node.js, for use with both the
classic and Resource Managerdeployment models.
对于您的场景,如果您可以安装 Azure CLI 1.0,您可以参考此link安装 Azure CLI 1.0。
除了使用命令行生成入门部署脚本之外,还有一种通常更简单的替代方法:
- 在没有任何部署脚本的情况下部署您的存储库。
- 转到站点 Kudu Console。
- 从“工具”菜单中选择 'Download deployment script'。您将获得一个包含 .deployment 和 deploy.cmd 文件的 zip。
- 将这两个文件提交到你的 repo 的根目录下
- 根据需要调整它们
更多信息请参考此link。
您可以使用kuduscript生成部署脚本。
npm install -g kuduscript
kuduscript --python
这是选项列表
Options:
-h, --help output usage information
-V, --version output the version number
-r, --repositoryRoot [dir path] The root path for the repository (default: .)
--aspWAP <projectFilePath> Create a deployment script for .NET web application, specify the project file path
--aspNetCore <projectFilePath> Create a deployment script for ASP.NET Core web application, specify the project file path
--aspWebSite Create a deployment script for basic website
--go Create a deployment script for Go website
--node Create a deployment script for node.js website
--ruby Create a deployment script for ruby website
--php Create a deployment script for php website
--python Create a deployment script for python website
--functionApp [projectFilePath] Create a deployment script for function App, specify the project file path if using msbuild
--basic Create a deployment script for any other website
--dotNetConsole <projectFilePath> Create a deployment script for .NET console application, specify the project file path
-s, --solutionFile <file path> The solution file path (sln)
-p, --sitePath <directory path> The path to the site being deployed (default: same as repositoryRoot)
-t, --scriptType <batch|bash|posh> The script output type (default: batch)
-o, --outputPath <output path> The path to output generated script (default: same as repository root)
-y, --suppressPrompt Suppresses prompting to confirm you want to overwrite an existing destination file.
--no-dot-deployment Do not generate the .deployment file.
--no-solution Do not require a solution file path (only for --aspWAP otherwise ignored).
我正在关注 this guide 创建一个带有自定义 deploy.cmd
文件的网络应用程序。文章建议我可以使用以下命令获取当前 deploy.cmd
文件的副本(然后我将对其进行修改):
azure site deploymentscript --python
不幸的是,当我使用文章中链接的 MSI 安装 Azure CLI 时,我的路径中没有 azure
二进制文件。我确实有 az
-- 这是同一 CLI 的更新版本吗? -- 但我找不到该可执行文件的等效部署脚本生成命令。
我找到了一个使用 Kudu 的 deploy.cmd
文件(在 D:\home\site\deployments\tools
下),但不确定该文件是否适合使用。任何人都可以建议正确的 Azure CLI 命令来生成部署脚本,或者确认我找到的 deploy.cmd
文件是要修改的正确文件吗?提前致谢!
据我所知,在 azure cli(2.0) 中没有等同于 azure site deploymentscript
的东西。因此,您无法使用 Azure CLI 2.0 部署自定义脚本。
你最好知道Azure cli 2.0(az)和Azure cli 1.0(azure)的区别。
Azure CLI 2.0: Our next-generation CLI written in Python, for use with the Resource Manager deployment model.
Azure CLI 1.0: Our CLI written in Node.js, for use with both the classic and Resource Managerdeployment models.
对于您的场景,如果您可以安装 Azure CLI 1.0,您可以参考此link安装 Azure CLI 1.0。
除了使用命令行生成入门部署脚本之外,还有一种通常更简单的替代方法:
- 在没有任何部署脚本的情况下部署您的存储库。
- 转到站点 Kudu Console。
- 从“工具”菜单中选择 'Download deployment script'。您将获得一个包含 .deployment 和 deploy.cmd 文件的 zip。
- 将这两个文件提交到你的 repo 的根目录下
- 根据需要调整它们
更多信息请参考此link。
您可以使用kuduscript生成部署脚本。
npm install -g kuduscript
kuduscript --python
这是选项列表
Options:
-h, --help output usage information
-V, --version output the version number
-r, --repositoryRoot [dir path] The root path for the repository (default: .)
--aspWAP <projectFilePath> Create a deployment script for .NET web application, specify the project file path
--aspNetCore <projectFilePath> Create a deployment script for ASP.NET Core web application, specify the project file path
--aspWebSite Create a deployment script for basic website
--go Create a deployment script for Go website
--node Create a deployment script for node.js website
--ruby Create a deployment script for ruby website
--php Create a deployment script for php website
--python Create a deployment script for python website
--functionApp [projectFilePath] Create a deployment script for function App, specify the project file path if using msbuild
--basic Create a deployment script for any other website
--dotNetConsole <projectFilePath> Create a deployment script for .NET console application, specify the project file path
-s, --solutionFile <file path> The solution file path (sln)
-p, --sitePath <directory path> The path to the site being deployed (default: same as repositoryRoot)
-t, --scriptType <batch|bash|posh> The script output type (default: batch)
-o, --outputPath <output path> The path to output generated script (default: same as repository root)
-y, --suppressPrompt Suppresses prompting to confirm you want to overwrite an existing destination file.
--no-dot-deployment Do not generate the .deployment file.
--no-solution Do not require a solution file path (only for --aspWAP otherwise ignored).