Skip to content

Add Azure Compute Gallery soft-delete and restore support - #30221

Draft
Haider Agha (haagha) with Copilot wants to merge 3 commits into
mainfrom
copilot/az-compute-gallery-image-version-soft-delete
Draft

Haider Agha (haagha) with Copilot wants to merge 3 commits into
mainfrom
copilot/az-compute-gallery-image-version-soft-delete

Conversation

Copilot AI commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds Azure Compute Gallery soft-delete policy management, recycle-bin discovery, restoration, and permanent deletion bypass support for API version 2026-03-03.

  • Gallery policy
    • Add -EnableSoftDelete, -DisableSoftDelete, retention, and grace-period parameters.
    • Preserve omitted policy fields during updates.
  • Image-version lifecycle
    • Add Get-AzGallerySoftDeletedImageVersion.
    • Add Restore-AzGalleryImageVersion with mandatory original home-region -Location.
    • Add Remove-AzGalleryImageVersion -BypassSoftDelete for irreversible deletion.
  • Models and outputs
    • Expose soft-delete policy periods and recycle-bin timestamps.
    • Add shared/community image-version ConsumptionEndTime and ImageState.
    • Emit strongly typed PSGallerySoftDeletedImageVersion objects.
  • Repository surfaces
    • Update generated SDK operations, cmdlet exports, help, changelog, and gallery lifecycle scenarios.
$deleted = Get-AzGallerySoftDeletedImageVersion `
    -ResourceGroupName $resourceGroupName `
    -GalleryName $galleryName `
    -GalleryImageDefinitionName $imageName `
    -Name '1.0.0'

Restore-AzGalleryImageVersion `
    -ResourceGroupName $resourceGroupName `
    -GalleryName $galleryName `
    -GalleryImageDefinitionName $imageName `
    -Name $deleted.Name `
    -Location $deleted.Location

Verification Checklist

  • Gallery policy parameters and serialization updated
  • Recycle-bin discovery and restore cmdlets documented and exported
  • Permanent deletion bypass mapped to the DELETE query parameter
  • Public models and output mappings updated
  • Help examples and changelog updated
  • Scenario coverage added for lifecycle and policy behavior

Copilot AI balanced review requested due to automatic review settings September 29, 2026 17:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor
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>
Copilot AI balanced review requested due to automatic review settings September 29, 2026 18:28
Co-authored-by: haagha <64601174+haagha@users.noreply.github.com>
Copilot AI changed the title [WIP] Add cmdlet syntax for Azure Compute Gallery image version soft delete Add Azure Compute Gallery soft-delete and restore support Sep 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity · 1 Medium severity · 2 Low severity

Open (5)

Comment on lines +152 to +154
[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";
Comment on lines +22 to +25
### ResourceIdParameter
```
Get-AzGallerySoftDeletedImageVersion [-GalleryImageDefinitionResourceId] <String>
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Comment on lines +15 to +18
### DefaultParameter (Default)
```
Restore-AzGalleryImageVersion -ResourceGroupName <String> -GalleryName <String>
-GalleryImageDefinitionName <String> -Name <String> -Location <String> [-AsJob]
Copilot AI balanced review requested due to automatic review settings September 29, 2026 18:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +46 to +49
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>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants