6

For some reason I do not get any information when I run Get-AzureVM or Get-AzureRmVm.

I used the following to login: Login-AzureRMAccount. I can see all of my subscriptions by doing Get-AzureSubscription | select SubscriptionName.

I am running latest version of Azure Powershell. I used Resource Manager to build my virtual machines a couple of days ago.

David Tansey
  • 5,813
  • 4
  • 35
  • 51
Rollersloft
  • 73
  • 1
  • 5
  • What happens if you run Get-AzureRmResource or Get-AzureRmResourceGroup - does Get-AzureRmContext return the right context / subscription that you expect it to If you're not getting anything being returned from Get-AzureVM/RmVM then it is either that you're not authenticated to perform the query or there isn't anything there to return (i.e. you're in the wrong subscription etc) – Michael B Dec 18 '15 at 23:58
  • If you are attempting to fetch ARM resources, please use “Get-AzureRmVM” cmdlet. Get-AzureVM - To fetch classic instances Get-AzureRmVM - To fetch ARM instances. – Pramod Lawate May 21 '17 at 07:54

2 Answers2

9

If you have multiple Azure subscriptions under your Azure account, you will first need to select the right subscription where your Azure Resource Manager (RM) VM resides by the following command.

Set-AzureRmContext -SubscriptionId <your-subscriptionId> -TenantId <your-tenantId>

You could see your list of subscription Ids and tenant Ids by:

Get-AzureRmSubscription 

After you set the right Azure Rm Context, you should be able to get all Azure RM VM under the current subscription context by:

Get-AzureRmVM

This solution has been tested on my Azure subscription and VM using the latest Azure PowerShell December 2015 (1.0.2).

Hope this helps!

juvchan
  • 6,113
  • 2
  • 22
  • 35
0

if you choose development model is Resource Manager instead of Classic when you create a VM, you have to use the command below to list out VMs:

Get-AzureRmVM
Cycloguy
  • 221
  • 3
  • 6