Blueprints

Automate tasks on Azure using Azure CLI

Source

yaml
id: azure-cli
namespace: company.team

tasks:
  - id: list_azure_regions
    type: io.kestra.plugin.azure.cli.AzCLI
    tenant: "{{ secret('AZURE_TENANT_ID') }}"
    username: "{{ secret('AZURE_SERVICE_PRINCIPAL_CLIENT_ID') }}"
    password: "{{ secret('AZURE_SERVICE_PRINCIPAL_PASSWORD') }}"
    servicePrincipal: true
    commands:
      - az account list-locations --query "[].{Region:name}" -o table

About this blueprint

Azure

This flow demonstrates how you can use the Azure CLI plugin to automate various tasks on Azure. The task below runs a simple command to list Azure regions using the az account list-locations command. The output is a JSON array of region names — you can either output that result to a JSON file or use the --query parameter to only show the region names. While the example shown below is simple, the CLI allows you to automate virtually anything. Every action in Azure can be performed via an API call that you can trigger from the CLI. For instance, you can follow the Azure documentation to start containers on Azure. Azure Container Instances support both CPU and GPU workloads, and all that can be orchestrated with this simple CLI task.

Az CLI

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra