Skip to content

Fixed issue calling namespace_update related to PartitionCount updates - #3187

Merged
LarryOsterman merged 3 commits into
mainfrom
larryo/fixed_namespace_update_tool
Aug 3, 2026
Merged

Fixed issue calling namespace_update related to PartitionCount updates#3187
LarryOsterman merged 3 commits into
mainfrom
larryo/fixed_namespace_update_tool

Conversation

@LarryOsterman

Copy link
Copy Markdown
Member

What does this PR do?

The namespace_update tool fails with "PartitionCount cannot be updated" error when the tool is called to update a partition. This is because ARM treats the namespace update as a merge/patch update rather than a put.

GitHub issue number?

[Link to the GitHub issue this PR addresses]

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • Updated test prompts in servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Copilot AI review requested due to automatic review settings July 30, 2026 23:39
@LarryOsterman
LarryOsterman requested review from a team and jairmyree as code owners July 30, 2026 23:39
@github-actions github-actions Bot added the tools-EventHubs Event Hubs MCP tools label Jul 30, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

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

Fixes Event Hubs event hub create/update behavior so that updating a subset of properties doesn’t accidentally omit existing values (notably PartitionCount) in the PUT payload, which can trigger ARM validation errors.

Changes:

  • Fetch existing Event Hub data (if present) before issuing CreateOrUpdateAsync.
  • Preserve PartitionCount, RetentionDescription, and Status when the caller doesn’t provide new values.

Comment thread tools/Azure.Mcp.Tools.EventHubs/src/Services/EventHubsService.cs Outdated
Comment thread tools/Azure.Mcp.Tools.EventHubs/src/Services/EventHubsService.cs Outdated
@LarryOsterman
LarryOsterman force-pushed the larryo/fixed_namespace_update_tool branch from 34028fd to d7d412d Compare July 31, 2026 18:02
@LarryOsterman
LarryOsterman requested a review from a team as a code owner July 31, 2026 21:31
LarryOsterman and others added 3 commits August 3, 2026 11:02
CreateOrUpdateEventHubAsync dereferenced GetIfExistsAsync's
NullableResponse<T>.Value directly via the null-conditional operator,
which does not guard against the Value getter throwing
InvalidOperationException when the entity does not exist (a 404 was
returned). This caused EventHubs create/update operations for brand
new event hubs and consumer groups to fail deterministically.

Fixed by checking HasValue before accessing Value, matching the
existing convention used elsewhere in this file for the same
NullableResponse pattern. Also added a defensive eventual-consistency
retry helper around ARM operation.Value/GET resolution for entities
that were just created.

Re-recorded all EventHubs live tests (109/109 passing in both Record
and Playback mode) against the Azure SDK Test Resources - TME
subscription and pushed recordings to Azure/azure-sdk-assets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@LarryOsterman
LarryOsterman force-pushed the larryo/fixed_namespace_update_tool branch from 18dc4b6 to 9ad2821 Compare August 3, 2026 18:02

@conniey conniey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lgtm

@LarryOsterman
LarryOsterman merged commit 9c81a45 into main Aug 3, 2026
16 checks passed
@LarryOsterman
LarryOsterman deleted the larryo/fixed_namespace_update_tool branch August 3, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools-EventHubs Event Hubs MCP tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants