Blog articles
Read MSP360’s latest news and expert articles about MSP business and technology

Azure CLI vs PowerShell: What Is the Difference?

Azure CLI vs PowerShell: What Is the Difference?

Before we talk about Azure PowerShell vs Azure CLI, first of all, we need a bit of background. Both are available in the Azure cloud or you can use them remotely from your workstation. On your workstation, you will have to install a module, which we will explain later, but both are available in Azure Cloud Shell. Azure CLI is short for the Azure command-line interface.

In Azure, at the top of your screen in the middle, you have an icon for a command prompt. When you click on that icon, you will enter Azure Cloud Shell.

You will have a choice then to choose between PowerShell or Bash. If you wish to manage Windows-based VMs, you will choose PowerShell; on the other hand, if you want to manage Linux VMs, Bash is the option you need. Bash is a Unix shell that was invented in 1989, while PowerShell was invented in 2006.

Both Bash and PowerShell are scripting languages. This simply means that they are already compiled code that issues commands to the OS. Bash issues commands to form strings, while PowerShell forms objects.

With that said, you then have Azure CLI, which is used to issue a set of commands to add, delete, or modify resources in Azure. By that, I mean the actual Azure resources and not the operating system that resides on the resources. Azure CLI is available in both the Bash and PowerShell sections of Azure Cloud Shell.

PowerShell Remote Alerts

In this document you'll find a PowerShell script that checks the status of the services listed below and sends an email alert if any of them is turned off:

  • Windows Firewall
  • Windows Defender
  • Windows Update Service
  • Any installed third-party antivirus
New call-to-action
WP icon

Differences between Bash and PowerShell

PowerShell is a command shell and associated scripting language for the majority of Windows operating systems. Bash is a Unix shell and scripting language for most Linux operating systems. The first version of PowerShell was introduced in 2006. The Bash shell appeared in 1989. PowerShell treats input and output as objects, while Bash always accepts input and output as text structures. The user interface of PowerShell is a command-line interface; that of Bash is a text command-line interface. PowerShell can be used on any version of Windows from Windows 97 onward. Bash is mainly used with Linux and Unix operating systems. Powershell is a scripting language based on the .NET framework and C# programming language, while Bash is a scripting language based on the C programming language.

Azure CLI first came out with commands that started with azure, azureRM and now az. The Azure CLI can be installed on your workstation and is used to issue commands remotely to the Azure cloud by installing a module in PowerShell. To do this, run the following command in PowerShell as an administrator:

Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi;
Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi

You will then be able to access the CLI at the windows command prompt (CMD) or in PowerShell. To log in, you run:

az login

This will open up a new browser window to log in to Azure. Then you will be able to run Azure CLI commands. Azure CLI can be run in both PowerShell and CMD, but PowerShell gives you more tab-completion features.

Here is a list of common commands with the CLI:

Resource typeAzure CLI commands
Resource groupaz group
Virtual machinesaz vm
Storage accountsaz storage account
Key vaultaz keyvault
Web applicationsaz webapp
SQL databasesaz sql server
Cosmos DBaz cosmosdb

To put it simply, Azure PowerShell vs Azure CLI means that it all depends on what you want to do in Azure. You can use both in Cloud Shell in PowerShell, and you can use both remotely at your workstation to manage the Azure cloud. If it's resources in Azure that you want to manage, then use Azure CLI; and if you need to manage Windows Servers, then use Azure PowerShell.

Hopefully, this clears up the meaning of the various terms and descriptions that you will find in Azure. It will also get you started in managing your resources and VMs in the cloud.

How to Remotely Manage Your Servers Using PSRemoting and Invoke PowerShell Commands
  • Making a new firewall rule
  • Restarting the server or computer
  • Restating certain services
  • Checking the status of the service, and more
New call-to-action
WP icon