Skip to content

Conversation

@wchigit
Copy link
Contributor

@wchigit wchigit commented Feb 6, 2026

What does this PR do?

This PR updates tools in Deploy and Quota areas to meet the latest feature improvements from CodeToCloud.
Main features include:

  • Support deployment using Azure CLI+Bicep/Terraform
  • Support deployment to existing resources
  • Add Azure-specific IaC rules regarding code quality, configuration success rate and security
  • Update CI/CD pipeline generation user flow

[Any additional context, screenshots, or information that helps reviewers]

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
    • 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

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 PR updates the Deploy and Quota tool areas to align with newer CodeToCloud behaviors, expanding support for Az CLI + Bicep/Terraform deployment workflows (including deploy-only to existing resources), richer IaC rules, and updated pipeline guidance prompts.

Changes:

  • Extend Quota tooling to cover more providers/regions/SKUs (notably SQL) and refine Compute/PostgreSQL quota handling.
  • Rework Deploy plan/pipeline generation templates and option surfaces to support deploy-only / provision-only / provision-and-deploy flows and multiple IaC types.
  • Add/refresh IaC rule templates for additional Azure services and update docs/tests accordingly.

Reviewed changes

Copilot reviewed 74 out of 75 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.Quota/tests/Azure.Mcp.Tools.Quota.LiveTests/QuotaCommandTests.cs Add SQL provider to quota live test coverage
tools/Azure.Mcp.Tools.Quota/src/Services/Util/Usage/PostgreSQLUsageChecker.cs Add cores pre-check and SKU labeling for PostgreSQL quotas
tools/Azure.Mcp.Tools.Quota/src/Services/Util/Usage/ComputeUsageChecker.cs Change compute quota output to SKU-filtered availability list
tools/Azure.Mcp.Tools.Quota/src/Services/Util/AzureUsageChecker.cs Add SQL provider mapping and checker factory wiring
tools/Azure.Mcp.Tools.Quota/src/Services/Util/AzureRegionChecker.cs Add region checkers for SQL/MySQL/Cosmos/Compute
tools/Azure.Mcp.Tools.Quota/src/Azure.Mcp.Tools.Quota.csproj Add ARM SDK deps for SQL/MySQL/CosmosDB
tools/Azure.Mcp.Tools.Deploy/tests/Azure.Mcp.Tools.Deploy.UnitTests/TemplateServiceTests.cs Update template placeholder assertions
tools/Azure.Mcp.Tools.Deploy/tests/Azure.Mcp.Tools.Deploy.UnitTests/DeploymentPlanTemplateUtilV2Tests.cs Update plan template expectations for new flow/options
tools/Azure.Mcp.Tools.Deploy/tests/Azure.Mcp.Tools.Deploy.UnitTests/Commands/Plan/GetCommandTests.cs Update CLI args (--iac-options) and plan output expectations
tools/Azure.Mcp.Tools.Deploy/tests/Azure.Mcp.Tools.Deploy.UnitTests/Commands/Pipeline/GuidanceGetCommandTests.cs Replace pipeline guidance tests to match new prompts/options
tools/Azure.Mcp.Tools.Deploy/tests/Azure.Mcp.Tools.Deploy.UnitTests/Commands/Infrastructure/RulesGetCommandTests.cs Expand rules tests for more resources + terraform/azcli
tools/Azure.Mcp.Tools.Deploy/tests/Azure.Mcp.Tools.Deploy.LiveTests/DeployCommandTests.cs Update live tests for renamed options and pipeline args
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/summary-steps.md Replace numbered placeholder with “Final. Summary” step
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/sample-app-mermaid.md Add sample mermaid diagram (Container Apps)
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/sample-aks-mermaid.md Add sample mermaid diagram (AKS)
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/provision-info.md Add “Recommended Azure Resources” section template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/existing-resource-info.md Add “Existing Azure Resources” section template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/deployment-plan-base.md Swap goal/resources sections to new placeholders
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/containerization-steps.md Add containerization step template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/containerapp-steps.md Remove old Container App step template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/azcli-steps.md Remove old Az CLI steps template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/azcli-provision-steps.md Add Az CLI provisioning steps template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/azcli-deployment-steps.md Add Az CLI deployment steps template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/azcli-deploy-only-steps.md Add Az CLI deploy-only steps template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/aks-provision-steps.md Add AKS provisioning steps template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/aks-deployment-steps.md Add AKS deployment steps template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Plan/aks-deploy-only-steps.md Add AKS deploy-only steps template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Pipeline/pipeline-to-azure.md Add unified pipeline guidance template
tools/Azure.Mcp.Tools.Deploy/src/Templates/Pipeline/azcli-pipeline.md Remove old Az CLI pipeline guidance template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/terraform-rules.md Add terraform rule additions (dedupe, subscription id)
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/storage-rules.md Add tool-specific rules placeholder
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/postgresql-rules.md Add PostgreSQL rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/mysql-rules.md Add MySQL rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/key-vault-rules.md Add Key Vault rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/functionapp-tf-rules.md Add Function App Terraform rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/functionapp-rules.md Refactor Function App rules to tool-specific placeholder
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/functionapp-bicep-rules.md Add Function App Bicep rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/database-common-rules.md Add shared DB rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/cosmosdb-rules.md Add Cosmos DB rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/containerapp-tf-rules.md Add Container App Terraform rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/containerapp-rules.md Refactor Container App rules to tool-specific placeholder
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/containerapp-bicep-rules.md Add Container App Bicep rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/bicep-rules.md Add base bicep rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/base-iac-rules.md Add quota-first + region selection guidance
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/azcli-script-rules.md Add Az CLI scripting rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/azcli-rules.md Refactor to include placeholders for injected rules
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/appservice-tf-rules.md Add App Service Terraform rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/appservice-rules.md Refactor App Service rules to tool-specific placeholder
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/appservice-bicep-rules.md Add App Service Bicep rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/aks-tf-rules.md Add AKS Terraform rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/aks-rules.md Add AKS rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/aks-kv-integration-rules.md Add AKS Key Vault integration guidance
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/aks-cli-rules.md Add AKS Azure CLI rules template
tools/Azure.Mcp.Tools.Deploy/src/Templates/IaCRules/aks-bicep-rules.md Add AKS Bicep rules template
tools/Azure.Mcp.Tools.Deploy/src/Services/Util/PipelineGenerationUtil.cs Switch pipeline guidance generation to new template prompts
tools/Azure.Mcp.Tools.Deploy/src/Services/Util/IaCRulesTemplateUtil.cs Refactor IaC rules generation to tool/resource-specific templates
tools/Azure.Mcp.Tools.Deploy/src/Services/Util/DeploymentPlanTemplateUtil.cs Expand plan generation to source/deploy options and new templates
tools/Azure.Mcp.Tools.Deploy/src/Options/Plan/GetOptions.cs Add source/deploy/IaC/RG fields; inherit SubscriptionOptions
tools/Azure.Mcp.Tools.Deploy/src/Options/Pipeline/GuidanceGetOptions.cs Replace old azd/github details with new pipeline platform/options
tools/Azure.Mcp.Tools.Deploy/src/Options/DeployOptionDefinitions.cs Add/rename CLI option definitions for plan/pipeline/rules
tools/Azure.Mcp.Tools.Deploy/src/Models/Templates/PipelineTemplateParameters.cs Replace pipeline template parameters for new prompt layout
tools/Azure.Mcp.Tools.Deploy/src/Models/Templates/IaCRulesTemplateParameters.cs Remove unused template fields for IaC rules
tools/Azure.Mcp.Tools.Deploy/src/Models/Templates/DeploymentPlanTemplateParameters.cs Add Goal/ResourceInfo/SampleMermaid/SourceType/DeployOption
tools/Azure.Mcp.Tools.Deploy/src/Models/Templates/CLIExecutionStepsTemplateParameters.cs Add parameter model for Az CLI step templates
tools/Azure.Mcp.Tools.Deploy/src/Models/PipelineParameters.cs Add DeployOption/PipelinePlatform constants
tools/Azure.Mcp.Tools.Deploy/src/Models/IaCRulesParameters.cs Add SourceType + expand supported resource type constants
tools/Azure.Mcp.Tools.Deploy/src/Models/Consts.cs Add telemetry tags for deploy option/source type
tools/Azure.Mcp.Tools.Deploy/src/Commands/Plan/GetCommand.cs Wire new plan options + telemetry tags
tools/Azure.Mcp.Tools.Deploy/src/Commands/Pipeline/GuidanceGetCommand.cs Wire new pipeline options
tools/Azure.Mcp.Tools.Deploy/src/Commands/Infrastructure/RulesGetCommand.cs Normalize resource type parsing to lower-case
tools/Azure.Mcp.Tools.Deploy/src/Azure.Mcp.Tools.Deploy.csproj Minor formatting cleanup
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Update e2e prompts for deploy tools
servers/Azure.Mcp.Server/docs/azmcp-commands.md Update CLI docs for renamed pipeline/plan options

