Skip to content

Conversation

@ankushbindlish2
Copy link
Member

@ankushbindlish2 ankushbindlish2 commented Jan 7, 2026

What does this PR do?

Microsoft.FileShares is the Azure Resource Provider for managing Azure File Shares and related operations such as snapshots, limits, and provisioning recommendations. This MCP integration exposes CLI commands aligned with the REST API operations defined in the Swagger specification.

This PR adds comprehensive support for the Microsoft.FileShares resource provider to Azure MCP Server, enabling AI agents to manage Azure File Shares, snapshots, and private endpoint connections through 15 commands across four operational categories.

Changes

New Toolset: Azure.Mcp.Tools.FileShares

Implemented a complete MCP toolset with 15 commands across four categories:

📁 File Share Management (5 commands)

  • azmcp fileshares fileshare get - Get file share details
  • azmcp fileshares fileshare create - Create new file share
  • azmcp fileshares fileshare update - Update file share properties
  • azmcp fileshares fileshare delete - Delete file share ⚠️ destructive
  • azmcp fileshares fileshare checknameavailability - Validate name availability

📸 Snapshot Operations (4 commands)

  • azmcp fileshares snapshot get - Get snapshot details
  • azmcp fileshares snapshot create - Create file share snapshot
  • azmcp fileshares snapshot update - Update snapshot properties
  • azmcp fileshares snapshot delete - Delete snapshot ⚠️ destructive

📊 Informational Commands (3 commands)

  • azmcp fileshares fileshare getlimits - Get regional limits and quotas
  • azmcp fileshares fileshare getprovisioningrecommendation - Get provisioning recommendations
  • azmcp fileshares fileshare getusagedata - Retrieve usage metrics and analytics

Architecture & Implementation

  • Service Pattern: IFileSharesService interface with FileSharesService implementation using Azure.ResourceManager APIs
  • Command Structure: Follows established patterns with BaseFileSharesCommand<T> base class
  • Options Classes: 15 strongly-typed options classes with proper validation
  • AOT Compatibility: Full JSON serialization context registration for native compilation
  • Error Handling: Comprehensive exception handling with contextual error messages
  • Testing: Complete unit test coverage + live test infrastructure (Bicep templates)

Key Files Added

tools/Azure.Mcp.Tools.FileShares/
├── src/
│   ├── Azure.Mcp.Tools.FileShares.csproj
│   ├── FileSharesSetup.cs
│   ├── FileSharesJsonContext.cs
│   ├── Commands/
│   │   ├── BaseFileSharesCommand.cs
│   │   ├── FileShare/ (5 commands)
│   │   ├── Snapshot/ (4 commands)
│   │   └── Informational/ (3 commands)
│   ├── Options/ (15 options classes)
│   ├── Services/
│   │   ├── IFileSharesService.cs
│   │   └── FileSharesService.cs
│   └── Models/ (8 data models)
├── tests/
│   ├── test-resources.bicep
│   ├── test-resources-post.ps1
│   ├── Azure.Mcp.Tools.FileShares.UnitTests/
│   └── Azure.Mcp.Tools.FileShares.LiveTests/
├── README.md
└── Commands.md

Test Infrastructure

  • Unit Tests: Comprehensive test coverage for all commands including:

    • Constructor validation
    • Input validation and binding
    • Deserialization validation
    • Error handling scenarios
    • Option registration and binding
  • Live Tests:

    • Bicep template (test-resources.bicep) deploys test infrastructure
    • Post-deployment script (test-resources-post.ps1) configures resources
    • E2E validation for all file share operations

Additional Context

This implementation follows the patterns established in KeyVault and Storage toolsets and adheres to all standards outlined in new-command.md:

✅ Uses primary constructors for dependency injection
✅ AOT-safe with complete JSON serialization context registration
✅ Sealed command classes with proper ToolMetadata
✅ Static option definitions in FileSharesOptionDefinitions
✅ Comprehensive error handling with contextual messages
✅ Complete documentation (README.md, Commands.md)
✅ Full test coverage with live test infrastructure
✅ Follows parameter naming standards (subscription, resourceGroup)
✅ Proper separation of concerns (Commands, Options, Services, Models)

GitHub issue number?

[ONBOARD] Add Support for Microsoft.FileShares Resource Provider to Azure MCP Server #1355

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 servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • 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 using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • 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 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 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

ankushbindlish2 and others added 5 commits January 6, 2026 12:27
* Add Azure File Shares toolset and documentation

Introduced the Azure File Shares toolset with 11 commands for managing file shares, snapshots, planning information, and private endpoint connections. Updated consolidated-tools.json, documentation, and changelogs to reflect new capabilities. Registered the new toolset in the solution and server startup. Added comprehensive command reference, implementation status, and supporting test projects.

