3
votes

I have enabled a diagnostic storage account for my virtual machine. Now I want to change the diagnostic storage account. How do I do it in portal / PowerShell?

I can see that we have a cmdlet - "Set-AzureRmVMBootDiagnostics", however, this is not updating the diagnostic storage account to a new one.

In specific: My current diagnostic storage is "ibmngeus2" and I would like to change to "sqlbackupacct".

3
I got the settings under the "Boot Diagnostic" option under the Virtual machine pane.Manjunath Rao

3 Answers

2
votes

In the Azure portal, you should be able to click on the boot diagnostics section of the virtual machine, and then click the settings, and then click the storage account section to change the storage account. Keep in mind that the new storage account you want to use must be in the same subscription and location or it will not show up as one you can choose.

enter image description here

0
votes

I got the settings under the "Boot Diagnostic" option under the Virtual machine pane.

0
votes

In PowerShell (with the now-deprecated AzureRM module), you can do this:

Get-AzureRmVM <Stuff to filter the VMs you want go here> | Set-AzureRmVMBootDiagnostics -Enable -ResourceGroupName <storage-account-rg> -StorageAccountName <storage-account-name> | Update-AzureRmVM

This will get the VM objects, change the setting and apply the change.

Example, to update all VMs' diag storage account to bucket in RG mygroup:

Get-AzureRmVM | Set-AzureRmVMBootDiagnostics -Enable -ResourceGroupName mygroup -StorageAccountName bucket | Update-AzureRmVM

(You probably want to filter more...)

For the new Az module, the commands would change to: (same warnings as above will apply)

Get-AzVM <Stuff to filter the VMs you want go here> | Set-AzVMBootDiagnostic -Enable -ResourceGroupName <storage-account-rg> -StorageAccountName <storage-account-name> | Update-AzVM

Get-AzVM | Set-AzVMBootDiagnostic -Enable -ResourceGroupName mygroup -StorageAccountName bucket | Update-AzVM

(There is a deprecation warning for the plural version of the command - this uses the new name, but the warning still shows)