Best practice to create a VM on Azure local HCI Cluster

Rozario, Peter 25 Reputation points
2025-07-24T11:40:23.0966667+00:00

We would like to be able to host the VM files just like the way it happens in Hyper-V. But when we are creating milltiple VMs in Azure local cluster we can see all the files are getting dumped into one folder. Its not creating a folder by the name of the VM and then saving all the config and vhd files there. Right now its looking very messy and things are not looking very structured by Hyper-V.

Azure Local

1 answer

Sort by: Most helpful
  1. Sina Salam 31,296 Reputation points Volunteer Moderator
    2025-11-24T12:41:03.54+00:00

    Hello Rozario, Peter,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you need best practice to create a VM on Azure local HCI Cluster.

    Follow the below steps for best practice:

    1. Registered cluster and in-policy using Powershell: Get-AzureStackHCI | Format-Table Name, RegistrationStatus, inPolicy If RegistrationStatusRegistered, call Register-AzureStackHCI or re-sync within 30 days.
    2. Create a custom Storage Path BEFORE creating VMs using bash command:
         az stack-hci-vm storagepath create \
           --resource-group RG_NAME \
           --custom-location "/subscriptions/.../customLocations/MocLocation" \
           --name "TESTVM" \
           --path "D:\SHARE\TESTVM"
      
      This ensures each VM gets isolated storage - https://learn.microsoft.com/en-us/cli/azure/stack-hci-vm/storagepath?view=azure-cli-latest
    3. Then, validate Storage Path and capacity using bash command: az stack-hci-vm storagepath list and Get-ClusterNode | Get-StoragePool | Get-PhysicalDisk | Measure-Object Size -Sum To ensures the new path is available and CSVs have sufficient free space.- https://learn.microsoft.com/en-us/cli/azure/stack-hci-vm and https://learn.microsoft.com/en-us/windows-server/storage/storage-spaces/create-volumes?view=azloc-24081 gives you more details.
    4. Modify VM creation to use new path by using PowerShell:
         New-VM -ComputerName HCIHost01 `
            -Name TESTVM `
            -Path "D:\SHARE\TESTVM" `
            -VHDPath "D:\SHARE\TESTVM\TESTVM.vhdx" `
            -MemoryStartupBytes 4GB ...
      
      Or configure via Windows Admin Center and select your custom storage path as it's more details here - https://docs.azure.cn/en-us/azure-local/manage/vm
    5. Restart MOC-operator / NodeAgent to reconcile containers by using PowerShell: Restart-Service -Name "MocNodeAgent" -Force and validate error rectified:
         az stack-hci-vm list
         az stack-hci-vm storagepath list
      
    6. Finally, monitor and scale at will by:

    I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    Was this answer helpful?

    0 comments No comments

Your answer

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