* Refactor FileShares commands and models structure

Removed BaseFileSharesCommand and options classes, replaced command implementations with stubs inheriting from SubscriptionCommand. Updated FileShareListCommand to use new service and result model. Moved and renamed several model files to use schema-based naming. Deleted FileSharesJsonContext and related serialization attributes. This refactor prepares the codebase for a new command and model structure.

* Expand FileShares test resources and live tests

Enhanced the Bicep template to provision two file shares, two snapshots, a private endpoint, and related role assignments for more comprehensive testing. Updated the post-deployment script to output new resource details. Rewrote live tests to cover listing, retrieving, and snapshot operations for the new resource structure.

* Expand and improve unit tests for FileShares commands

Refactors and significantly expands unit tests for FileShareListCommand, FileShareGetLimitsCommand, FileShareGetProvisioningRecommendationCommand, and FileShareGetUsageDataCommand. Adds comprehensive coverage for command initialization, option binding, execution, error handling, and input validation, including tests for tenant ID, various parameter combinations, and service exception scenarios. Improves test clarity and reliability by using dependency injection, NSubstitute, and explicit assertions.

* Refactor test projects and improve test setup

Updated project references and package dependencies for both LiveTests and UnitTests projects. Consolidated and expanded global usings to reduce redundancy in test files. Added AssemblyAttributes.cs to UnitTests for environment variable cleanup and xUnit collection behavior. Refactored test classes to use new base classes and improved test coverage with additional assertions.

* Update test namespaces and add body sanitizer to FileShares tests

Replaces Azure.Mcp.Core.Tests references with Azure.Mcp.Tests in test files and updates global usings accordingly. Adds a BodyRegexSanitizer to FileSharesCommandTests to sanitize URLs in test recordings. Removes redundant XML doc comments from test methods and updates test class constructor to accept TestProxyFixture.

* Update FileShares test infra and improve test assertions

Refactored Bicep test resources to use explicit 'eastus' location and updated FileShare resources to use NFS protocol and new property schema. Enhanced test PowerShell script parameters for flexibility. Improved C# test assertions to check for non-null JSON value kinds and match expected resource names.

* Add template validation before test resource deployment

Introduces validation of deployment templates in New-TestResources.ps1 to catch errors before actual deployment. Improves error reporting and debugging output for failed validations. Also updates Deploy-TestResources.ps1 to pass the Force parameter explicitly.

* Update .gitignore and add VSCode MCP config

Added new file patterns to .gitignore for Azure.Mcp.Tools.FileShares and StorageSync directories. Introduced .vscode/mcp.json to configure a local Azure MCP server for VSCode.
Introduces the Azure FileShares module, including commands for creating, updating, deleting, and retrieving file shares and snapshots, as well as private endpoint connection management. Updates documentation, changelog, and solution/project files to register the new module. Removes obsolete commands and models, and adds new options and service logic to support the FileShares feature set.
Introduces new informational commands for file share limits, usage data, and provisioning recommendations, along with their supporting models and options. Refactors private endpoint connection commands to provide full CRUD support with improved option binding and result serialization. Enhances file share and snapshot commands to support tags and metadata via JSON, and updates FileSharesService to accept additional parameters for file share creation and update. Also adds new unit tests for the expanded command set.
Eliminated FileShare snapshot resources and related outputs from the Bicep template and test scripts. Updated FileShare resource properties for higher performance, changed service endpoint to 'Microsoft.Storage', set location to 'eastus', and adjusted private endpoint group ID. Cleaned up test output messaging to reflect these changes.
…options

Removed the PrivateEndpointConnectionListCommand and its options, merging its functionality into PrivateEndpointConnectionGetCommand, which now lists all connections if no connection name is provided. Updated FileSharesOptionDefinitions to add new file share options (media tier, redundancy, protocol, mount name, allowed subnets, tags, etc.) and adjusted create/update commands to support them. Updated tests and command registration accordingly. Also improved snapshot update options and fixed minor code style issues.
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

This pull request adds comprehensive support for the Microsoft.FileShares resource provider to the Azure MCP Server, introducing a complete toolset with 16 commands for managing Azure managed file shares, snapshots, and private endpoint connections.

Key Changes:

  • New FileShares toolset with 5 file share management commands (get, create, update, delete, check-name-availability)
  • 4 snapshot management commands (get, create, update, delete)
  • 3 private endpoint connection commands (get, update, delete)
  • 3 informational commands (limits, provisioning recommendations, usage data)
  • Comprehensive test infrastructure with unit tests, live tests, and Bicep templates
  • Integration with consolidated tools and server registration

Reviewed changes

