Skip to content

Add compute VM and VMSS create/update commands with smart workload-based defaults#1705

Open
haagha wants to merge 25 commits intomicrosoft:mainfrom
haagha:haagha/vm-create
Open

Add compute VM and VMSS create/update commands with smart workload-based defaults#1705
haagha wants to merge 25 commits intomicrosoft:mainfrom
haagha:haagha/vm-create

Conversation

@haagha
Copy link
Contributor

@haagha haagha commented Feb 11, 2026

Summary

Addresses tools from #1452

This PR adds four new compute commands for creating and updating Azure Virtual Machines (VMs) and Virtual Machine Scale Sets (VMSS):

  • azmcp compute vm create - Create a new virtual machine
  • azmcp compute vm update - Update an existing virtual machine
  • azmcp compute vmss create - Create a new virtual machine scale set
  • azmcp compute vmss update - Update an existing virtual machine scale set

Command Parameters

compute vm create

Parameter Description
--vm-name Name of the VM (required)
--resource-group Resource group name (required)
--subscription Subscription ID or name (required)
--location Azure region
--vm-size VM size (e.g., Standard_D2s_v5)
--image OS image (e.g., Ubuntu2204, Win2022)
--admin-username Admin username
--admin-password Admin password (Windows or Linux without SSH)
--ssh-public-key SSH public key (Linux)
--workload Workload type for smart defaults (development, web, database, compute, memory, gpu, general)
--os-type OS type (Linux, Windows)
--virtual-network Existing VNet name
--subnet Existing subnet name
--public-ip-address Public IP address name
--network-security-group NSG name
--no-public-ip Create without public IP
--zone Availability zone
--os-disk-size-gb OS disk size in GB
--os-disk-type OS disk type (Premium_LRS, Standard_LRS)

compute vm update

Parameter Description
--vm-name Name of the VM (required)
--resource-group Resource group name (required)
--subscription Subscription ID or name (required)
--vm-size Resize VM
--tags Add/update tags (key=value,key2=value2)
--license-type Enable/disable Azure Hybrid Benefit
--boot-diagnostics Enable/disable boot diagnostics (true/false)
--user-data Update base64-encoded user data

compute vmss create

Parameter Description
--vmss-name Name of the VMSS (required)
--resource-group Resource group name (required)
--subscription Subscription ID or name (required)
--location Azure region
--vm-size VM size
--image OS image
--admin-username Admin username
--admin-password Admin password
--ssh-public-key SSH public key (Linux)
--workload Workload type for smart defaults
--os-type OS type (Linux, Windows)
--virtual-network Existing VNet name
--subnet Existing subnet name
--instance-count Initial number of instances
--upgrade-policy Upgrade policy (Automatic, Manual, Rolling)
--zone Availability zone
--os-disk-size-gb OS disk size in GB
--os-disk-type OS disk type

compute vmss update

Parameter Description
--vmss-name Name of the VMSS (required)
--resource-group Resource group name (required)
--subscription Subscription ID or name (required)
--vm-size Resize VMs
--capacity Scale out/in instance count
--upgrade-policy Change upgrade policy (Automatic, Manual, Rolling)
--overprovision Enable/disable overprovisioning
--enable-auto-os-upgrade Enable/disable automatic OS upgrades
--scale-in-policy Set scale-in policy (Default, OldestVM, NewestVM)
--tags Add/update tags (key=value,key2=value2)

Changes

Documentation

  • Updated azmcp-commands.md with full command documentation
  • Added 25+ test prompts to e2eTestPrompts.md
  • Updated consolidated-tools.json with tool groupings
  • Updated README.md with example prompts

Tests

  • Unit Tests: 98 tests covering all commands
  • Live Tests: 11 recorded tests (7 get + 4 update tests)

Changelog

  • Added changelog entry for the new commands

ToolDescriptionEvaluator Results

43 prompts tested for compute tools:

Metric Result
Top Choice Success 97.7% (42/43) ✅
Acceptable Confidence (≥0.4) 97.7% (42/43) ✅

Testing

  • ✅ All 98 unit tests pass
  • ✅ All 11 live tests recorded and pass in playback mode
  • ✅ Recordings pushed to Azure/azure-sdk-assets with tag Azure.Mcp.Tools.Compute.LiveTests_8c431d915f
  • ✅ ToolDescriptionEvaluator: 97.7% top choice success
  • ✅ Spelling check passes
  • ✅ Build succeeds

