Add Azure Compute Gallery soft-delete and restore support - #30221
Haider Agha (haagha) with Copilot wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request. Check if the Files changed in this pull request are included in default exclusions.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: haagha <64601174+haagha@users.noreply.github.com>
Co-authored-by: haagha <64601174+haagha@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The scenario fails parameter binding, lacks playback data, and the generated SDK and help surfaces are inconsistent.
Review effort: Balanced
Findings: 2
Open (5)
Add missing playback cassette for CheckIn scenario · New Remove unsupported Location parameter from restore invocation · New Update SDK README contract version to 2026-03-03 · New Replace nonexistent GalleryImageDefinitionResourceId with ResourceId · New Regenerate help metadata from cmdlet parameter definitions · New
| [Fact] | ||
| [Trait(Category.AcceptanceType, Category.CheckIn)] | ||
| public void TestGalleryImageVersionSoftDelete() |
|
|
||
| # Restore the soft-deleted image version | ||
| Restore-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName ` | ||
| -GalleryImageDefinitionName $galleryImageName -Name $galleryImageVersionName -Location $loc; |
| } | ||
|
|
||
| string apiVersion = "2025-12-03"; | ||
| string apiVersion = "2026-03-03"; |
| ### ResourceIdParameter | ||
| ``` | ||
| Get-AzGallerySoftDeletedImageVersion [-GalleryImageDefinitionResourceId] <String> | ||
| [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>] |
| ### DefaultParameter (Default) | ||
| ``` | ||
| Restore-AzGalleryImageVersion -ResourceGroupName <String> -GalleryName <String> | ||
| -GalleryImageDefinitionName <String> -Name <String> -Location <String> [-AsJob] |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The restore request omits the required restore marker, read operations remain on the older API contract, and several public help/model surfaces are inconsistent or incomplete.
Review effort: Balanced
Findings: 3
Open (11)
Restore request omits restore flag and uses wrong operation · New Remove unsupported Location parameter from restore invocation Add missing playback cassette for CheckIn scenario Regenerate GalleryRP client and pin all operations to 2026-03-03 · New Expose ConsumptionEndTime and ImageState on shared image versions · New Update SDK README contract version to 2026-03-03 Regenerate help for soft-delete parameters and types · New Fix restore example to demonstrate pipeline input · New Document all soft-delete parameters with correct types · New Regenerate help metadata from cmdlet parameter definitions Replace nonexistent GalleryImageDefinitionResourceId with ResourceId
| GalleryImageVersion galleryImageVersion = new GalleryImageVersion | ||
| { | ||
| Location = this.Location | ||
| }; |
| } | ||
| } | ||
| string apiVersion = "2025-12-03"; | ||
| string apiVersion = "2026-03-03"; |
| public GalleryImageVersionStorageProfile StorageProfile { get; set; } | ||
| public ReplicationStatus ReplicationStatus { get; set; } | ||
| public GalleryImageVersionSafetyProfile SafetyProfile { get; set; } | ||
| public bool? Restore { get; set; } |
| [-Description <String>] [-Tag <Hashtable>] [-Permission <String>] [-PublisherUri <String>] | ||
| [-PublisherContact <String>] [-Eula <String>] [-PublicNamePrefix <String>] | ||
| [-EnableSystemAssignedIdentity] [-UserAssignedIdentity <String[]>] | ||
| [-EnableSystemAssignedIdentity] [-UserAssignedIdentity <String[]>] [-EnableSoftDelete] [-DisableSoftDelete] [-SoftDeleteRetentionPeriodInDays <Int32>] [-SoftDeleteGracePeriodInDays <Int32>] |
|
|
||
| ### Example 2 | ||
| ```powershell | ||
| Restore-AzGalleryImageVersion -ResourceGroupName $rgname -GalleryName $galleryName -GalleryImageDefinitionName $imageName -Name "1.0.0" -Location $loc |
| [-PublisherUri <String>] [-PublisherContact <String>] [-Eula <String>] [-PublicNamePrefix <String>] | ||
| [-EnableSystemAssignedIdentity] [-DisableSystemAssignedIdentity] | ||
| [-UserAssignedIdentity <String[]>] [-RemoveUserAssignedIdentity <String[]>] | ||
| [-EnableSoftDelete] [-DisableSoftDelete] [-SoftDeleteRetentionPeriodInDays <Int32>] [-SoftDeleteGracePeriodInDays <Int32>] |



Adds Azure Compute Gallery soft-delete policy management, recycle-bin discovery, restoration, and permanent deletion bypass support for API version
2026-03-03.-EnableSoftDelete,-DisableSoftDelete, retention, and grace-period parameters.Get-AzGallerySoftDeletedImageVersion.Restore-AzGalleryImageVersionwith mandatory original home-region-Location.Remove-AzGalleryImageVersion -BypassSoftDeletefor irreversible deletion.ConsumptionEndTimeandImageState.PSGallerySoftDeletedImageVersionobjects.Verification Checklist