Partager via


PowerShell Azure - find a sku offer publisher

 # who is the publisher for FreeBSD? What offer? What sku?
# Find-AzureSKU bsd

function Find-AzureSKU  {

  Param ([parameter(Mandatory=$true,HelpMessage='Enter a partial string of the  product')]
  [String] $sku,
  [String] $location='australiaeast'  )

  $publishers = Get-AzureRmVMImagePublisher -location $location
  foreach ($publisher in $publishers) {
     $offers=Get-AzureRmVMImageOffer -location $location `
                                     -PublisherName $publisher.PublisherName

    foreach ($offer in $offers) {
       if ($offer.offer -LIKE "*$sku*") {
         Get-AzureRmVMImageSku -Location $location `
                               -PublisherName $publisher.PublisherName `
                               -Offer $offer.offer
      } 
   } 
  } 
 }