none
PowerShell method to list VM sizes that support Premium Disks RRS feed

  • Question

  • Hi, I'm using the following Powershell to list all VM sizes that are available to my subscription in a particular region:

    Get-AzComputeResourceSku | where {$_.Locations.Contains("westus") -and $_.ResourceType.Contains("virtualMachines") -and $_.Restrictions.ReasonCode -ne 'NotAvailableForSubscription'}

    This works and returns a list, but it contains Sizes that do not support Premium_LRS storage, so I cannot use those sizes. Does anyone know how to filter them out?

    (I'm thinking that Sizes that contain a lowercase 's' always support Premium storage, but it's jsut a guess, and not a very good way to filter on that attribute.)

    (I was hoping that there is a $_.PremStorSupport.Contains("Yes"), but probably wishful thinking on my part.)

    Any ideas?

    -Matthew

    Saturday, November 9, 2019 12:54 AM

All replies

  • Hi Matthew,

    Yeah I think the filter on lower s is the way to do this based on the output of the VM object of the PS queries. There is no output AFAIK for the disk option other than the s in the VM series name.

    Thanks,

    Matt

    Sunday, November 10, 2019 9:09 PM
  • Can you try using  -Location westus -Type Premium_LRS e.g. type.contains("Premium_LRS")

    Btw whats the output of Get-AzComputeResourceSku | fl * -> Does it contain the list of resources including the premium_LRS ? if its returning the storagetype for premium_lrs then you can filter it out else using where-object or select-object  or select-object with a field which is a specially constructed hashtable to it so that it can return a custom object to you on the console (if you need to manipulate the return output from the pipe).


    Best Regards
    Jatin Makhija
    If my suggestion helps to resolve the issue, Please Click "Mark as Answer"

    Sunday, November 10, 2019 10:34 PM
  • Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Thursday, November 14, 2019 4:29 AM
    Moderator
  • Following up to see if the above suggestion was helpful. And, if you have any further query do let us know.

     Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread.
    Thursday, November 21, 2019 8:41 AM
    Moderator
  •  @MatthewJamesSmith Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.
    Friday, November 22, 2019 2:15 PM
    Moderator