Create storage path for Azure Local

Applies to: Azure Local, version 23H2

This article describes how to create storage path for VM images used on your Azure Local instance. Storage paths are an Azure resource and are used to provide a path to store VM configuration files, VM image, and VHDs on your system. You can create a storage path using the Azure CLI.

About storage path

When your Azure Local is deployed, storage paths are created as part of the deployment. The default option automatically selects a storage path with high availability. You might however decide to use a specific storage path. In this case, ensure that the specified storage path has sufficient storage space.

The storage paths on your Azure Local should point to cluster shared volumes that can be accessed by all the machines on your system. In order to be highly available, we strongly recommend that you create storage paths under cluster shared volumes.

The available space in the cluster shared volume determines the size of the store available at the storage path. For example, if the storage path is C:\ClusterStorage\UserStorage_1\Volume01 and the Volume01 is 4 TB, then the size of the storage path is the available space (out of the 4 TB) on Volume01.

Prerequisites

Before you begin, make sure to complete the following prerequisites:

  1. Make sure that complete the Azure Local requirements.

  2. Make sure that a cluster shared volume exists on your Azure Local that is accessible from all the machines in the system. The storage path that you intend to provide on a cluster shared volume should have sufficient space for storing VM images. By default, cluster shared volumes are created during the deployment of Azure Local.

    You can create storage paths only within cluster shared volumes that are available in the system. For more information, see Create a cluster shared volume.

Create a storage path on your system

You can use the Azure CLI or the Azure portal to create a storage path on your system.

You can use the stack-hci-vm storagepath cmdlets to create, show, and list the storage paths on your Azure Local.

Review parameters used to create a storage path

The following parameters are required when you create a storage path:

Parameter Description
name Name of the storage path that you create for your Azure Local. Make sure to provide a name that follows the Rules for Azure resources. You can't rename a storage path after it's created.
resource-group Name of the resource group where you create the storage path. For ease of management, we recommend that you use the same resource group as your Azure Local.
subscription Name or ID of the subscription where your Azure Local is deployed. This could also be another subscription you use for storage path on your Azure Local.
custom-location Name or ID of the custom location associated with your Azure Local where you're creating this storage path.
path Path on a disk to create storage path. The selected path should have sufficient space available for storing your VM image.

You could also use the following optional parameters:

Parameter Description
location Azure regions as specified by az locations.

Create a storage path

Follow these steps on one of the machines of your Azure Local instance to create a storage path:

Sign in and set subscription

  1. Connect to a machine on your Azure Local.

  2. Sign in. Type:

    az login --use-device-code
    
  3. Set your subscription.

    az account set --subscription <Subscription ID>
    

Set parameters

  1. Set parameters for your subscription, resource group, location, OS type for the image. Replace the < > with the appropriate values.

    $storagepathname="<Storage path name>"
    $path="<Path on the disk to cluster shared volume>"
    $subscription="<Subscription ID>"
    $resource_group="<Resource group name>"
    $customLocName="<Custom location of your Azure Local>"
    $customLocationID="/subscriptions/<Subscription ID>/resourceGroups/$resource_group/providers/Microsoft.ExtendedLocation/customLocations/$customLocName"
    $location="<Azure region where the system is deployed>"
    
  2. Create a storage path test-storagepath at the following path: C:\ClusterStorage\test-storagepath. Run the following cmdlet:

    az stack-hci-vm storagepath create --resource-group $resource_group --custom-location $customLocationID --name $storagepathname --path $path
    

    For more information on this cmdlet, see az stack-hci-vm storagepath create.

    Here's a sample output:

    PS C:\windows\system32> $storagepathname="test-storagepath"
    PS C:\windows\system32> $path="C:\ClusterStorage\UserStorage_1\mypath"
    PS C:\windows\system32> $subscription="<Subscription ID>"
    PS C:\windows\system32> $resource_group="mylocal-rg"
    PS C:\windows\system32> $customLocationID="/subscriptions/<Subscription ID>/resourceGroups/mylocal-rg/providers/Microsoft.ExtendedLocation/customLocations/mylocal-cl"
    
    PS C:\windows\system32> az stack-hci-vm storagepath create --name $storagepathname --resource-group $resource_group --custom-location $customLocationID --path $path
    Command group 'stack-hci-vm' is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
    {
      "extendedLocation": {
        "name": "/subscriptions/<Subscription ID>/resourceGroups/mylocal-rg/providers/Microsoft.ExtendedLocation/customLocations/mylocal-cl",
        "type": "CustomLocation"
      },
      "id": "/subscriptions/<Subscription ID>/resourceGroups/mylocal-rg/providers/Microsoft.AzureStackHCI/storagecontainers/test-storagepath",
      "location": "eastus",
      "name": "test-storagepath",
      "properties": {
        "path": "C:\\ClusterStorage\\UserStorage_1\\mypath",
        "provisioningState": "Succeeded",
        "status": {
          "availableSizeMB": 36761,
          "containerSizeMB": 243097
        }
      },
      "resourceGroup": "mylocal-rg",
      "systemData": {
        "createdAt": "2023-10-06T04:45:30.458242+00:00",
        "createdBy": "guspinto@contoso.com",
        "createdByType": "User",
        "lastModifiedAt": "2023-10-06T04:45:57.386895+00:00",
        "lastModifiedBy": "319f651f-7ddb-4fc6-9857-7aef9250bd05",
        "lastModifiedByType": "Application"
      },
      "tags": null,
      "type": "microsoft.azurestackhci/storagecontainers"
    }
    

Once the storage path creation is complete, you're ready to create virtual machine images.

Delete a storage path

If a storage path isn't required, you can delete it. To delete a storage path, first remove the associated workloads and then run the following command to delete the storage path:

az stack-hci-vm storagepath delete --resource-group "<resource group name>" --name "<storagepath name>" --yes

To verify that a storage path is deleted, run the following command:

az stack-hci-vm storagepath show --resource-group "<resource group name>" --name "<storagepath name>" 

You receive a notification that the storage path doesn't exist.

To delete a volume, first remove the associated workloads, then remove the storage paths, and then delete the volume. For more information, see Delete a volume.

If there's insufficient space at the storage path, then the VM provisioning using that storage path would fail. You might need to expand the volume associated with the storage path. For more information, see Expand the volume.

To troubleshoot any error when trying to delete a storage path, see Failure deleting storage path.

Next steps