Skip to content

How does one launch a VM from a Community Gallery ?Β #28448

@isra-fel

Description

@isra-fel

Discussed in https://github.com/Azure/azure-powershell/discussions/28404

Originally posted by mfortin August 18, 2025
I can launch VM using New-AzVM cmdlets from a SharedGallery, a legacy image or from the marketplace, however I can't figure how to launch a VM from a Community Gallery.

Fort instance this image: /CommunityGalleries/rocky-dc1c6aa6-905b-4d9c-9577-63ccc28c482a/Images/Rocky-9-x86_64/Versions/9.4.20240509

I am getting the following stack trace:

Microsoft.Azure.Commands.Compute.Common.ComputeCloudException: Property id '/CommunityGalleries/rocky-dc1c6aa6-905b-4d9c-9577-63ccc28c482a/Images/Rocky-9-x86_64/Versions/9.4.20240509' at path 'properties.storageProfile.imageReference.id' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
ErrorCode: LinkedInvalidPropertyId
ErrorMessage: Property id '/CommunityGalleries/rocky-dc1c6aa6-905b-4d9c-9577-63ccc28c482a/Images/Rocky-9-x86_64/Versions/9.4.20240509' at path 'properties.storageProfile.imageReference.id' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
ErrorTarget:
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 4215044a-45df-45fd-8087-46518e025d5b
 ---> Microsoft.Rest.Azure.CloudException: Property id '/CommunityGalleries/rocky-dc1c6aa6-905b-4d9c-9577-63ccc28c482a/Images/Rocky-9-x86_64/Versions/9.4.20240509' at path 'properties.storageProfile.imageReference.id' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
   at Microsoft.Azure.Commands.Compute.NewAzureVMCommand.<>c__DisplayClass259_0.<DefaultExecuteCmdlet>b__0()
   at Microsoft.Azure.Commands.Compute.ComputeClientBaseCmdlet.ExecuteClientAction(Action action)
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Commands.Compute.ComputeClientBaseCmdlet.ExecuteClientAction(Action action)
   at Microsoft.Azure.Commands.Compute.NewAzureVMCommand.DefaultExecuteCmdlet()
   at Microsoft.Azure.Commands.Compute.NewAzureVMCommand.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
System.Management.Automation.InvocationInfo

I tried with:

$VmConfig = New-AzVMConfig -VMName "${ImageName}" -VMSize "${InstanceType}" -ImageReferenceId ${ImageId}

and I also tried

Set-AzVMSourceImage -VM $VmConfig -Id ${ImageId}
```

What am I doing wrong ?

Using pwsh 7.5.2, Az 14.3.0, Az.Compute 10.2.0</div>

Metadata

Metadata

Labels

Compute - ImagesService AttentionThis issue is responsible by Azure service team.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions