Skip to content

[Compute] Add default subnet address prefixes when not specified - #1412

Open
JaysonTaiMicrosoft wants to merge 18 commits into
mainfrom
jaysontaimicrosoft-fix-vm-create-default-vnet-prefix
Open

JaysonTaiMicrosoft wants to merge 18 commits into
mainfrom
jaysontaimicrosoft-fix-vm-create-default-vnet-prefix

Conversation

@JaysonTaiMicrosoft

@JaysonTaiMicrosoft JaysonTaiMicrosoft commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

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-name not a parameter that was originally supported. see https://learn.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest#az-vm-create for reference

Testing Guide

History Notes

[Compute] Add default subnet address prefixes when not specified
[Compute] az vm create: Remove --network-interface-name param


  • The PR title starts with [Component Name] for customer-facing changes or {Component Name} for non-customer-facing changes, and does not end with trailing punctuation or spaces.
  • Customer-facing changes include a useful release note in the PR title or the History Notes section.
  • I added or updated tests for behavior changes.
  • I updated documentation when behavior, setup, support, or security guidance changed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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

Comment thread .github/workflows/bugbash006.yml Resolved
// 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))
Comment thread tests/Scripts/CLI/VMCreate.sh Resolved
Copilot AI balanced review requested due to automatic review settings November 12, 2026 01:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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
2 resolved since last review

Review effort: Balanced

Comment thread src/PS/Compute/Cmdlets/NewVMCmdlet.cs Resolved
Comment thread tests/Scripts/PS/VMCreate.ps1 Resolved
Copilot AI balanced review requested due to automatic review settings November 12, 2026 01:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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

Copilot AI balanced review requested due to automatic review settings November 12, 2026 01:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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

Copilot AI balanced review requested due to automatic review settings November 12, 2026 02:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 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

Copilot AI balanced review requested due to automatic review settings November 12, 2026 02:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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

Comment on lines +158 to +161
if (AddressPrefixes.Count == 0)
{
addressPrefixes = ["10.0.0.0/16"];
if (subnetAddressPrefixes.Count == 0)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[B012][CLI/PS] Documented VM creation examples fail when creating the supporting VNet

2 participants