I am trying to run Get-AzureVM
PowerShell command, it is running fine but not return any output.
Also tried in following flavor but still blank result any idea?
Get-AzureVM -Name "vmname" |Select-Object name,instancesize,location
I am trying to run Get-AzureVM
PowerShell command, it is running fine but not return any output.
Also tried in following flavor but still blank result any idea?
Get-AzureVM -Name "vmname" |Select-Object name,instancesize,location
Actually the answer above is only semi-correct.
This had me pulling my virutal hair out trying to do automation (which took 7 hours of manual fudging to get working!).
Simply, you have two types of virtual machine in Azure; Classic, and Resource Manager.
If you
Switch-AzureMode -name AzureServiceManagement
then useGet-AzureVM
you will list all of the classic VM's you have created.If you
Switch-AzureMode -name AzureResourceManager
then useGet-AzureVM
you will list all of the Resource Manager (or new) VM's you have created.And remember, if you are trying to do automation, then you need the VM's in the new mode available through the portal, your old VM's (classic) that you created through management are not visable in this mode and you will have to recreate them.
Azure has two types of Management System: AzureServiceManagement (ASM) and AzureResourceManager (ARM)
In order to control these two different type of management systems you should switch between them as described in the main page of the Azure Powershell Github project page, but this is true for the azure powershell versions lower than 1.0.0, you can find more explanation in here
For those who are interested to control ARM (AzureResourceManager) with the powershell version greter than 1.0.0, they should use all Cmdlets with the following format :
[Verb]-AzureRm[Noun]
, for exampleNew-AzureVm
becomesNew-AzureRmVm
, in our caseGet-AzureVM
becameGet-AzureRmVm
In summary:
Get-AzureVM
, which is very confusing in my and lots of others opinionGet-AzureVM
for ASM andGet-AzureRmVm
for ARM.You should call
Select-AzureSubscription "subscription name"
first.It likely is defaulting to a subscription that doesn't have any virtual machines in it.
To view your current subscription names call:
I know this question has been answered but I tried the answer given and it did not work for me. I found, I needed to switch my AzureMode.
To resolve, I ran the following powershell script.
Switch-AzureMode -Name AzureResourceManager
Switching Azure Powershell mode between AzureServiceManagement and AzureResourceManger is a possible solution if your script is using older features as well as new Azure Resource Manager cmdlets. The switch is needed only for Microsoft Azure Powershell version 0.9.8 or older.