Skip to content

feat(compute): unified VM/VMSS create with discovery tools and VMSS Flex default#2654

Open
deankroker wants to merge 5 commits into
mainfrom
feat/compute-vm-discovery-tools
Open

feat(compute): unified VM/VMSS create with discovery tools and VMSS Flex default#2654
deankroker wants to merge 5 commits into
mainfrom
feat/compute-vm-discovery-tools

Conversation

@deankroker
Copy link
Copy Markdown
Member

@deankroker deankroker commented May 18, 2026

TL;DR

Adds four read-only Azure discovery tools and makes VMSS Flex the default shape for a new compute create command. Purely additive — every existing compute vm and compute vmss invocation works unchanged.

New commands 5 (compute create + 4 discovery aliases at the compute root)
Modified commands compute vmss create gains network parity flags
Breaking changes None
Tests New unit tests across all four discovery commands and the unified create; 2 live-gated smoke tests

VMSS Flex = Virtual Machine Scale Set in Flexible orchestration mode — manages individual VMs as a group, supports availability-zone spread, and scales from 1 to N without rebuild.

Why

Agents asked to "create a VM" today guess SKUs, images, quotas, and regions before calling create — and they pick a single VM when the user almost always wants something that can scale. This PR adds the discovery tools that let the agent verify before committing, and shifts the default so VMSS Flex is the recommended path while single VM remains an explicit fallback.

What changed

Commit 1 — feat(compute): add guided VM/VMSS create discovery tools

Four new read-only discovery tools under compute vm. All use the Azure SDK directly (no az CLI subprocess), so they inherit auth, RBAC, and retry behavior from the MCP host:

  • list-skus — VM sizes available in a region, with vCPU / memory / AZ / AcceleratedNetworking filters
  • list-images — marketplace images by alias or publisher/offer/sku
  • check-quota — current vs limit on the SKU family the caller is about to deploy into
  • recommend-region — region scoring with workload-hint, geography, and AZ requirements

These are intended as validation gates immediately before a create call.

Commit 2 — feat(compute): reframe VMSS Flex as the default + unified compute create

  • New compute create top-level command. Defaults to VMSS Flex, 2 instances, AZ-spread. --single-instance falls back to a single VM.
  • Discovery aliases at the root. The four tools from Commit 1 are also registered directly under compute so agents don't have to descend into vm/.
  • Network parity for compute vmss create. Adds --public-ip-address, --network-security-group, --no-public-ip, and --source-address-prefix so picking the recommended path no longer silently downgrades networking.
  • The same four discovery tools gain four enrichments for the guided flow:
    • list-skus surfaces vmScaleSetsSupported per SKU
    • list-images adds --include-shared-gallery for Compute Gallery image refs
    • check-quota surfaces VMSS-relevant dimensions (virtualMachineScaleSets, lowPriorityCores, availabilitySets)
    • recommend-region weighs AZ-rich regions more heavily on scale / HA / production / vmss hints

Customer experience

Ask the agent for a VM → discovery tools confirm a SKU exists in the region with quota headroom and scale-set support, in an AZ-rich region → compute create returns a Flex scale set, 2 instances, AZ-spread, with public IP / NSG support (not just defaults). Only need one box? --single-instance. Need fifty next quarter? Same resource, no rebuild.

Sample agent flow

user:  give me a VM in westus2 for a web app
agent → compute recommend-region    --workload web
agent → compute list-skus westus2   --min-vcpu 2 --vmss-supported
agent → compute check-quota westus2 --sku Standard_D2s_v5
agent → compute create              --location westus2 --size Standard_D2s_v5
        → VMSS Flex, 2 instances, AZ-spread, public IP + NSG

Test plan

  • Unit tests for all four discovery commands (VmSkuListCommandTests, VmImageListCommandTests, VmQuotaCheckCommandTests, VmRegionRecommendCommandTests), including the new --include-shared-gallery flag, VMSS quota dimensions, and AZ-weighting heuristic
  • Unit tests for UnifiedCreateCommand covering both the VMSS Flex default and the --single-instance fallback
  • Unit tests for the four new VMSS network options
  • Live test smoke (gated behind opt-in env var; not run in this PR — invocations covered by Should_create_with_unified_create_defaults_to_vmss_flex and Should_create_with_unified_create_single_instance_falls_back_to_vm in Azure.Mcp.Tools.Compute.Tests/ComputeCommandTests.cs lines 1509–1584)
  • MCP client smoke — ComputeSetupTests in Azure.Mcp.Tools.Compute.Tests/ComputeSetupTests.cs asserts that:
    • compute create registers at the root
    • the four discovery aliases (list-skus, list-images, check-quota, recommend-region) resolve directly under compute and share class instances with their compute vm counterparts (stable CommandMetadata.Id GUIDs)
    • the vm / vmss / disk subgroups still resolve
    • the group description leads with the VMSS Flex recommendation

