Azure CLI: The Ultimate Tool for Efficient Cloud Management

Quick answers to What, Why, When and How related to Azure CLI

·

2 min read

Azure CLI: The Ultimate Tool for Efficient Cloud Management

What is Azure CLI?

Azure CLI is a command-line interface that allows you to manage Azure resources and tasks, such as creating, updating, or deleting resources.

It provides a way to interact with Azure services through commands, offering the same capabilities as the Azure portal's user interface but with the efficiency and automation of scripting.

Why do you need? or When o use?

Lets say you are a DevOps engineer supporting 10 teams in your organisation, managing list of activities. Creating a resource via AZ portal using UI is easy but time taking. If you have to do the same task for say 5 teams - how much time consuming will it be? + there is high probability of human mistake.
If you do the task using CLI, and you save the script on GITHUB, share with your team with necessary steps; it will be easier for anyone in team to perform similar tasks for number of requests.

THUS, it will

  1. Quicker,

  2. Automation,

  3. Cut the probability of human error,

  4. Easy to manage any resource/s,

NOTE that the time saving while working through the AZ CLI is the time you invest while managing resources only AND NOT the AZ time while catering the requests.

The handy documentation for CLI by azure can be found at https://learn.microsoft.com/en-us/cli/azure/reference-docs-index

HOW to use AZ CLI

Install Azure CLI

Installation Overview

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

Install on Windows

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli

Install on Linux

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt

Install on Mac

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos

Create VM using Azure CLI

Start with creating a Resource Group

az group create --name learn-azure-cli --location eastus

Set the Resource Group as default (Optional)

az config set defaults.group=learn-azure-cli

Create VM with Vnet

az vm create \
  --resource-group learn-azure-cli \
  --name vmName \ 
  --image Ubuntu2204 \
  --vnet-name default \  
  --subnet default \    
  --generate-ssh-keys \
  --output json \
  --verbose

Delete the Resource Group to delete all the resources

az group delete --name learn-azure-cli

Conclusion:

Azure CLI is an essential tool for efficiently managing Azure resources through command-line commands. It offers significant advantages such as speed, automation, reduced human error, and ease of resource management, making it particularly valuable for DevOps engineers handling multiple tasks across various teams. By leveraging Azure CLI, teams can streamline their workflows, save time, and ensure consistency in resource management. For more detailed guidance and documentation, users can refer to the official Azure CLI documentation.