https://github.com/circleci-public/azure-cli-orb
CircleCI orb to install and configure the Azure CLI
https://github.com/circleci-public/azure-cli-orb
azure azure-cli circleci circleci-orbs
Last synced: 4 months ago
JSON representation
CircleCI orb to install and configure the Azure CLI
- Host: GitHub
- URL: https://github.com/circleci-public/azure-cli-orb
- Owner: CircleCI-Public
- License: mit
- Created: 2019-01-03T17:01:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-02-19T15:40:07.000Z (8 months ago)
- Last Synced: 2025-03-27T07:35:49.210Z (7 months ago)
- Topics: azure, azure-cli, circleci, circleci-orbs
- Language: Shell
- Homepage: https://circleci.com/orbs/registry/orb/circleci/azure-cli
- Size: 137 KB
- Stars: 2
- Watchers: 10
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Azure CLI Orb [](https://circleci.com/gh/CircleCI-Public/azure-cli-orb) [](https://circleci.com/orbs/registry/orb/circleci/azure-cli) [](https://raw.githubusercontent.com/CircleCI-Public/azure-cli-orb/master/LICENSE) [](https://discuss.circleci.com/c/ecosystem/orbs)
A CircleCI Orb to install and log into the Azure CLI
## Features
This orb offers the ability to login via an Azure user both on its default tenant and an alternative tenant.
It also offers the ability to login via an Azure Service Principal.### Executors
#### `default`
Debian-based [`circleci/python` Docker image](https://hub.docker.com/r/circleci/python) to use##### Parameters
| Parameter | type | default |
|-----------|------|---------|
| `python-version` | `string` | `2.7` |
| `debian-release` | `string` | `stretch` |#### `azure-docker`
Microsoft's [Azure CLI Docker image](https://hub.docker.com/r/microsoft/azure-cli):```yaml
docker:
- image: mcr.microsoft.com/azure-cli
```### Commands
You may use the following commands provided by this orb directly from your own job.- [**install**](#install) - Installs the Azure CLI on Debian based systems
- [**login-with-user**](#login-with-user) - Allows you to login to the Azure CLI with an Azure user.
- [**login-with-service-principal**](#login-with-service-principal) - Allows you to login to the Azure CLI with a Service Principal
- [**login-with-user-or-service-principal**](#login-with-user-or-service-principal) - Allows you to login to the Azure CLI, where the login type (user/Service Principal) is determined based on detection of the relevant environment variables.
#### `install`
##### Example
```yaml
version: 2.1orbs:
azure-cli: circleci/azure-cli@1.0.0jobs:
verify-install:
executor: azure-cli/default
steps:
- azure-cli/install- run:
name: Verify Azure CLI is installed
command: az -vworkflows:
example-workflow:
jobs:
- verify-install
```#### `login-with-user`
##### Parameters
| Parameter | type | default | description |
|-----------|------|---------|-------------|
| `azure-username` | `env_var_name` | `AZURE_USERNAME` | Environment variable storing your Azure username |
| `azure-password` | `env_var_name` | `AZURE_PASSWORD` | Environment variable storing your Azure password |
| `alternate-tenant` | `boolean` | `false` | Set to True to use the `--tenant az` login option |
| `azure-tenant` | `env_var_name` | `AZURE_TENANT` | Environment variable storing your Azure tenant, necessary if `alternate-tenant` is set to true |##### Example
```yaml
version: 2.1orbs:
azure-cli: circleci/azure-cli@1.0.0jobs:
login-to-azure:
executor: azure-cli/default
steps:
- azure-cli/install- azure-cli/login-with-user:
alternate-tenant: true- run:
name: List resources of tenant stored as `AZURE_TENANT` env var
command: az resource listworkflows:
example-workflow:
jobs:
- login-to-azure
```#### `login-with-service-principal`
##### Parameters
| Parameter | type | default | description |
|-----------|------|---------|-------------|
| `azure-sp` | `env_var_name` | `AZURE_SP` | Name of environment variable storing the full name of the Service Principal, in the form `http://app-url` |
| `azure-sp-password` | `env_var_name` | `AZURE_SP_PASSWORD` | Name of environment variable storing the password for the Service Principal |
| `azure-sp-tenant` | `env_var_name` | `AZURE_SP_TENANT` | Name of environment variable storing the tenant ID for the Service Principal |##### Example
```yaml
version: 2.1orbs:
azure-cli: circleci/azure-cli@1.0.0jobs:
login-to-azure:
executor: azure-cli/azure-docker
steps:
- azure-cli/login-with-service-principal- run:
name: List resources of tenant stored as `AZURE_SP_TENANT` env var
command: az resource listworkflows:
example-workflow:
jobs:
- login-to-azure
```#### `login-with-user-or-service-principal`
##### Parameters
| Parameter | type | default | description |
|-----------|------|---------|-------------|
| `azure-username` | `env_var_name` | `AZURE_USERNAME` | Environment variable storing your Azure username. Only applicable for user logins. |
| `azure-password` | `env_var_name` | `AZURE_PASSWORD` | Environment variable storing your Azure password. Only applicable for user logins. |
| `alternate-tenant` | `boolean` | `false` | Set to True to use the `--tenant az` login option. Only applicable for user logins. |
| `azure-tenant` | `env_var_name` | `AZURE_TENANT` | Environment variable storing your Azure tenant, necessary if `alternate-tenant` is set to true. Only applicable for user logins. |
| `azure-sp` | `env_var_name` | `AZURE_SP` | Name of environment variable storing the full name of the Service Principal, in the form `http://app-url`. Only applicable for Service Principal logins. |
| `azure-sp-password` | `env_var_name` | `AZURE_SP_PASSWORD` | Name of environment variable storing the password for the Service Principal. Only applicable for Service Principal logins. |
| `azure-sp-tenant` | `env_var_name` | `AZURE_SP_TENANT` | Name of environment variable storing the tenant ID for the Service Principal. Only applicable for Service Principal logins. |##### Example
```yaml
description: >
Log into Azure with the login type determined based on
environment variable detection.usage:
version: 2.1orbs:
azure-cli: circleci/azure-cli@1.0.0jobs:
login-to-azure:
executor: azure-cli/azure-docker
steps:
- azure-cli/login-with-user-or-service-principal- run:
name: List resources of tenant stored as `AZURE_SP_TENANT` env var
command: az resource listworkflows:
example-workflow:
jobs:
- login-to-azure
```