Comment on lines +4 to +15
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using Azure.Mcp.Tools.Deploy.Models.Templates;
using Azure.Mcp.Tools.Deploy.Options.Pipeline;
using Azure.Mcp.Tools.Deploy.Services.Templates;
using Azure.ResourceManager.Network.Models;
using Microsoft.AspNetCore.Http.HttpResults;
using OpenTelemetry;
using static System.Net.Mime.MediaTypeNames;
using static System.Runtime.InteropServices.JavaScript.JSType;
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The new using directives here appear unused (System.Collections.Generic, System.Net, System.Security.Cryptography, System.Text.RegularExpressions, Azure.ResourceManager.Network.Models, Microsoft.AspNetCore.Http.HttpResults, OpenTelemetry, and the two static usings). With TreatWarningsAsErrors enabled, unused usings will fail the build (CS8019). Remove the unused usings (or use them if intended).

Suggested change
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using Azure.Mcp.Tools.Deploy.Models.Templates;
using Azure.Mcp.Tools.Deploy.Options.Pipeline;
using Azure.Mcp.Tools.Deploy.Services.Templates;
using Azure.ResourceManager.Network.Models;
using Microsoft.AspNetCore.Http.HttpResults;
using OpenTelemetry;
using static System.Net.Mime.MediaTypeNames;
using static System.Runtime.InteropServices.JavaScript.JSType;
using Azure.Mcp.Tools.Deploy.Models.Templates;
using Azure.Mcp.Tools.Deploy.Options.Pipeline;
using Azure.Mcp.Tools.Deploy.Services.Templates;

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +9
using Microsoft.AspNetCore.DataProtection;
using ModelContextProtocol.Protocol;
using YamlDotNet.Core.Tokens;
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The added using directives Microsoft.AspNetCore.DataProtection, ModelContextProtocol.Protocol, and YamlDotNet.Core.Tokens are unused in this file. With TreatWarningsAsErrors, these will break the build. Remove them.

