Repository navigation
[Compute] Add default subnet address prefixes when not specified - #1412
JaysonTaiMicrosoft wants to merge 18 commits into
Conversation
…twork-interface-name parameter.
…fix-vm-create-default-vnet-prefix
There was a problem hiding this comment.
🟡 Changes recommended
Network defaults can overwrite existing VNet address spaces and subnets, while direct secret interpolation into PowerShell risks credential corruption or unintended script interpretation.
4 open issues
What changed in this PR
This PR addresses #1338 by adding default network settings to the shared VM-creation orchestration used by CLI and PowerShell. It also removes explicit NIC naming in favor of {vm}VMNic.
Changes:
- Add default VNet and subnet address prefixes and a default subnet name.
- Remove the NIC-name parameter and update documentation, tests, benchmarks, and agent examples.
- Adjust test VM sizes and the SDK pin, and add a service-principal sign-in workflow.
| File | Description |
|---|---|
| wiki/01-getting-started/powershell-usage.md | Remove explicit NIC naming from the example. |
| tools/Help/Azclips.Help.Tool.Tests/Fixtures/cli-export/vm.json | Align exported help with automatic NIC naming. |
| tests/Scripts/PS/VMStop.ps1 | Remove the NIC-name argument. |
| tests/Scripts/PS/VMShow.ps1 | Remove the NIC-name argument. |
| tests/Scripts/PS/VMList.ps1 | Remove the NIC-name argument. |
| tests/Scripts/PS/VMDelete.ps1 | Remove the NIC-name argument. |
| tests/Scripts/PS/VMCreate.ps1 | Update NIC expectations and VM sizes. |
| tests/Scripts/CLI/VMStop.sh | Remove the NIC-name flag. |
| tests/Scripts/CLI/VMShow.sh | Remove the NIC-name flag. |
| tests/Scripts/CLI/VMList.sh | Remove the NIC-name flag. |
| tests/Scripts/CLI/VMGetInstanceView.sh | Remove the NIC-name flag. |
| tests/Scripts/CLI/VMDelete.sh | Remove the NIC-name flag. |
| tests/Scripts/CLI/VMCreate.sh | Update NIC expectations and VM sizes. |
| tests/Scenario.Tests/Scripts/vm-create.sh | Use automatic NIC naming. |
| tests/Scenario.Tests/Scripts/vm-create.ps1 | Use automatic NIC naming. |
| tests/Scenario.Tests/Scripts/vm-create-module.ps1 | Use automatic NIC naming. |
| tests/Scenario.Tests/Compute/VmLifecycleScenarioTests.cs | Update creation inputs and PowerShell VM size. |
| tests/Scenario.Tests/Compute/VmCreateScenarioTests.cs | Update creation inputs, sizes, and NIC assertions. |
| tests/Scenario.Tests/Compute/VmCreateOrchestrationTests.cs | Align orchestration assertions with generated NIC names. |
| tests/Scenario.Tests/Compute/FakeVmArmBackend.cs | Return the generated NIC reference. |
| tests/Cmdlets.Tests/NewVMCmdletTests.cs | Remove references to the deleted parameter. |
| tests/Cli.Tests/VmCreateTests.cs | Remove obsolete NIC-name metadata assertions. |
| tests/Benchmark/PS/VirtualMachineBenchmarks.cs | Remove explicit NIC naming from benchmarks. |
| tests/Benchmark/CLI/VirtualMachineBenchmarks.cs | Remove explicit NIC naming from benchmarks. |
| src/PS/Compute/help/New-AzVM.md | Update syntax, examples, and parameter documentation. |
| src/PS/Compute/Cmdlets/NewVMCmdlet.cs | Remove the NIC-name parameter and forwarding. |
| src/Extensions/Compute/ExtensionIndex.cs | Remove NIC-name metadata from both surfaces. |
| src/Extensions/Compute/Customization/NewVMProcessor_Orchestrator.cs | Generate NIC names as {vm}VMNic. |
| src/Extensions/Compute/Customization/NewNetworkInterfaceProcessor_Orchestrator.cs | Add subnet-name and address-prefix defaults. |
| src/CLI/Help/Docs/vm/create.md | Document automatic NIC naming and update examples. |
| global.json | Change the SDK pin to 10.0.400. |
| docs/pp-scenarios/scenario-2-vm-application.md | Remove NIC-name arguments from application examples. |
| Agent/eval/reference-cases.test.js | Update the reference VM command. |
| Agent/eval/cases/vm-create-short-flags.js | Remove the NIC-name argument requirement. |
| .github/workflows/bugbash006.yml | Add a manual PowerShell service-principal workflow. |
Review effort: Balanced
| // Match legacy `az vm create`: default to 10.0.0.0/16 and a 10.0.0.0/24 first subnet. | ||
| List<string> addressPrefixes = AddressPrefixes.Count == 0 ? ["10.0.0.0/16"] : AddressPrefixes; | ||
| List<List<string>> subnetAddressPrefixes = [.. SubnetAddressPrefixes]; | ||
| if (AddressPrefixes.Count == 0 && (subnetAddressPrefixes.Count == 0 || subnetAddressPrefixes[0].Count == 0)) |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical issues can overwrite existing VNet configuration during VM creation and execute unintended PowerShell through direct client-secret interpolation in the workflow.
5 open issues
Avoid applying creation defaults to existing VNets Keep AdminPassword optional in PowerShell metadata · New Remove NetworkInterfaceName from remaining PowerShell callers · New Use a confidential-capable default size for the CVM scenario · New Default the subnet prefix when only a VNet prefix is supplied
2 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The new VNet lookup exhausts recorded GET responses and breaks playback, while unresolved subnet-defaulting and PowerShell regressions cause provisioning, test, and smoke-script failures.
5 open issues
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The PowerShell metadata incorrectly requires AdminPassword, contradicting supported SSH-key-only authentication and breaking the existing test that asserts the password is optional.
4 open issues
2 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The PowerShell confidential-VM smoke test defaults to an incompatible VM size, and regression coverage is missing for new-VNet networking defaults and existing-VNet reuse.
2 open issues
2 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Supplying only a VNet prefix leaves the default subnet without an address range, the Confidential VM smoke test defaults to an unsupported SKU, and the new networking branches lack regression coverage.
2 open issues
1 resolved since last review
Review effort: Balanced
| if (AddressPrefixes.Count == 0) | ||
| { | ||
| addressPrefixes = ["10.0.0.0/16"]; | ||
| if (subnetAddressPrefixes.Count == 0) |



Related command
az vm create ...Description
Resolves #1338 by adding default subnet / address prefixes on vnet creation. Will not override settings of existing vnets settings that are found.
Remove
--network-interface-namenot a parameter that was originally supported. see https://learn.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest#az-vm-create for referenceTesting Guide
History Notes
[Compute] Add default subnet address prefixes when not specified
[Compute]
az vm create: Remove--network-interface-nameparam[Component Name]for customer-facing changes or{Component Name}for non-customer-facing changes, and does not end with trailing punctuation or spaces.