1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Getting Started Managing Azure with PowerShell

Introduction to Azure PowerShell

The course is part of this learning path

Developing, Implementing and Managing Azure Infrastructure
course-steps 10 certification 7 lab-steps 2
Start course


This video lecture serves as an introduction to the Microsoft Azure PowerShell interface. We will take a look at the installation process for the Azure Resource Manager (ARM) PowerShell module, using the PowerShell Gallery, and then discuss the process of authenticating to your Microsoft Azure account, and managing your Azure subscriptions.


Hello and welcome to Azure PowerShell Automation, Getting Started. In this lecture, we're going to explore why we should use automation, an overview of the Azure PowerShell module, and the supported features of the Azure PowerShell module. So, first, let's discuss why you should use automation. When you use PowerShell or other interfaces to automate the Microsoft Azure platform, you get consistent and repeatable results. Additionally, if you're provisioning large numbers of resources, PowerShell scales very well. Additionally, because your code is checked into source control, you also have the ability to view an audit history of who made what changes at what particular time. So, what are some of the things that you can do with Azure PowerShell automation? Well, one of the most common features is to deploy Azure Resource Manager declarative JSON templates. Through the use of ARM JSON templates, you can actually deploy a JSON file to Azure and it will provision all of the resources that are declared inside that template. If you have a large number of resources to deploy, this is one of the most efficient ways of deploying those resources. You also have the ability to imperatively create, delete, and modify other cloud resources. You can perform resource-specific operations such as backing up or restoring a SQL Server database or starting and stopping a virtual machine. You can also manage Azure Resource Manager roll-based access control and policy mechanisms to control who has access to which resources in your subscription and which actions they can perform against different resources. Finally, one of the other things that we can do with Azure PowerShell is view Azure Resource Manager authorization logs to see what changes have been made to our cloud resources. So, the first thing we need to cover is how we get the Azure PowerShell module installed. There's actually two different PowerShell modules, one is called Azure and one is called AzureRM, which is short for Azure Resource Manager. The Azure module targets the older Azure Service Management, or ASM REST API, and the Azure Resource Manager manages the Resource Manager REST API. There's a couple of differences that you need to know about these two APIs, the most important of which is that using Azure Resource Manager, we can control access to our resources through roll-based access control and we can also perform declarative deployment of resources using ARM JSON templates. In order to install the Azure Resource Manager PowerShell module, which is what we'll be focusing on, you can use the PowerShell Gallery. You can issue a command from the PowerShell Get-Module on your PowerShell session and install the modules from a centralized gallery called the PowerShell Gallery. You can also visually browse the PowerShell Gallery at www.powershellgallery.com. The Microsoft Azure Resource Manager PowerShell module consists of several child modules. So, the outer module is called AzureRM and then there are child modules called Compute, Network, Storage, DNS, Backup, Batch, Resources, and many others. There's a couple of key modules that we'll take a closer look at called the Azure Profile module that allows us to authenticate to Azure and manage our subscriptions, and we also have the Resources module which allows us to generically manage Azure Resource Manager resource groups and individual resources using generic, non-feature specific commands. There are also a bunch of modules, such as the Compute, Network, Storage, DNS, Backup, and many others that allow us to manage individual features using feature-specific PowerShell commands. When you get the Azure PowerShell module installed for the first time, the first thing you need to do is authenticate to the Azure platform. You have a couple of options for authentication. Specifically, you can use the Microsoft Account, or MSA, and you can also use Azure Active Directory authentication. Azure Active Directory authentication allows us to store our identities in the cloud and control access to Azure Resource Manager resource groups and individual resources using role-based access control rules. Let's jump into a demo of authentication and subscription management for the Azure PowerShell module. We'll also take a look at how to install the module from the Gallery.

About the Author

Trevor Sullivan is a Microsoft MVP for Windows PowerShell, and enjoys working with cloud and automation technologies. As a strong, vocal veteran of the Microsoft-centric IT field since 2004, Trevor has developed open source projects, provided significant amounts of product feedback, authored a large variety of training resources, and presented at IT functions including worldwide user groups and conferences.