Skip to content

Commit 91f1030

Browse files
committed
update
1 parent afcc160 commit 91f1030

File tree

1 file changed

+115
-2
lines changed

1 file changed

+115
-2
lines changed

azure-local/manage/virtual-machine-image-azure-compute-gallery.md

Lines changed: 115 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.topic: how-to
77
ms.service: azure-local
88
ms.custom:
99
- devx-track-azurecli
10-
ms.date: 05/06/2025
10+
ms.date: 05/21/2025
1111
---
1212

1313
# Create Azure Local VM image using Azure Compute Gallery images
@@ -40,11 +40,124 @@ To transfer your Azure Compute Gallery image to be an Azure Local compatible ima
4040
az disk grant-access --resource-group $resourceGroupName --name $diskName --duration-in-seconds $sasExpiryDuration --query [accessSas] -o tsv
4141
```
4242
43+
## Set some parameters
44+
45+
### Set some parameters
46+
47+
1. Set your subscription, resource group, location, path to the image in local share, and OS type for the image. Replace the parameters in `< >` with the appropriate values.
48+
49+
```azurecli
50+
$subscription = "<Subscription ID>"
51+
$resource_group = "<Resource group>"
52+
$location = "<Location for your Azure Local>"
53+
$osType = "<OS of source image>"
54+
$imageName = "<VM image name>"
55+
```
56+
57+
The parameters are described in the following table:
58+
59+
| Parameter | Description |
60+
|------------------|--------------------------------------------------------------------------------------------|
61+
| `subscription` | Subscription for Azure Local that you associate with this image. |
62+
| `resource_group` | Resource group for Azure Local that you associate with this image. |
63+
| `location` | Location for your Azure Local instance. For example, this could be `eastus`. |
64+
| `imageName` | Name of the VM image created starting with the image in your local share. <br> **Note**: Azure rejects all the names that contain the keyword Windows. |
65+
| `os-type` | Operating system associated with the source image. This can be Windows or Linux. |
66+
67+
Here's a sample output:
68+
69+
```
70+
PS C:\Users\azcli> $subscription = "<Subscription ID>"
71+
PS C:\Users\azcli> $resource_group = "mylocal-rg"
72+
PS C:\Users\azcli> $location = "eastus"
73+
PS C:\Users\azcli> $osType = "Windows"
74+
PS C:\Users\azcli> $imageName = "mylocal-computegalleryimage"
75+
```
76+
4377
## Create an Azure Local VM image
4478

4579
To create an Azure Local VM image:
4680

47-
1. Follow the steps in [Create Azure Local VM image in Azure Storage account](virtual-machine-image-storage-account.md#set-some-parameters), using the SAS token from the managed disk instead of the storage account container.
81+
1. Select a custom location to deploy your VM image. The custom location should correspond to the custom location for your Azure Local. Get the custom location ID for your Azure Local. Run the following command:
82+
83+
```azurecli
84+
$customLocationID=(az customlocation show --resource-group $resource_group --name "<custom location name for your Azure Local>" --query id -o tsv)
85+
```
86+
87+
1. Create the VM image starting with a specified marketplace image. Make sure to specify the offer, publisher, sku and version for the marketplace image.
88+
89+
```azurecli
90+
az stack-hci-vm image create --subscription $subscription --resource-group $resource_Group --custom-location $customLocationID --location $location --name $imageName --os-type $osType --image-path $imageSourcePath --storage-path-id $storagepathid
91+
```
92+
93+
A deployment job starts for the VM image.
94+
95+
In this example, the storage path was specified using the `--storage-path-id` flag and that ensured that the workload data (including the VM, VM image, non-OS data disk) is placed in the specified storage path.
96+
97+
If the flag is not specified, the workload data is automatically placed in a high availability storage path.
98+
99+
The image deployment takes a few minutes to complete. The time taken to download the image depends on the size of the image and the network bandwidth available for the download.
100+
101+
Here's a sample output:
102+
103+
```
104+
PS > $customLocationID=(az customlocation show --resource-group $resource_group --name "mylocal-cl" --query id -o tsv)
105+
PS C:\Users\azcli> az stack-hci-vm image create -g $rg --custom-location $cl --name "ws2022-acg" --os-type "Windows" --image-path $sas
106+
107+
{
108+
"extendedLocation": {
109+
"name": "/subscriptions/304d8fdf-1c02-4907-9c3a-ddbd677199cd/resourceGroups/EDGECI-REGISTRATION-rr1s45r2305-yxwEPQD5/providers/Microsoft.ExtendedLocation/customLocations/s45r2305-cl-customlocation",
110+
"type": "CustomLocation"
111+
},
112+
"id": "/subscriptions/304d8fdf-1c02-4907-9c3a-ddbd677199cd/resourceGroups/EDGECI-REGISTRATION-rr1s45r2305-yxwEPQD5/providers/Microsoft.AzureStackHCI/galleryImages/ws2022-acg",
113+
"location": "eastus2euap",
114+
"name": "ws2022-acg",
115+
"properties": {
116+
"cloudInitDataSource": null,
117+
"containerId": "/subscriptions/304d8fdf-1c02-4907-9c3a-ddbd677199cd/resourceGroups/EDGECI-REGISTRATION-rr1s45r2305-yxwEPQD5/providers/Microsoft.AzureStackHCI/storageContainers/UserStorage2-213e900d7d9646a18b0f0d78e05d2fac",
118+
"hyperVGeneration": null,
119+
"identifier": null,
120+
"imagePath": null,
121+
"osType": "Windows",
122+
"provisioningState": "Succeeded",
123+
"sourceVirtualMachineId": null,
124+
"status": {
125+
"downloadStatus": {
126+
"downloadSizeInMb": 11482
127+
},
128+
"errorCode": "",
129+
"errorMessage": "",
130+
"progressPercentage": 100,
131+
"provisioningStatus": {
132+
"operationId": "c8ddceb0-024a-4c2c-b085-5851f49c8e70*C185A1631E1C1B45E1069847327BBD6B413DB17AA1F8C87B2911596ACA473D16",
133+
"status": "Succeeded"
134+
}
135+
},
136+
"version": {
137+
"name": null,
138+
"properties": {
139+
"storageProfile": {
140+
"osDiskImage": {
141+
"sizeInMb": 130050
142+
}
143+
}
144+
}
145+
},
146+
"vmImageRepositoryCredentials": null
147+
},
148+
"resourceGroup": "EDGECI-REGISTRATION-rr1s45r2305-yxwEPQD5",
149+
"systemData": {
150+
"createdAt": "2025-05-21T00:44:16.385633+00:00",
151+
"createdBy": "[email protected]",
152+
"createdByType": "User",
153+
"lastModifiedAt": "2025-05-21T00:48:34.016113+00:00",
154+
"lastModifiedBy": "319f651f-7ddb-4fc6-9857-7aef9250bd05",
155+
"lastModifiedByType": "Application"
156+
},
157+
"tags": null,
158+
"type": "microsoft.azurestackhci/galleryimages"
159+
}
160+
```
48161
49162
1. To avoid costs associated with a disk, make sure to delete the managed disk that was used to create this image using the following command:
50163

0 commit comments

Comments
 (0)