How can I know the name of the machine storage account in Azure?

Anonymous
2022-11-21T12:44:11.193+00:00

I can't find the name of the storage account of a virtual machine. It should be simple but I can't do it.

regards

Raúl.

Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,543 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Alistair Ross 7,466 Reputation points Microsoft Employee
    2022-11-21T14:44:10.177+00:00

    Hi @Anonymous

    If your VM is using managed disks, then you don't have details of the storage account, just the resource id of the managed disk instance. If your VM is not using managed disks, then you can find this a number of ways.

    Using the JSON View

    1. Select your virtual machine
    2. Click on the Overview page
    3. Select JSON View in the upper right corner
    4. Navigate through the JSON content to properties > storageProfile > osDisk > vhd > uri
    5. The URI will be "https://yourStorageAccountName.blob.core.windows.net/vhds/yourVMName.vhd

      Using the UI

    6. Select your virtual machine
    7. Select the Disks page
    8. Select the OS Disk
    9. The URI is in the VHD URI box ("https://yourStorageAccountName.blob.core.windows.net/vhds/yourVMName.vhd)

      Using Azure Resource Graph Explorer

    10. Open Azure Resource Graph Explorer
    11. Run the following query.
    resources  
    
     | where type =~ "microsoft.compute/virtualmachines"  
     | extend ManagedDisk = iif(isnotempty(parse_json(properties.storageProfile.osDisk.managedDisk)),true, false)  
     | extend CreateOption = tostring(parse_json(properties.storageProfile.osDisk.createOption))  
     | extend OSDiskLocation = case(  
         ManagedDisk == true, tostring(parse_json(properties.storageProfile.osDisk.managedDisk.id)),  
         isnotempty(parse_json(properties.storageProfile.osDisk.vhd)),  tostring(parse_json(properties.storageProfile.osDisk.vhd.uri)),  
         "Other (Review Properties)"  
     )  
     | project id, name, ManagedDisk, OSDiskLocation  
     | extend StorageAccountName = iif(OSDiskLocation startswith "Https://", substring(OSDiskLocation,8,indexof(OSDiskLocation,'.',1)- 8), "")  
    

    I hope this helps provide you with the information you need. If it does, please make sure to mark the question as answered so it helps other people in future.

    Kind regards

    Alistair


  2. JS3291, EXT-ID (002-Extern) 0 Reputation points
    2023-09-27T10:57:57.6133333+00:00

    Hi if my VM is on managed disk can I convert/allocate it a storage account ?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.