Skip to content

Conversation

@ericshape
Copy link
Member

@ericshape ericshape commented Sep 3, 2025

What does this PR do?

Add SQL Server firewall rule create and delete commands and unit tests

  • azmcp sql server firewall-rule create
  • azmcp sql server firewall-rule delete

GitHub issue number?

#225 #240

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
    • Updated CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
    • Spelling check passes: .\eng\common\spelling\Invoke-Cspell.ps1
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated README.md documentation
    • Updated command list in /docs/azmcp-commands.md
    • Updated test prompts in /docs/e2eTestPrompts.md
    • 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 Community (non-Azure 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 azure - mcp to run Live Test Pipeline

@ericshape
Copy link
Member Author

/azp run azure - mcp

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@ericshape
Copy link
Member Author

/azp run mcp - pullrequest - live

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ericshape
Copy link
Member Author

/azp run mcp - pullrequest - live

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ericshape ericshape moved this from Untriaged to In Progress in Azure MCP Server Sep 3, 2025
@ericshape ericshape self-assigned this Sep 3, 2025
@ericshape ericshape marked this pull request as ready for review September 3, 2025 23:42
Copilot AI review requested due to automatic review settings September 3, 2025 23:42
@ericshape ericshape requested a review from a team as a code owner September 3, 2025 23:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds SQL server firewall rule create and delete commands to the Azure MCP Server, allowing users to manage IP access controls for their Azure SQL servers programmatically through the MCP interface.

  • Implements azmcp sql server firewall-rule create and delete commands with comprehensive validation
  • Adds complete unit test suites for both commands covering various scenarios and error conditions
  • Integrates live tests to verify functionality against actual Azure resources

Reviewed Changes

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

Show a summary per file
File Description
FirewallRuleCreateCommand.cs Implements the create command with IP range validation and error handling
FirewallRuleDeleteCommand.cs Implements the delete command with idempotent behavior
FirewallRuleCreateCommandTests.cs Comprehensive unit tests for the create command
FirewallRuleDeleteCommandTests.cs Comprehensive unit tests for the delete command
SqlService.cs Adds service layer methods for creating and deleting firewall rules
ISqlService.cs Interface definitions for the new firewall rule operations
SqlCommandTests.cs Live integration tests for the new commands
SqlSetup.cs Registers the new commands with the command system
Various option/model files Supporting infrastructure for command parameters and data models
Comments suppressed due to low confidence (1)

tools/Azure.Mcp.Tools.Sql/src/Services/SqlService.cs:1

  • The variable name sqlDatabase is misleading since it's of type SqlDatabaseData?. Consider renaming to sqlDatabaseData to better reflect its actual type.
// Copyright (c) Microsoft Corporation.

@ericshape ericshape enabled auto-merge (squash) September 4, 2025 00:15
@ericshape ericshape merged commit b557155 into microsoft:main Sep 4, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure MCP Server Sep 4, 2025
colbytimm pushed a commit to colbytimm/microsoft-mcp that referenced this pull request Sep 27, 2025
… unit tests (microsoft#121)

* Add SQL Server firewall rule create and delete commands and unit tests

* fix format issue

* Delete Azure.Mcp.Tools.Sql.UnitTests.sln.DotSettings.user

* Move SqlSetup to  AOT compatibility exception section.

* fix AOT issue

* add docs and update firewall-rule-name in the parameter list

* Update CHANGELOG.md

* fix failed live test

* add delete unit test

* add delete firewall rule unit test

* remove blank line

Co-authored-by: Copilot <[email protected]>

* remove explict reference

Co-authored-by: Copilot <[email protected]>

* remove explict reference

Co-authored-by: Copilot <[email protected]>

* Revert "remove explict reference"

This reverts commit 1504bd8.

* Revert "remove explict reference"

This reverts commit 8e25827.

---------

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add azmcp sql server firewall-rule delete impl and test Add azmcp sql server firewall-rule create impl and test

3 participants