Adventures with Azure DevOps: .azcli Files to .sh

I am building a pipeline for deploying my application, the first thing I needed to do was deploy my Azure resources.

I have a tendency to be more imperative with my deployment strategy, using Azure PowerShell and Azure CLI over Azure Resource Management (ARM) templates.

I use Visual Studio Code to code my azure-pipelines.yml file, Azure Powershell, *.ps1, and Azure CLI, *.azcli files.

I use the .azcli file extension for the Visual Studio Code integration.

It seems though that the AzureCLI@2 task only wants to run files with an extension of .sh.

Fully qualified path of the script(.ps1 or .bat or .cmd when using Windows-based agent else .ps1 or .sh when using linux-based agent) or a path relative to the default working directory

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-cli?view=azure-devops

Assuming my findings are correct, I think I am going to have to duplicate my .azcli files and assign the .sh extension.

I have a file called CreateResourceGroups.azcli that contains the following script:

I created another file, called CreateBashScripts.ps1, that contains the following:

And then in my azure-pipelines.yml I have the following:

That seems to do the trick!

Now I get all the VS Code support for .azcli files and simply copy and rename them so Azure DevOps can run them.

If there is a better way, or I am totally missing something, please share!

Leave a Reply

Your email address will not be published. Required fields are marked *