I'm attempting to get a list of all my Azure VMs in Powershell.
Get-AzureVM
Unfortunately this only returns the VMs listed under Virtual machines (classic).
How can I get a list of the new Virtual machines?
You need to use the Azure Resource Manager mode to access the new VMs:
Switch-AzureMode -Name AzureResourceManager
You can read more about it here.
Based on David's answer, I wrote the following script that combines the two lists of VMs:
Switch-AzureMode -Name AzureServiceManagement
#ResourceGroupName will be blank for these
$classicVms = Get-AzureVM | select Name, ServiceName, ResourceGroupName
Switch-AzureMode -Name AzureResourceManager
#ServiceName will be blank for these
$armVms = Get-AzureVM | select Name, ServiceName, ResourceGroupName
$allVms = $classicVms + $armVms
$allVms
When you run this, you'll get a warning that Switch-AzureMode is deprecated.
WARNING: The Switch-AzureMode cmdlet is deprecated and will be removed in a future release
The deprecation is part of a breaking change. You can read the details here: Deprecation of Switch-AzureMode.
Note that Switch-AzureMode has now been deprecated (https://github.com/Azure/azure-powershell/wiki/Deprecation-of-Switch-AzureMode-in-Azure-PowerShell). Cmdlet Rename All cmdlets under Azure Resource Management modules will be renamed to fit the following format: [Verb]-AzureRm[Noun]
Example: New-AzureVm becomes New-AzureRmVm