Monday, February 29, 2016

Get-AzureResourceGroupGalleryTemplate is missing (and a fix)

Last September, I wrote about what I call ‘The Great Azure Cmdlet Renaming’. Well, I’m now in the process of actually using the resultant cmdlets and I am having some minor frustrations.

I am following an Azure Resource Manager training course, provided by Microsoft MVA. I suppose it’s bad enough that EVERY demo shows stuff that no longer exists – all the demos are ‘wrong’. The new portal looks vastly different from the course, although with a bit of effort I can pretty much re-produce what the demos are showing. It’s tedious, but possible in most cases. And just for the record: the latest incarnations of the portal are very good - much better than in the MVA video.

But it’s not just the portal that is so different in the video, the cmdlets have changed too – with lots of renaming, etc. One cmdlet that is now totally gone is Get-AzureResourceGroupGalleryTemplate. This cmdlet returned a list of templates in Azure’s gallery along with details of the specific template.

So, while you can’t actually use this cmdlet (it no longer exists), you can re-create it like this:
Function Get-AzureResourceGroupGalleryTemplate {[CmdletBinding()]
Param(
[Parameter(Mandatory=$false,
           Position=0,
           ParameterSetName='Default')]
[Alias("ip")]
$IncludePreview = $false
)
#
$StartTime = Get-Date
Write-Verbose "Started at $StartTime"
#     Create URL
$GalleryUri = "
https://gallery.azure.com/Microsoft.Gallery/GalleryItems?api-version=2015-04-01"
if ($IncludePreview)
   { $GalleryUri += "&includePreview=true"}
Else
   { $GalleryUri += "&includePreview=false"}
#    Retrieve all available templates
Try   {
         $AllGalleryTemplates = Invoke-WebRequest -Uri $GalleryUri | ConvertFrom-Json
      }
Catch {
         "Error invoking Call to Azure Gallery"
      }
#     Write verbose return information
$EndTime = Get-Date
Write-Verbose "Finished at $EndTime"
Write-Verbose "$(($EndTime-$StartTime).totalseconds) seconds elapsed"
Write-Verbose "Templates returned: $($AllGalleryTemplates.count)"
#     And return it
Return $AllGalleryTemplates
}

Set-Alias Get-RGTemplate Get-AzureResourceGroupGalleryTemplate
Set-Alias GRGT Get-AzureResourceGroupGalleryTemplate
It’s easy enough to re-create the template – I’m not sure why it was removed in the first place. If, like me, you think that the cmdlet should be re-instated, then feel free to follow up at: https://github.com/Azure/azure-powershell/issues/1885

Monday, February 01, 2016

SSD Life Time Measurements

I’ve been looking at possibly upgrading one of my Hyper-V servers to use SSDs. I don’t have the budget yet, but have been pricing up various options. One issue that arises is about the life time of the SSD, also referred to in the literature as endurance. There seems to be two separate measurements in use: Terabytes Written (TBW) an Drive Writes Per Day (DWPD). At first, I could not see the relationship – which kind of made comparing harder.

I did a little searching and found this neat article:  Comparing DWPD to TBW which provides a nice equation for converting DWPD into TBW. The trick here is to consider the warranthy period. DWPD is a measure of how many times you can totally overwrite the disk each day and not have it fail during it’s warranty period. To convert that to TBW, as the artilce points out – you multipy DWPD by warranty period (in days) and capacity (in TB).

I am starting to see more virtualisation projects using SSD disks, so the comparison betwen vendors and product lines is important. I wish there was just ONE measure of endurance, but such is life.