Copilot AI review requested due to automatic review settings May 18, 2026 21:19
@deankroker deankroker requested review from a team and g2vinay as code owners May 18, 2026 21:19
@deankroker deankroker force-pushed the feat/compute-vm-discovery-tools branch from 2aa4d75 to 2129264 Compare May 18, 2026 21:23
@deankroker
Copy link
Copy Markdown
Member Author

@microsoft-github-policy-service agree company="Microsoft"

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

This PR reframes the Azure MCP Compute tool to support a guided VM/VMSS create flow: it adds read-only discovery commands (SKUs, images, quota, region recommendations) and introduces a unified compute create entry point that defaults to VMSS Flex with an explicit --single-instance fallback to a standalone VM.

Changes:

  • Added four discovery commands (list-skus, list-images, check-quota, recommend-region) and corresponding models/options, plus source-generated JSON coverage and unit tests.
  • Introduced unified compute create command that dispatches to VMSS Flex by default or to VM create when --single-instance is set (with updated live tests).
  • Added VMSS create networking parity options (--public-ip-address, --network-security-group, --no-public-ip, --source-address-prefix) and implemented VMSS NIC/NSG/public-IP-config wiring in ComputeService.

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.

Reviewed changes

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

Show a summary per file
File Description
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.UnitTests/Vmss/VmssCreateCommandTests.cs Adds unit tests to validate new VMSS networking options are passed through to the service.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.UnitTests/Vm/VmSkuListCommandTests.cs New unit tests for SKU discovery command, including vmScaleSetsSupported serialization.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.UnitTests/Vm/VmRegionRecommendCommandTests.cs New unit tests for region recommendation command and AZ-weighting ordering behavior.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.UnitTests/Vm/VmQuotaCheckCommandTests.cs New unit tests for quota discovery command, including VMSS-related quota dimensions.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.UnitTests/Vm/VmImageListCommandTests.cs New unit tests for image discovery command, including shared gallery enumeration flag.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.UnitTests/UnifiedCreateCommandTests.cs New unit tests validating unified create dispatch (VMSS default vs --single-instance) and validation rules.
tools/Azure.Mcp.Tools.Compute/tests/Azure.Mcp.Tools.Compute.LiveTests/ComputeCommandTests.cs Adds live smoke tests for compute_create default and single-instance modes.
tools/Azure.Mcp.Tools.Compute/src/Services/IComputeService.cs Extends service contract with discovery APIs and new VMSS networking parameters.
tools/Azure.Mcp.Tools.Compute/src/Services/ComputeService.cs Implements discovery operations, retail price lookup via named HttpClient, region scoring, and VMSS networking parity.
tools/Azure.Mcp.Tools.Compute/src/Options/Vmss/VmssCreateOptions.cs Adds VMSS create option properties for public IP/NSG/no-public-ip/source prefix.
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmSkuListOptions.cs New options type for SKU discovery command.
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmRegionRecommendOptions.cs New options type for region recommendation command.
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmQuotaCheckOptions.cs New options type for quota discovery command.
tools/Azure.Mcp.Tools.Compute/src/Options/Vm/VmImageListOptions.cs New options type for image discovery command (including shared gallery flag).
tools/Azure.Mcp.Tools.Compute/src/Options/UnifiedCreateOptions.cs New superset options surface for unified create (VMSS-first schema + SingleInstance).
tools/Azure.Mcp.Tools.Compute/src/Options/ComputeOptionDefinitions.cs Adds CLI options for discovery commands and unified create; updates option descriptions for VM/VMSS language.
tools/Azure.Mcp.Tools.Compute/src/Models/VmSkuInfo.cs New model for SKU discovery results (capabilities + optional pricing + VMSS support).
tools/Azure.Mcp.Tools.Compute/src/Models/VmRegionRecommendation.cs New model for ranked region recommendations with rationale.
tools/Azure.Mcp.Tools.Compute/src/Models/VmQuotaInfo.cs New model for quota lines including derived availability/percent/status fields.
tools/Azure.Mcp.Tools.Compute/src/Models/VmImageInfo.cs New model for alias/marketplace/shared-gallery image candidates.
tools/Azure.Mcp.Tools.Compute/src/ComputeSetup.cs Registers new commands, adds named HttpClient, and exposes discovery commands at both compute and compute vm.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vmss/VmssCreateCommand.cs Wires new VMSS networking options into command binding and service call.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmSkuListCommand.cs Implements list-skus discovery command.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmRegionRecommendCommand.cs Implements recommend-region discovery command.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmQuotaCheckCommand.cs Implements check-quota discovery command.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmImageListCommand.cs Implements list-images discovery command.
tools/Azure.Mcp.Tools.Compute/src/Commands/Vm/VmCreateCommand.cs Updates VM create command description to position it as a non-scalable fallback.
tools/Azure.Mcp.Tools.Compute/src/Commands/UnifiedCreateCommand.cs Adds unified compute create command with validation and dispatch to VMSS or VM create.
tools/Azure.Mcp.Tools.Compute/src/Commands/ComputeJsonContext.cs Extends source-generated JSON context for new commands/results/models.
servers/Azure.Mcp.Server/changelog-entries/azure-compute-team-guided-vm-create-tools.yml Adds changelog entry for the new guided-create discovery tools.

