Why Use CLI & PowerShell?
While the Azure Portal is easy to use, automation and repeatability often require command-line tools.
Azure provides two main scripting options:
-
Azure CLI (cross-platform)
-
Azure PowerShell (Windows + cloud automation focus)
Azure CLI
-
Command-line tool available on Windows, Linux, macOS, or Cloud Shell.
-
Uses
azcommands. -
Syntax is simple and works well for scripting.
Examples:
Azure PowerShell
-
PowerShell module (
Azmodule) with cmdlets for Azure. -
Syntax uses Verb-Noun convention.
Examples:
Confusion Buster 🚨
-
CLI vs PowerShell
-
CLI = lightweight, cross-platform, great for scripting and devs.
-
PowerShell = deeper automation, integrates with Windows tools, preferred by admins.
-
-
Portal vs CLI/PowerShell
-
Portal = GUI, manual.
-
CLI/PowerShell = automation, scripting, repeatability.
-
Exam trap: If the scenario says “cross-platform scripting”, answer is CLI. If it says “Windows admins automate with scripts”, answer is PowerShell.
Simple Example
An Azure admin wants to automate VM management:
-
Uses Azure CLI to quickly spin up test environments on Linux.
-
Uses PowerShell Runbooks in Automation Accounts to manage patching for Windows servers.
Exam Tip
-
“Cross-platform scripting tool” → Azure CLI.
-
“Preferred for Windows automation” → PowerShell.
-
“Run in browser without local install” → Cloud Shell (supports both CLI & PowerShell).
What to Expect in the Exam
-
Direct Q: “Which Azure tool uses the command ‘az vm create’?” → Azure CLI.
-
Scenario: “Admin wants to run cross-platform automation for Azure resources.” → Azure CLI.
-
Trick Q: “PowerShell commands are available only on Windows.” (False — Az module works cross-platform too).