Skip to content

Add Garnet cache cluster PowerShell cmdlets for Az.CosmosDB (preview) - #29983

Open
Karthik chakravarthy (kcheekuri) wants to merge 8 commits into
Azure:Az.CosmosDB-previewfrom
kcheekuri:feature/garnet-powershell-cmdlets-preview
Open

Add Garnet cache cluster PowerShell cmdlets for Az.CosmosDB (preview)#29983
Karthik chakravarthy (kcheekuri) wants to merge 8 commits into
Azure:Az.CosmosDB-previewfrom
kcheekuri:feature/garnet-powershell-cmdlets-preview

Conversation

@kcheekuri

Copy link
Copy Markdown

Description

Add PowerShell cmdlets for Azure Cosmos DB Garnet cache cluster management (preview).

This PR introduces 4 new cmdlets following the existing Managed Cassandra pattern:

  • New-AzCosmosDBGarnetCluster — Create a new Garnet cache cluster
  • Get-AzCosmosDBGarnetCluster — Get/list Garnet cache clusters (by name, resource group, or subscription)
  • Update-AzCosmosDBGarnetCluster — Update an existing Garnet cache cluster (PATCH)
  • Remove-AzCosmosDBGarnetCluster — Delete a Garnet cache cluster

API Version: 2026-04-01-preview

Changes include:

  • Cmdlet implementations with ResourceId/InputObject/Name parameter sets
  • PS model wrappers (PSGarnetClusterResource, PSGarnetClusterResourceProperties)
  • Help documentation (4 markdown files)
  • Scenario test scaffolding
  • ChangeLog and module manifest updates

The Garnet SDK operations are already generated in the Az.CosmosDB-preview branch via the combined openapi.json from azure-rest-api-specs.

Checklist

  • SHOULD select appropriate branch. Cmdlets from Autorest.PowerShell should go to generation branch.
  • SHOULD make the title of PR clear and informative, and in the present imperative tense.
  • SHOULD update ChangeLog.md file(s) appropriately
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense. Add changelog in description section if PR goes into generation branch.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD have approved design review for the changes in this repository (Microsoft internal only) with following situations
    • Create new module from scratch
    • Create new resource types which are not easy to conform to Azure PowerShell Design Guidelines
    • Create new resource type which name doesn't use module name as prefix
    • Have design question before implementation
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT introduce breaking changes in Az minor release except preview version.
  • SHOULD NOT adjust version of module manually in pull request

Add PowerShell cmdlet support for Garnet cache cluster management under
the Az.CosmosDB module, following the Managed Cassandra pattern. This includes:

- New-AzCosmosDBGarnetCluster: Create a new Garnet cache cluster with
  conflict detection
- Get-AzCosmosDBGarnetCluster: Get/List Garnet cluster(s) by name,
  resource group, subscription, ResourceId, or pipeline InputObject
- Update-AzCosmosDBGarnetCluster: Update an existing cluster with
  GET-then-merge pattern and ResourceId/InputObject support
- Remove-AzCosmosDBGarnetCluster: Delete a cluster with ResourceId,
  InputObject, AsJob, and PassThru support

Supporting changes:
- NewOrUpdateAzGarnetCluster shared base class for common parameters
- PSGarnetClusterResource and PSGarnetClusterResourceProperties models
  in Models/Garnet/ subfolder
- Garnet constants for help messages (including Location)
- SDK autorest config updated to include 2026-04-01-preview openapi.json
- Module manifest updated to export new cmdlets
- ChangeLog updated

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix Tags not being passed in Update PATCH request (high severity bug)
- Add UTF-8 BOM to all Garnet .cs files to match codebase convention
- Use correct commit hash (2a96231) for 2026-04-01-preview Garnet spec

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Generated from garnet.json (extracted Garnet-only spec from
2026-04-01-preview openapi.json to avoid conflicts with existing
swagger files).

Generated files:
- GarnetClustersOperations.cs (CRUD + List operations)
- IGarnetClustersOperations.cs (interface)
- 10 model classes (GarnetClusterResource, Properties, Patch, etc.)
- CosmosDBManagementClient.cs updated with GarnetClusters property

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The GarnetClusterResourcePatch model only has Properties, no Tags.
Tags can only be updated via PUT (CreateUpdate), not PATCH.
Removed dead tagsDict code from Update cmdlet.

Build verified: 0 errors, 0 warnings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- 4 help markdown files (Get, New, Update, Remove)\n- GarnetClusterTests.cs xUnit test runner\n- GarnetClusterTests.ps1 PowerShell test script\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ocal swagger

