"Knowledge has to be improved, challenged, and increased constantly, or it vanishes."

Use Azure PowerShell to manage your Azure Environment


Microsoft Azure offers several ways to manage the Azure workloads. These includes Azure Portal, SDK, Azure PowerShell etc. Azure PowerShell is the equivalent of Windows PowerShell, but you can execute commands against your Azure account. There are two ways you can use PowerShell commands in your Azure account

  • Use Azure Cloud Shell
    This is the browser version of Azure PowerShell. It gives bash experience for Linux users and PowerShell experience for windows users. You can try Azure Cloud Shell from the Link https://shell.azure.com/
  • Azure PowerShell
    Azure PowerShell can be installed on your computer and use.


This article focuses on how to install Azure PowerShell on windows 10 computer where PowerShell version 5 is installed.

Install Azure PowerShell

From your Windows 10 PC, open Windows PowerShell as administrator

image

I recommend you to check your PowerShell version and ensure you have version 5. To get the version of the Windows PowerShell, use the following command

$PSVersionTable.PSVersion

image

Now you can Install Azure PowerShell Module with the following command

Install-Module -Name AzureRM -AllowClobber

If NuGet provider is not installed, it will ask your consent to install it. The default value is Yes, so you can just use Enter key to install the NuGet Provider.

image

Since you are installing the AzureRM from web, it will ask your permission to install it. Be noted that the default value here is No, so you should enter Y and click Enter key.

image

The packages will be downloaded and installed. You will see the progress in the PowerShell command window.

image

Connect to your Azure Account

Once you installed Azure PowerShell, you need to use it with Windows PowerShell. Go to Windows PowerShell and import AzureRm module.

Import-Module AzureRM

When I first tried this command, I got the following error saying AzureRm.psm1 cannot be loaded because running scripts is disable on this system.

image

The reason for the error is that the execution policy of my PowerShell doesn’t allow remotely signed scripts to execute this. To resolve this error, you need to set the execution policy to allow remote signed. The corresponding Azure Command is given below

Set-ExecutionPolicy RemoteSigned

image

Once you set the execution policy to remotesigned, you can execute the command to Import AzureRM module.

Azure require you to login to your Azure account before you can execute any command against your Azure Account. Use the below command to connect to the Azure account.

Connect-AzureRmAccount

Now the browser will be popped up with the sign in page. You enter your credentials and complete the authentication process.

image

Once authenticated, it will show your Azure Account details as below.

image

Now you are ready to execute commands against your Azure account. Let me check all the resource group in my account. For this I need to use the below command.

Get-AzureRmResourceGroup

image

Summary

Azure PowerShell is a great option for developers or system administrators to manage your Azure Environment by using standard Windows PowerShell. You can refer the Azure PowerShell commands from the below URL.

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ps-common-ref

1 Comment

  • You may access a varied spectrum of talent by recruiting remote machine learning engineers, allowing you to establish a team that is genuinely global in its view and competence. This may assist you in staying ahead of the curve in terms of innovation and technology, ensuring that your company is constantly at the cutting edge of industry trends. Try this site now.

Add a Comment

As it will appear on the website

Not displayed

Your website