Azure CLI Kung Fu
Do you need help writing Azure CLI commands to manage and work with your Microsoft Azure resources? This Azure CLI Kung Fu (or “az kung fu“) project from Chris Pietschmann will help you be more productive and agile in the cloud using DevOps practices!
AZURE CLI “AZ KUNG FU” PROJECT
Welcome!
As an Azure Administrator, DevOps Engineer, Developer, or Solutions Architect you write scripts on a daily basis. Reading the Azure CLI documentation gets you part of the way there, but it’s often difficult to craft that perfect script to get today’s unique job done. This is the inspiration for the “az kung fu” project.
Chris Pietschmann, Microsoft MVP and HashiCorp Ambassador, uses Azure CLI on a daily basis to help manage and work with Microsoft Azure resources. They both have reusable scripts for common tasks, and have the regular need to write one-off scripts to get specific tasks done. All of these tasks are recurring tasks across cloud professionals and organizations and a shared library of these scripts, as well as great tips and tricks, would not only help us, but the entire Microsoft Azure community as well.
“If you love life, don’t waste time, for time is what life is made up of.”
— Bruce Lee
What does Azure CLI Kung Fu mean?
Here is an example:
vmIds=$(az vm list -g $RG --query "[].id" -o tsv)
The “vmIds” variable will give you a list of Virtual Machines from a Resource Group that can be used for a MILLION things. This line uses a query to get at just the data you want; which in this case is the list of VM Ids.
If you just change the VM to something else in the script, it can be used for almost anything else there is. After you have this variable populated with the list of Azure resources you want to perform an action or task on, you can then use a bash loop expression to perform repeated actions againt all the resources in the list.
This is a great starting point, and the code examples and articles you’ll find here within the Azure CLI Kung Fu project will point you in the right direction to save time, and be smarter with your Azure CLI scripting.
A lap around Azure Kung Fu Toolkit
Check out the links below for great, task specific Azure CLI Kung Fu tips and tricks!
Azure CLI Kung Fu Videos
Azure CLI Kung Fu VM for Administrators, DevOps and Developers and SRE!
Let’s build an Azure Administrator VM! Use this VM to get started with the Azure CLI, Azure Cloud Shell with both Bash and PowerShell scripting!
Getting Started with Azure CLI and Cloud Shell
Let’s take a look at getting started with the Azure CLI using the Azure Cloud Shell with both Bash and PowerShell scripting support, persistent storage, and automatic login to your Azure Subscription!
Azure CLI Kung Fu Articles
Get Total Size Allocated to Azure Storage Account (Blobs, Files, Tables and Queues)
Azure Storage Accounts are a fundamental part of cloud storage in Microsoft Azure, providing various types of storage services such as blobs, files, tables, and queues. Understanding the total size allocated to a storage account and the usage breakdown per service...
Migrate Azure VM Across Regions Using Azure CLI and Bash Script
Migrating an Azure Virtual Machine (VM) from one Azure Region to another can be necessary for several reasons, including disaster recovery, optimizing performance, or reducing latency. While Azure provides various options for replication and failover, one of the most...
Upload File from URL to Azure Blob Storage using Azure CLI with Bash and PowerShell
The Azure CLI az storage blob upload command can be used to upload a local file into Azure Blob Storage. However, there are times when it would be easier to upload a file straight from the HTTP(S) URL into Azure Blob Storage. Unfortunately the Azure CLI does not have...
Azure Resource Tags: Important Organization Strategies and Tips
In the Microsoft Azure cloud, the organization and management of resources are extremely important for operational efficiency and cost-effectiveness. Azure Tags serve as a fundamental tool in categorizing resources within the Azure environment, providing a versatile...
Azure CLI: Check if Blob Exists in Azure Storage
Before we dive into the nitty-gritty details, let's clarify some essential concepts. Azure Storage, a cloud-based storage solution, is organized into a hierarchy of containers, and within these containers, you'll find Blobs. Blobs are objects or files that can be...
Deploying Azure Bicep Templates using the Azure CLI
Using the Azure CLI to deploy Azure Bicep templates can be used to more efficiently build Infrastructure as Code (IaC) deployment workflows for managing Microsoft Azure resources. Azure Bicep templates and the Azure CLI are both powerful tools for any DevOps Engineer...