- Remove unused 'using System;' and 'using Microsoft.Azure.Management.CosmosDB;' from New cmdlet
- Move Tag parameter from base class to New cmdlet only (PATCH doesn't support tags)
- Capitalize 'Resource ID' in help message constant
- Remove local garnet.json; reference remote azure-rest-api-specs URL instead

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

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.

Pull request overview

Adds preview support in Az.CosmosDB for managing Azure Cosmos DB Garnet cache clusters via new PowerShell cmdlets, aligning with existing Managed Cassandra patterns.

Changes:

  • Introduces 4 new cmdlets for Garnet cluster CRUD: New-, Get-, Update-, Remove-AzCosmosDBGarnetCluster.
  • Adds PowerShell model wrappers plus help content and module index updates.
  • Updates module exports + changelog, and adds scenario test scaffolding; includes management SDK regeneration artifacts.

Reviewed changes

Copilot reviewed 17 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/CosmosDB/CosmosDB/Models/Garnet/PSGarnetClusterResourceProperties.cs Adds PS wrapper for Garnet cluster properties returned by the SDK.
src/CosmosDB/CosmosDB/Models/Garnet/PSGarnetClusterResource.cs Adds PS wrapper for Garnet cluster resource (Id/Name/Location/Tags/Properties).
src/CosmosDB/CosmosDB/Helpers/Constants.cs Adds help-message constants for new Garnet cmdlet parameters.
src/CosmosDB/CosmosDB/help/Update-AzCosmosDBGarnetCluster.md Adds reference help for Update cmdlet (PATCH-able properties).
src/CosmosDB/CosmosDB/help/Remove-AzCosmosDBGarnetCluster.md Adds reference help for Remove cmdlet (delete).
src/CosmosDB/CosmosDB/help/New-AzCosmosDBGarnetCluster.md Adds reference help for New cmdlet (create).
src/CosmosDB/CosmosDB/help/Get-AzCosmosDBGarnetCluster.md Adds reference help for Get cmdlet (get/list).
src/CosmosDB/CosmosDB/help/Az.CosmosDB.md Updates module help index to include new Garnet cmdlets and description.
src/CosmosDB/CosmosDB/Garnet/UpdateAzCosmosDBGarnetCluster.cs Implements Update cmdlet using the GarnetClusters PATCH API.
src/CosmosDB/CosmosDB/Garnet/RemoveAzCosmosDBGarnetCluster.cs Implements Remove cmdlet using the GarnetClusters DELETE API.
src/CosmosDB/CosmosDB/Garnet/NewOrUpdateAzGarnetCluster.cs Shared parameter base class for New/Update Garnet cmdlets.
src/CosmosDB/CosmosDB/Garnet/NewAzCosmosDBGarnetCluster.cs Implements New cmdlet using the GarnetClusters PUT create/update API.
src/CosmosDB/CosmosDB/Garnet/GetAzCosmosDBGarnetCluster.cs Implements Get cmdlet using GarnetClusters GET/list APIs.
src/CosmosDB/CosmosDB/ChangeLog.md Adds upcoming-release entry advertising new Garnet cmdlets.
src/CosmosDB/CosmosDB/Az.CosmosDB.psd1 Exports the new cmdlets from the Az.CosmosDB module manifest.
src/CosmosDB/CosmosDB.Test/ScenarioTests/GarnetClusterTests.ps1 Adds scenario test script to exercise Garnet cmdlets across parameter sets.
src/CosmosDB/CosmosDB.Test/ScenarioTests/GarnetClusterTests.cs Adds xUnit entry point for the Garnet scenario script (currently skipped).
src/CosmosDB/CosmosDB.Management.Sdk/Generated/Models/ManagedCassandraManagedServiceIdentityAutoGenerated.cs SDK regeneration output (new model).
src/CosmosDB/CosmosDB.Management.Sdk/Generated/Models/ErrorResponseAutoGenerated3Exception.cs SDK regeneration output (new error type).
src/CosmosDB/CosmosDB.Management.Sdk/Generated/Models/ErrorResponseAutoGenerated3.cs SDK regeneration output (new error model).
src/CosmosDB/CosmosDB.Management.Sdk/Generated/Models/ErrorDetailAutoGenerated2.cs SDK regeneration output (new error detail model).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/CosmosDB/CosmosDB/Garnet/NewAzCosmosDBGarnetCluster.cs
Comment thread src/CosmosDB/CosmosDB/Garnet/UpdateAzCosmosDBGarnetCluster.cs
Comment thread src/CosmosDB/CosmosDB.Test/ScenarioTests/GarnetClusterTests.cs Outdated
@wangzelin007

Copy link
Copy Markdown
Member

Karthik chakravarthy (@kcheekuri) Please fix the CI failures.

- Remove ErrorDetailAutoGenerated2, ErrorResponseAutoGenerated3, and
  ManagedCassandraManagedServiceIdentityAutoGenerated (preview branch
  already has correct generated types)
- Change test from Skip to LiveOnly trait (runs in live test environments)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

Static analysis enforces singular noun naming for parameters.
Renamed 'Extensions' to 'Extension' in New and Update cmdlets,
base class, and corresponding help documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 3 pipeline(s).

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.

4 participants