Skip to content

Fix Storage Tools Issues.#2674

Open
g2vinay wants to merge 1 commit into
microsoft:mainfrom
g2vinay:fix-storage-issues
Open

Fix Storage Tools Issues.#2674
g2vinay wants to merge 1 commit into
microsoft:mainfrom
g2vinay:fix-storage-issues

Conversation

@g2vinay
Copy link
Copy Markdown
Contributor

@g2vinay g2vinay commented May 19, 2026

No description provided.

…oolset

- ST-01: Fix NullReferenceException in GetTableEndpoint by changing parameter from string? to string and removing null-forgiving operator
- ST-03: Add Cold and Premium to AccessTier option description
- ST-05: Seal StorageService class per project convention
- ST-08: Resolve subscription display names to GUIDs in CreateStorageAccount; skip resolution when input is already a GUID
- ST-10: Update Sku option description to list all 14 valid SKUs including V2 variants

Tests: add ContainerCreateCommandTests.ExecuteAsync_HandlesStorageAccountNotFound
@g2vinay g2vinay marked this pull request as ready for review May 20, 2026 00:17
@g2vinay g2vinay requested a review from alzimmermsft as a code owner May 20, 2026 00:17
Copilot AI review requested due to automatic review settings May 20, 2026 00:17
@g2vinay g2vinay requested review from a team, jongio and xiangyan99 as code owners May 20, 2026 00:17
Copy link
Copy Markdown
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

Improves Azure Storage tool reliability and user-facing CLI help text by aligning storage account creation behavior with subscription name handling used elsewhere, and by documenting the full set of accepted SKU/access-tier values.

Changes:

  • Fix CreateStorageAccount to resolve subscription display names to subscription GUIDs before constructing the ARM resource ID.
  • Update --sku and --access-tier option descriptions to reflect the full set of supported values.
  • Add a unit test ensuring container create returns a 404-style response when the backing service reports NotFound.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.Storage/tests/Azure.Mcp.Tools.Storage.Tests/Blob/Container/ContainerCreateCommandTests.cs Adds a NotFound unit test for container creation.
tools/Azure.Mcp.Tools.Storage/src/Services/StorageService.cs Resolves subscription names to GUIDs for storage account creation; tightens table client helper signatures.
tools/Azure.Mcp.Tools.Storage/src/Options/StorageOptionDefinitions.cs Expands CLI option descriptions for SKU and access tier values.
tools/Azure.Mcp.Tools.Storage/src/Commands/Blob/Container/ContainerCreateCommand.cs Adds a clarifying comment for the result record.
servers/Azure.Mcp.Server/changelog-entries/1779221789527.yaml Adds a changelog entry describing the Storage tool fixes.
Comments suppressed due to low confidence (1)

tools/Azure.Mcp.Tools.Storage/src/Services/StorageService.cs:438

  • CreateTableServiceClient takes a subscription parameter but does not use it (verified within this method). Since the method is now private and only used internally, consider removing the unused parameter and updating the single call site to reduce confusion about what inputs influence the table endpoint/client creation.
    private async Task<TableServiceClient> CreateTableServiceClient(
        string account,
        string subscription,
        string? tenant = null,
        RetryPolicyOptions? retryPolicy = null,
        CancellationToken cancellationToken = default)

ILogger<StorageService> logger)
: BaseAzureResourceService(subscriptionService, tenantService), IStorageService
{
private readonly ISubscriptionService _subscriptionService = subscriptionService;
public static readonly Option<string> Sku = new($"--{SkuName}")
{
Description = "The storage account SKU. Valid values: Standard_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, Premium_LRS, Premium_ZRS, Standard_GZRS, Standard_RAGZRS.",
Description = "The storage account SKU. Valid values: Standard_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, " +
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.

This change is incorrect, instead we should be updating the tool description to indicate we only support StorageV2 accounts. The additional SKUs added here are for different account types.

https://learn.microsoft.com/rest/api/storagerp/srp_sku_types

return context.Response;
}

// Strongly-typed result record
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.

We don't need this

Comment on lines +103 to +107
// Resolve subscription display name to GUID (consistent with all other storage operations).
// Skip resolution when subscription is already a GUID to avoid an unnecessary round-trip.
var subscriptionId = _subscriptionService.IsSubscriptionId(subscription)
? subscription
: (await _subscriptionService.GetSubscription(subscription, tenant, retryPolicy, cancellationToken)).Data.SubscriptionId;
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.

Do we actually need to resolve to a GUID here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

3 participants