Updating to latest IaaSDiagnostics

Jonas EriksonAzureKommentera

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 v 1.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

HandlerName            : Microsoft.Azure.Diagnostics.IaaSDiagnostics
Version                :
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.

Lets 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

Lets 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 thats done. lets install newest version, it 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!

Leave a Reply

Your email address will not be published. Required fields are marked *