Skip to content

[Network] Regenerate Network extension and add subnet and security rule commands - #1489

Draft
JunKai-v wants to merge 2 commits into
Azure:mainfrom
JunKai-v:test/network-module-regeneration
Draft

JunKai-v wants to merge 2 commits into
Azure:mainfrom
JunKai-v:test/network-module-regeneration

Conversation

@JunKai-v

@JunKai-v JunKai-v commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Related command

  • CLI: az network vnet, az network vnet subnet, az network nsg, az network nsg rule, az network public-ip, az network nic
  • PowerShell: Az.Network (*-AzVirtualNetwork, *-AzVirtualNetworkSubnet, *-AzNetworkSecurityGroup, *-AzNetworkSecurityRule, *-AzPublicIpAddress, *-AzNetworkInterface)

Description

This PR regenerates the Network extension from TypeSpec at api-version 2026-03-01 and rebuilds its custom logic on top of the new generated code.

What changed:

  • Generated code: src/Extensions/Network/Models and Processors are regenerated. All hand-written logic is in Customization/.
  • Customizations: the old CreateOrUpdate*_Customization and ListAll*_Orchestrator files are replaced with per-command customizations (vnet, subnet, NSG, security rule, public IP, NIC create/update/list) and shared helpers (resource ID resolver, tags parser, resource group location lookup, singular/plural list mapping).
  • New commands: az network vnet subnet update / Set-AzVirtualNetworkSubnet, and az network nsg rule create|update|show|list|delete / New|Set|Get|Remove-AzNetworkSecurityRule.
  • PowerShell: cmdlets are grouped into one file per resource with a shared NetworkCmdletBase.
  • Help: new and updated CLI help (src/CLI/Help/Docs/network) and PowerShell help (src/PS/Network/help).
  • Specs: OpenSpec behavior specs and test specs for the 6 Network resources under openspec/specs/network-*.
  • Tests: the fake-backend tests and the Network Cli.Tests parameter tests are replaced with 23 recorded scenario tests under tests/Scenario.Tests/Network, replayed on both CLI and PowerShell.
  • Bug fix: nsg rule update sent priority: 0 when --priority / -Priority was not given, and Azure rejected the request (SecurityRuleInvalidPriority). Update now binds priority to a nullable value and keeps the existing priority when it is not given.

Notes:

  • The recording subscription has no edge-zone access and no AllowDropUnecryptedVnet feature. These tests check the sent request body and then expect the service errors UnsupportedEdgeZone and CannotUseDropUnencryptedForVnet.
  • Known issue: 3 Compute scenario tests (VmLifecycleScenarioTests.CreateListShowStopDeallocateStartDeleteVirtualMachine and 2 tests in VMNetworkScenarioTests) fail in playback, because their recordings hold Network calls at the old api-version. They must be re-recorded before this PR leaves draft.

Testing Guide

  • dotnet build azclips.slnx: passed (62 projects, 0 errors)
  • dotnet test tests\Scenario.Tests\Scenario.Tests.csproj --filter "FullyQualifiedName~VirtualNetworkScenarioTests|FullyQualifiedName~SubnetScenarioTests|FullyQualifiedName~NetworkSecurityGroupScenarioTests|FullyQualifiedName~SecurityRuleScenarioTests|FullyQualifiedName~PublicIpScenarioTests|FullyQualifiedName~NetworkInterfaceScenarioTests|FullyQualifiedName~NetworkInterfaceEdgeZoneScenarioTests": passed (25/25, playback)
  • dotnet test tests\Scenario.Tests\Scenario.Tests.csproj --filter "FullyQualifiedName~Scenario.Tests.Vm|FullyQualifiedName~Scenario.Tests.VM": failed (112 passed, 3 failed; see known issue above)
  • python devops/scripts/ci/scan_recordings.py <23 new Network recordings>: passed (no secrets found)
  • openspec validate --specs --strict: passed for all 12 network-* specs

History Notes

[Network] az network vnet subnet update: Add command to update a subnet
[Network] az network nsg rule: Add create, update, show, list and delete commands
[Network] Set-AzVirtualNetworkSubnet: Add cmdlet to update a subnet
[Network] New-AzNetworkSecurityRule, Set-AzNetworkSecurityRule, Get-AzNetworkSecurityRule, Remove-AzNetworkSecurityRule: Add security rule cmdlets
[Network] Regenerate Network commands at api-version 2026-03-01


  • 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.

…le commands

Regenerate the Network extension from TypeSpec at api-version 2026-03-01, rewrite customizations, add subnet update and nsg rule commands on CLI and PowerShell, refresh help, add OpenSpec specs, and replace fake-backend tests with recorded scenario tests.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
5 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

1 participant