Updating to latest version of IaaSDiagnostics

Category

Tutorials

Published

November 12, 2015

We had some problems with the diagnostics extension for Azure IaaS not reporting data to the web GUI. No data available for some metrics. Turns out v1.2 of IaaSDiagnostics is kind of buggy. So we need to install a later version. No way on doing that in the portal so we will use PowerShell for this.

Ok first we set the common stuff:


$serviceName = 'mySERVICEname'
$vmName = 'myVMname'
$vm = Get-AzureVM –ServiceName $serviceName –Name $vmName

Lets check what version we are running:


$vm.ResourceExtensionStatusList

HandlerName            : Microsoft.Azure.Diagnostics.IaaSDiagnostics
Version                : 1.2.0.0
Status                 : Ready
Code                   : 
Message                : 
FormattedMessage       : 
ExtensionSettingStatus : Microsoft.WindowsAzure.Commands.ServiceManagement.Model.ResourceExtensionConfigurationStatus
ExtensionData          : 

Is there a newer version?


Get-AzureVMAvailableExtension -ExtensionName IaaSDiagnostics -Publisher Microsoft.Azure.Diagnostics

Publisher                   : Microsoft.Azure.Diagnostics
ExtensionName               : IaaSDiagnostics
Version                     : 1.5
Label                       : Microsoft Monitoring Agent Diagnostics
Description                 : Microsoft Monitoring Agent Extension
PublicConfigurationSchema   : 
PrivateConfigurationSchema  : 
IsInternalExtension         : False
SampleConfig                : 
ReplicationCompleted        : True
Eula                        : 
PrivacyUri                  : 
HomepageUri                 : 
IsJsonExtension             : True
DisallowMajorVersionUpgrade : False
SupportedOS                 : 
PublishedDate               : 2015-10-26 18:40:33
CompanyName                 : Microsoft
Regions                     : 

Yes there is! So what we will do here is to grab the current configuration, uninstall the old extension and install the newest one.

Let's grab the wadcfg configurations:


$configPath = 'C:\somepath\wadcfg.xml'
$extensionContext = Get-AzureVMDiagnosticsExtension -VM $vm
$publicConfiguration = $extensionContext.PublicConfiguration | ConvertFrom-Json
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($publicConfiguration.xmlcfg)) | Out-File -Encoding utf8 -FilePath $configPath

Let's remove and uninstall current version:


Remove-AzureVMExtension -Publisher Microsoft.Azure.Diagnostics -ExtensionName IaaSDiagnostics -VM $vm
$vm | Set-AzureVMExtension -Publisher Microsoft.Azure.Diagnostics -ExtensionName IaaSDiagnostics -Version 1.* -Uninstall | Update-AzureVM

When that's done, let's install newest version. In this case it is 1.5.*


$configPath = 'C:\somepath\wadcfg.xml'
$storageAccount = 'nameofstorageaccount'
$storageKey = 'storageaccountkey'
$storageContext = New-AzureStorageContext -StorageAccountName $storageAccount -StorageAccountKey $storageKey
$vm | Set-AzureVMDiagnosticsExtension -DiagnosticsConfigurationPath $configPath -StorageContext $storageContext -Version '1.5' | Update-AzureVM

Now version 1.5 should be installed and start reporting data to the GUI. Great success!

Written by

Jonas Erikson