You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/shared-image-galleries.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -183,6 +183,7 @@ You can create Azure Compute Gallery resource using templates. There are several
183
183
*[What API version should I use when creating images?](#what-api-version-should-i-use-when-creating-images)
184
184
*[What API version should I use to create a VM or Virtual Machine Scale Set out of the image version?](#what-api-version-should-i-use-to-create-a-vm-or-virtual-machine-scale-set-out-of-the-image-version)
185
185
*[Can I update my Virtual Machine Scale Set created using managed image to use Azure Compute Gallery images?](#can-i-update-my-virtual-machine-scale-set-created-using-managed-image-to-use-azure-compute-gallery-images)
186
+
*[How can update my code to use the new property and improve security and ensure permissions are granted accurately during VM image creation?](#how-can-update-my-code-to-use-the-new-property-and-improve-security-and-ensure-permissions-are-granted-accurately-during-vm-image-creation)
186
187
187
188
### How can I list all the Azure Compute Gallery resources across subscriptions?
188
189
@@ -312,6 +313,33 @@ For VM and Virtual Machine Scale Set deployments using an image version, we reco
312
313
313
314
Yes, you can update the scale set image reference from a managed image to an Azure Compute Gallery image, as long as the OS type, Hyper-V generation, and the data disk layout matches between the images.
314
315
316
+
### How can update my code to use the new property and improve security and ensure permissions are granted accurately during VM image creation?
317
+
```
318
+
For Virtual Machine ID field, use VirtualMachineId field under GallerySource(GalleryImageVersionStorageProfile.GallerySource.VirtualMachineID). The new property requires api-version 2023-07-03 or version 1.4.0 (or higher) of .NET SDK
319
+
320
+
StorageProfile = new GalleryImageVersionStorageProfile()
321
+
{
322
+
GallerySource = new GalleryArtifactVersionFullSource()
323
+
{
324
+
VirtualMachineId = new ResourceIdentifier(virtualMachineId),
325
+
}
326
+
},
327
+
```
328
+
```
329
+
For VHD as a source, use StorageAccountID field under GallerySource under OS disk or Data disk Image(GalleryImageVersionStorageProfile.OSDiskImage.GallerySource.StorageAccountId). The new property requires api-version 2023-07-03 or version 1.4.0 (or higher) of .NET SDK
330
+
331
+
StorageProfile = new GalleryImageVersionStorageProfile()
332
+
{
333
+
OSDiskImage = new GalleryOSDiskImage()
334
+
{
335
+
GallerySource = new GalleryDiskImageSource()
336
+
{
337
+
StorageAccountId = new ResourceIdentifier(storageAccountId),
338
+
Uri = new Uri(blobUri),
339
+
}
340
+
}
341
+
},
342
+
```
315
343
## Troubleshoot
316
344
If you have issues with performing any operations on the gallery resources, consult the list of common errors in the [troubleshooting guide](troubleshooting-shared-images.md).
0 commit comments