I need to get property like "DiskState", I am using cmd-let Get-AzureRMdisk, and what I got:
1) from my laptop, using connect-azurermaccount
then get-azurermdisk
, doesnt give expected property 2) I tried from Automatio account, created a runbook and then paste my code there, the same, I got more values but didn't get "diskstate" value 3) I see that I can get it from Azure Cloud Shell console. I would like to get this value from a script running as a runbook. Moreover I tried to use command like --> Get-AzureRmDisk | Where-Object ManagedBy -ne $null
, but didnt get any interesting results. Is there any matheto do get this mentioned property "diskstate" using powershell runbook from Automation account?
Why not, the PowerShell command Get-AzureRMDisk
show you the DiskState
as you want:
Additional, I recommend you use the Az module of the PowerShell while the AzureRM module is Migrated to it. See Migrate Azure PowerShell from AzureRM to Az.
Update:
But in the Runbook Get-AzureRMDisk
does not show the property, you need to use the Get-AzDisk
to achieve the purpose after you import the Az module and it shows like this: