How to Install, Run and Login Azure PowerShell on Linux

How to Install, Run and Login Azure PowerShell on Linux

This article describes How to Install, Run and Login Azure PowerShell on Linux

Microsoft is a leading global vendor of computer software; hardware for computer, mobile and gaming systems; and cloud services. Microsoft's corporate headquarters is located in Redmond, Wash., and it has offices in more than 60 countries.

Microsoft Azure is an ever-expanding set of cloud services to help your organisation meet your business challenges. It’s the freedom to build, manage and deploy applications on a massive, global network using your favourite tools and frameworks.

Azure provides solutions for all industries. Bring together cloud services and products tailored for your industry to help meet your specific needs and drive innovation.

Azure is the only consistent hybrid cloud, has more regions than any cloud provider, delivers unparalleled developer productivity and offers more comprehensive compliance coverage – including meeting the requirements of the General Data Protection Regulation (GDPR).

PowerShell lets you write commands and execute them immediately. This is known as interactive mode.

A PowerShell command is called a cmdlet (pronounced "command-let"). A cmdlet is a command that manipulates a single feature. The term cmdlet is intended to imply "small command". By convention, cmdlet authors are encouraged to keep cmdlets simple and single-purpose.

Cmdlets are shipped in modules. A PowerShell Module is a DLL that includes the code to process each available cmdlet. You load cmdlets into PowerShell by loading the module they are contained in. You can get a list of loaded modules using the Get-Module command.

Az is the formal name for the Azure PowerShell module containing cmdlets to work with Azure features. It contains hundreds of cmdlets that let you control nearly every aspect of every Azure resource. You can work with resource groups, storage, virtual machines, Azure Active Directory, containers, machine learning, and so on. This module is an open source component available on GitHub.

Install the Az module
The Az module is available from a global repository called the PowerShell Gallery. You can install the module onto your local machine through the Install-Module command. You need an elevated PowerShell shell to install modules from the PowerShell Gallery.

We use the same commands to install the Azure PowerShell on either Linux or macOS.

In a terminal, type the following command to launch PowerShell Core with elevated privileges.
sudo pwsh

Type the following command to determine the version of PowerShell installed.

Run the following command at the PowerShell Core prompt to install Azure PowerShell.
Install-Module Az -AllowClobber
If you are asked whether you trust modules from PSGallery, answer Yes or Yes to All.

Update a module
If you get a warning or error message indicating that a version of the Azure PowerShell module is already installed, you can update to the latest version by issuing the command:
Update-Module -Name Az
As with the Install-Module command, answer Yes or Yes to All when prompted to trust the module. You can also use the Update-Module command to re-install a module if you are having trouble with it.

The Connect-AzAccount cmdlet prompts for your Azure credentials and then connects to your Azure subscription. It has many optional parameters, but if all you need is an interactive prompt, no parameters are needed:

Please subscribe to support our channel.
To be aware of our new videos please subscribe our channel.

Visit our website
Visit our youtube channel
Watch IT & Learn IT & Apply IT.