Get Started with Azure PowerShell

Get Started with Azure PowerShell

August 15, 2016 1 By Eric Shanks

Microsoft Azure has its own command line that can be used to script installs, export and import configurations and query your portal for information. Being a Microsoft solution, this command line is accessed through PowerShell.

Install Azure PowerShell

Using PowerShell with Microsoft Azure is pretty simple to get up and going. The first step to getting started is to install the Azure PowerShell modules. Open up your PowerShell console and run both “Install-Module AzureRM” and then “Install-Module Azure”.

InstallAzurePosh

 

Azure PowerShell Login

Once you’ve installed the PowerShell Modules, the next step is to login to your Azure account. This can be done by using the “Login-AzureRMAccount” command.

InstallAzurePosh2

When you run the login command, you’ll be asked to authenticate. Login with your Azure credentials.

InstallAzurePosh3

 

Run Some Commands

Now that we’ve gotten logged in, we can run some simple commands to ensure that we’re getting the correct data. To start, I’m running a Get-AzureRmSubscripiton command to list my subscriptions.

InstallAzurePosh4

After I’ve listed my subscriptions, I’ll set my default subscription. This will ensure that my future commands for this session are run against the correct subscription. I’ve run “Get-AzureRmSubscription -SubscriptionName $NAME | Select-AzureRmSubscription

InstallAzurePosh5

Now that the subscription has been set, I’ve run a couple of simple get commands to list VMs and network interfaces.
InstallAzurePosh6