0
votes

I have a couple of storage accounts in my Azure subscription. I know my VMs are using them because when I look at the Boot diagnostics blade for those VMs in the portal, I can see a diagnostic screenshot and a serial log (apparently the storage account is where this information is held). However, I’ve looked high and low and can’t find the setting that specifies which storage account is being used by which VM.

I also tried the Powershell script mentioned in Powershell to List Azure VMs with storage account name. However, any field in the output that relates to a storage account is empty.

Can someone please point me in the right direction?

Thanks

2

2 Answers

0
votes

If you mean the storage account for the VM diagnostic, then you can get the storage account URL with the command Get-AzVM like this:

$vm = Get-AzVM -Name vmName
$vm.DiagnosticsProfile.BootDiagnostics

enter image description here

Here it shows you the URL of the storage account that stored the VM diagnostic logs, but this is the only thing you can find in the VM. If you want to get more details about the storage account, just run the command Get-AzStorageAccount.

0
votes

I actually want to know which storage account the VMs are using.

I ran the Powershell that you suggested both at my workstation and in the Azure shell console. However, even though the Enabled property returned True, nothing was returned for the StorageUri property (hopefully the image that I pasted into this reply will show this).

As per the pasted image, I also ran an Az command that did return a couple of URIs (one for the boot image and one for the serial log).

However, I don't believe that this information will lead me to discover which storage account is being used. Any other suggestion you can offer will be appreciated.

enter image description here