Azure PowerShell 1.0 changes

Azure PowerShell 1.0 changes

Q. What is different in Azure PowerShell 1.0?

A. Azure PowerShell 1.0 represents a new direction for the management of Azure Resource Manager resources vs Azure Service Manager resources. Prior to 1.0 the Switch-AzureMode cmdlet was used to switch between ARM and ASM management and cmdlets with the same name were used in each mode but behaved very differently. With 1.0 the ARM cmdlets all have RM in the name, for example Get-AzureRMVM instead of Get-AzureVM. This means a switch of mode is no longer required as you specifically use the ARM cmdlets which are also in a separate module.

The new Azure PowerShell 1.0 can be downloaded from https://azure.microsoft.com/en-us/downloads/ under the Command-line tools section. Note that the pre 1.0 is still available as the legacy PowerShell library. Once installed you need to download the various modules that make up the AzureRM and Azure PowerShell environments. This can be done with the following commands from an elevated PowerShell window.

Set-ExecutionPolicy RemoteSigned #Required to install the modules
Install-Module AzureRM #Install the Azure RM modules 
Install-AzureRM #Download and install each module of Azure RM 
Install-Module Azure $Install the ASM module
Import-Module AzureRM #Load ARM cmdlets
Import-Module Azure #Load ASM cmdlets (note you would likely only use one of these cmdlets)

To login with AzureRM use the Login-AzureRmAccount cmdlet. For ASM still use the Add-AzureAccount cmdlet.

Once logged in subscriptions can be viewed using Get-AzureRmSubscription and one selected using Select-AzureRmSubscription (same way that was done with pre 1.0 PowerShell). To get the status of all VMs in a resource group I could use:

$VMs = Get-AzureRmVM -ResourceGroupName $RG.ResourceGroupName
foreach($VM in $VMs)
{
    Get-AzureRmVM -ResourceGroupName $RG.ResourceGroupName -Name $VM.Name -Status
}

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish