You can start working with Azure in the Azure portal. But soon, you will need PowerShell (or the Azure CLI) to explore the power of Azure. Not everything you can do shows up in the portal. In fact, the features are all exposed through the Azure scripts first.
To get started, you need to download the Azure tools. Scroll down to see Command-line tools.
Click Windows install, which starts up Web Platform Installer. (If you don’t have Web Platform Installer, it will install it for you). At the time of this writing, I’ll start with Azure PowerShell v 4.0.0.
About the Gallery
You will be installing Azure and Azure Active directory cmdlets from the Gallery.
Installing items from the Gallery requires the latest version of the PowerShellGet module, which is available in Windows 10, in Windows Management Framework (WMF) 5.0, or in the MSI-based installer (for PowerShell 3 and 4).
With the latest PowerShellGetmodule, you can:
- Search through items in the Gallery with Find-Module and Find-Script
- Save items to your system from the
- Gallery with Save-Module and Save-Script
- Install items from the Gallery with Install-Module and Install-Script
- Upload items to the Gallery with Publish-Module and Publish-Script
- Add your own custom repository with Register-PSRepository
Check out the Getting Started page for more information on how to use PowerShellGet commands with the Gallery. You can also run Update-Help -Module PowerShellGet to install local help for these commands.
Once it is installed, you will need to install or update the Azure Modules.
Start PowerShell and install Azure Resource Manager cmdlets
Start Windows PowerShell IDE as Administrator.
Next, follow the instructions shown to install Azure Resource Manager Cmdlets. I do make one change.
-AllowClobber makes sure you will overwrite any of the modules that you may have already installed.
One it starts, you may see:
This warning wants you to be sure that you want to install the cmdlets. Click Yes to All.
Once you are done,
If you get an error loading the module, Install-Module is not recognized as the name of a cmdlet. According to Venkatesh Muniyandi on StackOverflow,
the fix is to download the PackageManagement PowerShell Modules (msi installer) from Microsoft website and install the modules. Once this is installed you will not get “‘Install-Module’ is not recognized as the name of a cmdlet” error.
Next, check to see that the module was installed.
You will see the version of the AzureRM script you installed and then a long list of commands.
You can now log into your Azure account.
Install Azure Active Directory cmdlets
You can use the Azure Active Directory Module for Windows PowerShell cmdlets for Azure AD administrative tasks such as user management, domain management and for configuring single sign-on.
Note that you cannot install both the preview version and the GA version on the same computer at the same time.
In the first post in this blog, we describe some of the features in v2. It appears that the v2 PowerShell script have been out for about a year. See Sign-in Microsoft Account & Azure AD users in a single app
To install the older version, which you may want for Office 365:
For Version 2, use:
And if you want to use the new v2 endpoints, you will need the Preview version. The newest features provides for a v2.0 endpoint, which allows developers to write apps that accept sign-in from both Microsoft Accounts and Azure AD accounts, using a single auth endpoint. For more information, see Getting your app started with Azure Active Directory v2 endpoint,
For Version 2 preview, use:
In either case, Connect-AzureAD will put up a dialog box to let you long in and start working with Azure Active Directory.
Getting started with PowerShell videos
Once you get both the Azure Resource Manager and the Azure Active Directory scripts installed, you may want to know more about scripting using PowerShell. There are two great places to get started:
- Free: Microsoft Virtual Academy Getting Started with PowerShell.
- Free trial: Pluralsight PowerShell Getting Started
Both are excellent.