Comment thread tools/Azure.Mcp.Tools.Compute/src/Services/ComputeService.cs
deankroker and others added 3 commits May 18, 2026 15:06
Adds four read-only compute commands that let agents present real choices
before invoking compute_vm_create or compute_vmss_create:

  - vm list-skus         filter the SKU catalog by region, vCPU, memory,
                         family prefix; optional retail pricing augmentation
  - vm list-images       resolve a marketplace alias or publisher/offer/sku
                         to a current URN
  - vm check-quota       report current vCPU usage vs subscription limit per
                         family, with optional requested-vCPU headroom check
  - vm recommend-region  rank regions for a workload hint, with optional
                         geography filter and AZ-required constraint

These were previously gaps that forced agents to either guess values or
fall back to az CLI shell-outs. The Azure Compute skill in
GitHub-Copilot-for-Azure consumes them as its Step 4 validation gates.

Includes unit tests for each command and a single shared Features Added
changelog entry. Pricing in list-skus uses the unauthenticated Azure
Retail Prices API; all four commands inherit standard ComputeService
RBAC and retry policy plumbing.
Pushes VMSS Flex as the recommended default for new compute and treats a
single standalone VM as the fallback for non-scalable workloads. Existing
`compute vm …` and `compute vmss …` commands keep working unchanged.

- Reframe descriptions: ComputeSetup root group, VM create, VMSS create,
  and shared option text now lead with VMSS Flex; anti-funneling lines
  are removed.
- New top-level `compute create` unified entry point that dispatches to
  VMSS Flex by default and falls back to a single VM with --single-instance.
- Register list-skus / list-images / check-quota / recommend-region under
  the root `compute` group as discovery aliases (same class instances —
  no new IDs).
- Reach VMSS create network parity with VM create: --public-ip-address,
  --network-security-group, --no-public-ip, --source-address-prefix.
- Discovery enrichments to power the unified guided flow:
  * VmSkuInfo gains VMScaleSetsSupported (so the create flow can filter
    out SKUs that can't back a Flex scale set).
  * list-images gains --include-shared-gallery for Compute Gallery image
    enumeration with their resource IDs.
  * check-quota surfaces VMSS dimensions: scale set count, low-priority
    cores, and availability set count.
  * recommend-region weights AZ-rich regions higher when the workload
    hint mentions scale / HA / production / vmss and AZs are required.
- Unit tests for every new behavior plus two live-test smoke cases for
  `compute_create` (vmss-flex default and single-vm fallback).

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
- Clarify tool-name references in Copilot-flagged doc strings (ComputeService,
  ComputeOptionDefinitions) and a misleading test comment (VmImageListCommandTests).
- Hand-apply dotnet format whitespace fixes in ComputeService.cs to satisfy
  IDE0011/csharp_prefer_braces — split single-line `if (...) stmt;` patterns
  across vCPU/memory/disk capability parsing, retail-prices fetch, image-alias
  enumeration, marketplace versions, and shared-gallery enumeration.
- Fix xUnit1051 analyzer errors in UnifiedCreateCommandTests by replacing
  CancellationToken positional defaults with TestContext.Current.CancellationToken
  for responsive test cancellation.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@deankroker deankroker force-pushed the feat/compute-vm-discovery-tools branch from 0dd627f to 61ea784 Compare May 18, 2026 22:06
deankroker and others added 2 commits May 18, 2026 15:21
…overy aliases

MCP-surface smoke coverage for the area registration: verifies that
the new top-level `compute create` (UnifiedCreateCommand) and the four
discovery aliases (list-skus, list-images, check-quota, recommend-region)
are reachable directly under the `compute` root group; that the
back-compat `vm`/`vmss`/`disk` subgroups still resolve; that the discovery
aliases share class instances with their `vm/` subgroup counterparts (so
CommandMetadata.Id GUIDs stay stable and MCP clients don't see two
distinct tools for the same operation); and that the group description
still leads with the VMSS Flex recommendation.

Modeled on ServiceBusSetupTests. Closes the "MCP client smoke" gate from
the PR test plan — exercises the wiring without requiring a running MCP
server or the pinned 10.0.201 SDK locally.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
dotnet format flagged three single-line if-statements in
RecommendVmRegionsAsync where the body sat on the same line as the
condition. Break each body onto its own line so the repo's source
analysis gate passes.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
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.

2 participants