Suggested change
using Microsoft.AspNetCore.DataProtection;
using ModelContextProtocol.Protocol;
using YamlDotNet.Core.Tokens;

Copilot uses AI. Check for mistakes.
Comment on lines +214 to +222
var cliParameters = new CLIExecutionStepsTemplateParameters
{
IaCType = parameters.IacType.ToLowerInvariant(),
AzureComputeHost = parameters.AzureComputeHost,
TargetAppCommandTitle = parameters.TargetAppService,
DeploymentSteps = cliDeploymentSteps,
ACRDependencyCheck = parameters.TargetAppService.ToLowerInvariant() == "containerapp"
? "- Check Azure Container Registry:\n- login server: <>. Check with \'az acr show -o json\'."
: ""
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

TargetAppCommandTitle is set from parameters.TargetAppService (e.g., "ContainerApp"), but the templates use it in Azure CLI commands like az {{TargetAppCommandTitle}} show, which will be invalid unless the command group is lower-case (e.g., az containerapp show). Populate TargetAppCommandTitle with the correct az CLI command group string (likely parameters.TargetAppService.ToLowerInvariant()).

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +113
if (name.StartsWith("standardD", StringComparison.OrdinalIgnoreCase))
{
var skuParts = name[9..].Split("Family")[0];
var prefix = skuParts[..^2].ToLowerInvariant();
var suffix = skuParts[^2..];
return $"{name} (GeneralPurpose tier, e.g. Standard_D2{prefix}_{suffix})";
}

if (name.StartsWith("standardE", StringComparison.OrdinalIgnoreCase))
{
var skuParts = name[9..].Split("Family")[0];
var prefix = skuParts[..^2].ToLowerInvariant();
var suffix = skuParts[^2..];
return $"{name} (MemoryOptimized tier, e.g. Standard_E2{prefix}_{suffix})";
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

GetSkuDetail assumes the quota name format is long enough and contains at least 2 characters after removing the standardD/standardE prefix. If Azure returns an unexpected/shorter name (or a name without "Family"), slices like skuParts[..^2] / skuParts[^2..] can throw. Add defensive checks (length/format validation) before slicing, and fall back to returning name when the format doesn’t match.

Copilot uses AI. Check for mistakes.
azmcp deploy plan get --workspace-folder <workspace-folder> \
--project-name <project-name> \
--target-app-service <target-app-service> \
--provisioning-tool <provisioning-tool> \
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The azmcp deploy plan get docs were only updated to rename --azd-iac-options to --iac-options, but the tool now also supports/accepts --source-type, --deploy-option, and --resource-group-name (and subscription via SubscriptionOptions). Update this command snippet to include the new flags (and indicate which are required vs optional) so the docs match the actual CLI surface.

Suggested change
--provisioning-tool <provisioning-tool> \
--provisioning-tool <provisioning-tool> \
--source-type <source-type> \
[--deploy-option <deploy-option>] \
[--resource-group-name <resource-group-name>] \
[--subscription <subscription>] \

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +3
- - Use RBAC authentication.
- Assign role 'Key Vault Secrets Officer (b86a8fe4-44ce-4948-aee5-eccb2c155cd7)' to managed identity. Add dependencies to ensure role assignment is finished before application accesses secrets.
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

There’s an extra list marker in - - Use RBAC authentication. which will render oddly in markdown. Remove the duplicate - so it’s a single bullet.

Copilot uses AI. Check for mistakes.
Comment on lines +30 to 47
foreach (var item in valueElement.EnumerateArray())
{
if (item.TryGetProperty("name", out var nameElement) &&
nameElement.TryGetProperty("value", out var nameValue) &&
nameValue.GetStringSafe() == CoresMagicString)
{
var limit = item.TryGetProperty("limit", out var limitElement) ? limitElement.GetInt32() : 0;
var used = item.TryGetProperty("currentValue", out var usedElement) ? usedElement.GetInt32() : 0;

if (limit - used < MinimumCoresRequired)
{
Logger.LogWarning("Insufficient cores quota for PostgreSQL in location: {Location}", location);
return CreateEmptyQuotaInfo();
}

break;
}
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

This foreach loop implicitly filters its target sequence - consider filtering the sequence explicitly using '.Where(...)'.

Copilot uses AI. Check for mistakes.

private static string GenerateMySqlRules(IaCRulesTemplateParameters parameters)
{
var databaseCommonRules = TemplateService.LoadTemplate("IaCRules/database-common-rules");
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Local scope variable 'databaseCommonRules' shadows IaCRulesTemplateUtil.databaseCommonRules.

Suggested change
var databaseCommonRules = TemplateService.LoadTemplate("IaCRules/database-common-rules");

Copilot uses AI. Check for mistakes.
Comment on lines +86 to +94
var sampleMermaid = "";
if (targetAppService.ToLowerInvariant() == "aks")
{
sampleMermaid = TemplateService.LoadTemplate("Plan/sample-aks-mermaid");
}
else
{
sampleMermaid = TemplateService.LoadTemplate("Plan/sample-app-mermaid");
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.

Suggested change
var sampleMermaid = "";
if (targetAppService.ToLowerInvariant() == "aks")
{
sampleMermaid = TemplateService.LoadTemplate("Plan/sample-aks-mermaid");
}
else
{
sampleMermaid = TemplateService.LoadTemplate("Plan/sample-app-mermaid");
}
var sampleMermaid = targetAppService.ToLowerInvariant() == "aks"
? TemplateService.LoadTemplate("Plan/sample-aks-mermaid")
: TemplateService.LoadTemplate("Plan/sample-app-mermaid");

Copilot uses AI. Check for mistakes.
Comment on lines +247 to +258
if (parameters.DeployOption == DeployOption.DeployOnly)
{
return TemplateService.LoadTemplate("Plan/existing-resource-info");
}
else
{
return TemplateService.ProcessTemplate("Plan/provision-info", new Dictionary<string, string>
{
{ "ProjectName", parameters.ProjectName },
{ "AzureComputeHost", parameters.AzureComputeHost }
});
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Both branches of this 'if' statement return - consider using '?' to express intent better.

Suggested change
if (parameters.DeployOption == DeployOption.DeployOnly)
{
return TemplateService.LoadTemplate("Plan/existing-resource-info");
}
else
{
return TemplateService.ProcessTemplate("Plan/provision-info", new Dictionary<string, string>
{
{ "ProjectName", parameters.ProjectName },
{ "AzureComputeHost", parameters.AzureComputeHost }
});
}
return parameters.DeployOption == DeployOption.DeployOnly
? TemplateService.LoadTemplate("Plan/existing-resource-info")
: TemplateService.ProcessTemplate(
"Plan/provision-info",
new Dictionary<string, string>
{
{ "ProjectName", parameters.ProjectName },
{ "AzureComputeHost", parameters.AzureComputeHost }
});

Copilot uses AI. Check for mistakes.
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.

1 participant