This article is about CodeShip Basic.

Deployment With Azure CLI

You will need about one minute to read this article.

Azure Deployments

Deployments to Azure can be done using the Azure CLI directly on a CodeShip Basic build machine similar to how you might use the CLI locally.

You will need to install the CLI, configure your authentication with environment variables and then define the CLI commands you want to run as a custom-script deployment pipeline.

Installing The CLI

The Azure CLI does not come pre-installed on CodeShip Basic build machines.

Please add the following commands in the Setup Commands section of your test settings to install the Azure CLI:

AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] $AZ_REPO main" | sudo tee /etc/apt/sources.list.d/azure-cli.list
curl -L | sudo apt-key add -
sudo apt-get update && sudo apt-get install azure-cli

Configuring Authentication

Once the CLI is installed, you will need to run the appropriate Azure login commands in your project’s setup commands or at the start of your custom-script deployment pipeline.

The easiest way to keep the authentication secure is to use environment variables to store the username and password, and to pass those to your Azure login commands.

Deployment Scripting

You will need to create a new custom-script deployment pipeline to run the Azure CLI commands you need for your deployment.

These commands will run every time the branch the deployment pipeline is associated with is updated. They are not CodeShip specific and will be standard Azure CLI input.

Azure CLI Information

Read more about the Azure CLI for more information on using the CLI as well as complete documentation on what commands can be run with it.

Need more help?

Contact our support team or post on Stack Overflow using the tag #codeship. Did you check the status page and changelog?

There are also several code examples and sample projects available for you to get started with.

Article not helpful?

Does this article need improvement? If so, please send feedback or submit a pull request!