Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to auto-generate deploy.cmd in new Azure CLI?

I'm following this guide to create a web app with a custom deploy.cmd file. The article suggests that I can get a copy of the current deploy.cmd file (which I'll then modify) using the following command:

azure site deploymentscript --python

Unfortunately, when I install the Azure CLI using the MSI linked in the article, there is no azure binary on my path. I do have az -- is this a newer version of the same CLI? -- but I can't find an equivalent deployment script generation command for that executable.

I found a deploy.cmd file using Kudu (under D:\home\site\deployments\tools) but am not sure if that's the appropriate file to use. Can anyone suggest the right Azure CLI command for deployment script generation, or confirm that the deploy.cmd file I found is the right one to modify? Thanks in advance!

like image 264
mewahl Avatar asked May 25 '17 14:05

mewahl


People also ask

Which command is used to deploy a package application to Windows Azure?

Deploy a ZIP package to your web app by using the az webapp deploy command.

How do I deploy Azure code?

Deploy by using Visual Studio. If you have the Visual Studio solution, right-click the web application project, and then select Publish. Deploy by using an FTP client. In the Azure portal, download the publish profile for the web app that you want to deploy your code to.


2 Answers

Based on my knowledge, there is not an equivalent to azure site deploymentscript in azure cli(2.0). So, you could not do deploy custom script with Azure CLI 2.0.

You had better know the difference between Azure cli 2.0(az) with 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.

For your scenario, if you could install Azure ClI 1.0, you could refer to this link to install Azure CLI 1.0.

Instead of using the command line to generate a starter deployment script, there is an alternative approach that is often easier:

  • Deploy your repo without any deployment scripts.
  • Go to the site's Kudu Console.
  • From the Tools menu, choose 'Download deployment script'. You'll get a zip with a .deployment and deploy.cmd files.
  • Commit both files at the root of your repo
  • Tweak them as needed

More information please refer to this link.

like image 172
Shui shengbao Avatar answered Sep 25 '22 15:09

Shui shengbao


You can use kuduscript to generate the deployment script.

npm install -g kuduscript
kuduscript --python

Here is the list of options

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).
like image 39
ThunderDev Avatar answered Sep 22 '22 15:09

ThunderDev