Copilot reviewed 93 out of 93 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test-resources.bicep Bicep template for test infrastructure including VNet, file shares, and private endpoints
test-resources-post.ps1 Post-deployment script for test resource configuration
Unit test files (11 files) Basic command initialization tests for all commands
LiveTests/FileSharesCommandTests.cs Comprehensive live integration tests with CRUD operations
Services/FileSharesService.cs Service implementation using Azure Resource Manager SDK
Services/IFileSharesService.cs Service interface with 15 methods
Command files (11 files) Command implementations for all operations
Options files (11 files) Options classes for command parameters
Models files (9 files) Data models and DTOs for responses
Azure.Mcp.Tools.FileShares.csproj Project configuration with Azure.ResourceManager.FileShares package
FileSharesSetup.cs Area setup for DI and command registration
Program.cs Integration into server with FileSharesSetup registration
consolidated-tools.json Tool consolidation mappings for 4 tool groups
azmcp-commands.md Documentation for all 16 commands
README.md Updated service list with FileShares
CHANGELOG.md Release notes for FileShares module addition
Directory.Packages.props Azure.ResourceManager.FileShares package reference

ankushbindlish2 and others added 10 commits January 7, 2026 01:34
Refined Azure FileShares documentation and command references to match current implementation, including removal of list commands and update to private endpoint connection commands. Added dynamic code attributes in ServiceCollectionExtensions, streamlined deployment scripts, and deleted obsolete storagesync.txt.
Standardized command titles in FileShareCheckNameAvailabilityCommand, FileShareDeleteCommand, and SnapshotDeleteCommand to use 'File Share' instead of 'FileShare' or 'Snapshot'. Updated azmcp-commands.md to align command metadata and remove or correct operation property comments for accuracy and consistency.
Introduces assets.json to specify asset repository and tagging information for Azure.Mcp.Tools.FileShares.LiveTests. This file will be used to manage test assets and their metadata.
Introduced a new section for Azure FileShares in e2eTestPrompts.md, including test prompts for file share creation, deletion, retrieval, limits, name availability, private endpoint connections, provisioning recommendations, snapshots, updates, and usage. This expands coverage for Azure FileShares tools in end-to-end testing.
Deleted Commands.md, IMPLEMENTATION_STATUS.md, and IMPLEMENTATION_SUMMARY.md from Azure.Mcp.Tools.FileShares. These files contained technical reference, implementation status, and summary documentation for the FileShares toolset.
Deleted the README.md file for Azure.Mcp.Tools.FileShares, removing documentation for available commands, architecture, and contribution guidelines.
Adjusted unit tests to match updated command title strings, ensuring consistency with new naming conventions for file share and snapshot commands.
Added update and delete operations to mappedToolList for file shares and snapshots, and removed some list operations. Updated the description for snapshot management to reflect new capabilities.
Renamed 'fileshares_fileshare_checkname' to 'fileshares_fileshare_check-name-availability' in consolidated-tools.json to reflect the correct operation key.
Updated tool metadata for file share and snapshot commands to accurately reflect destructive and idempotent properties. Split informational commands into a dedicated subgroup in FileSharesSetup. Revised consolidated-tools.json to clarify tool descriptions, mapped tool lists, and metadata for Azure File Shares and related operations.
Corrected the Destructive and Idempotent flags for several azmcp fileshare and private endpoint connection commands in the documentation to accurately reflect their behavior.
Deleted all code, options, models, and tests related to FileShares private endpoint connection commands (get, update, delete). Updated documentation, changelog, and consolidated-tools.json to remove references to these commands. Informational commands are now registered directly under the fileshares group. Refactored FileSharesService to remove unsupported private endpoint connection methods and updated usage of Azure.ResourceManager.Resources. Added tenant parameter to informational commands for consistency.
ankushbindlish2 and others added 6 commits January 8, 2026 23:43
Replaces the update logic for file shares to use a new PatchFileShareAsync method, allowing partial updates without requiring all properties. Removes unused snapshot options and data schema files. Updates command IDs for consistency, adds copyright headers, and improves documentation and command metadata.
Reorders and restores the Azure.Mcp.Tools.FileShares project entries in AzureMcp.sln to maintain correct grouping and configuration. Also removes duplicate and obsolete project configuration and nesting entries to clean up the solution structure.
Replaced custom resource group extraction logic in FileShareInfo and FileShareSnapshotInfo with Azure.Core.ResourceIdentifier.Parse. This simplifies the code and leverages the Azure SDK for resource parsing.
Added PR labels, service labels, and service owners for /tools/Azure.Mcp.Tools.FileShares/ and /tools/Azure.Mcp.Tools.StorageSync/. Also made minor formatting adjustments to existing service owner comments.
Deleted descriptive metadata comments (e.g., Destructive, Idempotent, ReadOnly) from several azmcp fileshares command examples in the documentation for improved clarity and conciseness.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

3 participants