Skip to content

Commit 91dab06

Browse files
Merge pull request #268009 from sandeepraichura/patch-77
Update shared-image-galleries.md
2 parents d110040 + 5ccff0c commit 91dab06

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

articles/virtual-machines/shared-image-galleries.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ You can create Azure Compute Gallery resource using templates. There are several
183183
* [What API version should I use when creating images?](#what-api-version-should-i-use-when-creating-images)
184184
* [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)
185185
* [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)
186187

187188
### How can I list all the Azure Compute Gallery resources across subscriptions?
188189

@@ -312,6 +313,33 @@ For VM and Virtual Machine Scale Set deployments using an image version, we reco
312313

313314
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.
314315

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+
```
315343
## Troubleshoot
316344
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).
317345

0 commit comments

Comments
 (0)