Add compute VM and VMSS create/update commands with smart workload-based defaults#1705
Add compute VM and VMSS create/update commands with smart workload-based defaults#1705haagha wants to merge 26 commits intomicrosoft:mainfrom
Conversation
…up, VmName, and VmssName
- 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.
…get-operations
- 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.
…ements and SSH key discovery
- 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
…create/update commands
There was a problem hiding this comment.
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, andcompute 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) |
…new examples and clearer instructions
…ermination; add Network Contributor role for VM create tests
…ove obsolete vmcreate.md file
# Conflicts: # eng/scripts/Deploy-TestResources.ps1
|
|
||
| | Tool Name | Test Prompt | | ||
| |:----------|:----------| | ||
| | compute_vm_create | Create a new Linux VM named <vm-name> in resource group <resource-group-name> | |
There was a problem hiding this comment.
Ensure, these prompts invoke the target tool.
|
|
||
| public override string Description => | ||
| """ | ||
| Create an Azure Virtual Machine with smart defaults based on workload requirements. |
There was a problem hiding this comment.
this description is too long.
Restrict to minimal required description and avoid mentioning about required options here, they are indicated in options definition as part of schema.
And ensure the Tool description evaulator scores high around 0.6+ for mostly all prompts. and share the results of the tool description evaluator as well.
|
|
||
| public override string Description => | ||
| """ | ||
| Update, modify, or change an existing Azure Virtual Machine (VM) configuration. |
|
|
||
| public override string Description => | ||
| """ | ||
| Create an Azure Virtual Machine Scale Set (VMSS) with smart defaults based on workload requirements. |
|
|
||
| public override string Description => | ||
| """ | ||
| Update, modify, scale, or change an existing Azure Virtual Machine Scale Set (VMSS) configuration. |
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 machineazmcp compute vm update- Update an existing virtual machineazmcp compute vmss create- Create a new virtual machine scale setazmcp compute vmss update- Update an existing virtual machine scale setCommand Parameters
compute vm create--vm-name--resource-group--subscription--location--vm-size--image--admin-username--admin-password--ssh-public-key--workload--os-type--virtual-network--subnet--public-ip-address--network-security-group--no-public-ip--zone--os-disk-size-gb--os-disk-typecompute vm update--vm-name--resource-group--subscription--vm-size--tags--license-type--boot-diagnostics--user-datacompute vmss create--vmss-name--resource-group--subscription--location--vm-size--image--admin-username--admin-password--ssh-public-key--workload--os-type--virtual-network--subnet--instance-count--upgrade-policy--zone--os-disk-size-gb--os-disk-typecompute vmss update--vmss-name--resource-group--subscription--vm-size--capacity--upgrade-policy--overprovision--enable-auto-os-upgrade--scale-in-policy--tagsChanges
Documentation
azmcp-commands.mdwith full command documentatione2eTestPrompts.mdconsolidated-tools.jsonwith tool groupingsREADME.mdwith example promptsTests
Changelog
ToolDescriptionEvaluator Results
43 prompts tested for compute tools:
Testing
Azure/azure-sdk-assetswith tagAzure.Mcp.Tools.Compute.LiveTests_8c431d915f