Azure PowerShell Tips and Tricks

Here are a few key references and a few tips and tricks.

Key Resources

Name Description Link
AzureRM PowerShell Documentation The documentation root for AzureRM.  Note the Version selector to get documentation on previous versions. https://docs.microsoft.com/en-us/powershell/azure/overview?view=azurermps-4.0.0
AzureRM.Profile Documentation Authenticating is the first step.  This is the reference to the AzureRM.Profile module which contains the cmdlet’s to do that.  https://docs.microsoft.com/en-us/powershell/module/azurerm.profile/?view=azurermps-4.0.0
AzureRM PowerShell GitHub The github repo for the cmdlets https://github.com/Azure/azure-powershell
     

Azure Resource Manager overview

Great overview of Azure Resource Manager https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview
Azure PowerShell Service Manager Module The documentation root for Azure ASM https://docs.microsoft.com/en-us/powershell/azure/install-azure-ps?view=azuresmps-3.7.0

Tips and Notes

The Login-AzureRmAccount is an Alias for Add-AzureRmAccount

If you are looking for documenation on Login-AzureRmAccount, there is none. This is an alias for the Add-AzureRmAccount cmdlet.

We can see this in the PowerShell startup file for the AzureRM.Profile module: C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1.

@{
    “Login-AzureRmAccount” = “Add-AzureRmAccount”;
    “Select-AzureRmSubscription” = “Set-AzureRmContext”;
}.GetEnumerator() | Select @{Name=’Name’; Expression={$_.Key}}, @{Name=’Value’; Expression={$_.Value}} | New-Alias -Description “AzureAlias”

Login Error – “Sequence Contains No Elements”

If you get this error while trying to use Login-AzureRmAccount or Add-AzureRmAccount it is likely because these cmdlet’s cannot be used with Microsoft Accounts; only work or school accounts.

See the Azure PowerShell GitHub issues

Login-AzureRmAccount does not work with Microsoft accounts #3108

To Get the Version of Azure Module Currently Installed

(Get-Module -Name AzureRM.Profile).Version

category:

Leave a Reply