Haider Agha added 18 commits January 12, 2026 16:57
- Created assets.json for test asset configuration.
- Added Azure.Mcp.Tools.Compute.UnitTests project file.
- Implemented VmGetCommandTests to validate VM retrieval commands.
- Developed PowerShell script for post-deployment resource checks.
- Created Bicep template for resource provisioning in tests.
- Added JSON deployment template for resource management.
…nce ID and VMSS name; update JSON serialization and error handling for improved clarity and flexibility.
- Removed unused ListVmSizesAsync method from IComputeService.
- Updated ComputeCommandTests to reflect changes in VM and VMSS naming conventions.
- Adjusted test resources to deploy a single VM and VMSS with updated sizes.
- Added new unit tests for VMSS get operations, including validation and error handling.
- Updated changelog to document the addition of VMSS get operations.
…anitization; update assets.json with tag value.
- Updated the description for VmGetCommand to clarify the behavior based on parameters and streamline the information provided.
- Revised the description for VmssGetCommand to enhance clarity on the retrieval of VMSS and their instances, focusing on the details returned.
- Removed outdated specialized resource collection patterns from new-command.md to simplify documentation.
- Implemented VmCreateCommand to facilitate the creation of Azure VMs.
- Introduced VmCreateResult model to encapsulate the results of VM creation.
- Enhanced ComputeOptionDefinitions with new options for VM creation, including size, image, and workload.
- Created VmCreateOptions class to manage input parameters for VM creation.
- Updated ComputeService to handle VM creation logic, including network and security group setup.
- Added workload configurations to suggest optimal VM sizes based on workload type.
- Implemented unit tests for VmCreateCommand to ensure correct behavior and validation of inputs.
- Removed SSH key auto-discovery from ~/.ssh/ (problematic for remote MCP servers)
- Require explicit --ssh-public-key or --admin-password for Linux VMs
- Updated tool description with clear instructions for SSH key workflow
- Added helpful validation error message guiding users to read SSH public key first
- Add VmUpdateCommand for updating VM properties (size, tags, license type, boot diagnostics, user data)
- Add VmssCreateCommand for creating VMSS with smart workload defaults
- Add VmssUpdateCommand for updating VMSS properties (capacity, upgrade policy, overprovision, auto-os-upgrade, scale-in-policy, tags)
- Add corresponding Options, Result models, and service implementations
- Register new commands in ComputeSetup and JSON serialization context
Copilot AI review requested due to automatic review settings February 11, 2026 19:55
@haagha haagha requested review from a team and g2vinay as code owners February 11, 2026 19:55
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 VM and VMSS creation and update capabilities to the Azure MCP Compute tool. The implementation introduces four new commands with smart workload-based defaults that automatically suggest appropriate VM sizes and configurations based on workload type (development, web, database, compute, memory, gpu, general).

Changes:

  • Added 4 new commands: compute vm create, compute vm update, compute vmss create, and compute vmss update
  • Implemented workload-based VM sizing with 7 predefined workload profiles
  • Added comprehensive unit tests (98 tests) and live tests (4 new tests)
  • Updated documentation with detailed command examples and parameter descriptions

Reviewed changes

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

Show a summary per file
File Description
ComputeService.cs Core implementation of VM/VMSS create/update operations with network resource auto-creation
VmCreateCommand.cs, VmUpdateCommand.cs Command handlers for VM lifecycle operations
VmssCreateCommand.cs, VmssUpdateCommand.cs Command handlers for VMSS lifecycle operations
IComputeService.cs Interface definitions for new operations
ComputeOptionDefinitions.cs Option definitions for all new parameters
VmCreateCommandTests.cs, VmUpdateCommandTests.cs Unit tests for VM commands (46 tests total)
VmssCreateCommandTests.cs, VmssUpdateCommandTests.cs Unit tests for VMSS commands (52 tests total)
ComputeCommandTests.cs Live/recorded tests for update operations
azmcp-commands.md Complete command documentation with examples
e2eTestPrompts.md Test prompts for end-to-end validation
consolidated-tools.json Tool grouping definitions
CODEOWNERS Code ownership assignments (with duplicate entry)

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