Skip to content

[Automated Tracing] Enable support for vnet peering and multiple interfaces - #603

Merged
Adam Rudell (arudell) merged 5 commits into
mainfrom
enable-support-for-vnet-peering-tracing
Jul 28, 2026
Merged

[Automated Tracing] Enable support for vnet peering and multiple interfaces#603
Adam Rudell (arudell) merged 5 commits into
mainfrom
enable-support-for-vnet-peering-tracing

Conversation

@arudell

@arudell Adam Rudell (arudell) commented Jul 14, 2026

Copy link
Copy Markdown
Member

Description

This pull request updates the Enable-SdnNetworkInterfaceTrace function to support enabling network tracing for multiple network interfaces at once, and improves the logic for mapping virtual gateways, including peered virtual networks. It also enhances the documentation and parameter validation to reflect these new capabilities.

Enhancements to multi-interface support:

  • Updated the NetworkInterface parameter to accept an array of objects, allowing tracing to be enabled for one or more interfaces simultaneously. The parameter validation logic now checks each provided object for the correct resource type. (F7a09d14L2358R2376)
  • Refactored the function logic to iterate over each provided network interface, ensuring all relevant operations (e.g., subnet association, VFP port lookup, public IP resolution) are performed per interface. [1] [2]

Improvements to virtual gateway mapping:

  • Enhanced the logic for identifying associated virtual gateways, including resolving gateways from peered virtual networks when useRemoteGateways is set. The function now builds a list of all relevant gateways, rather than stopping at the first match.

Documentation and usability:

  • Updated the function's help documentation to clarify support for multiple interfaces and added several usage examples demonstrating both array and pipeline input. (F7a09d14L2358R2376)

No significant changes were made to Test-SdnProviderNetwork in this pull request.

Change type

  • Bug fix (non-breaking change)
  • Code style update (formatting, local variables)
  • New Feature (non-breaking change that adds new functionality without impacting existing)
  • Breaking change (fix or feature that may cause functionality impact)
  • Other

Checklist:

  • My code follows the style and contribution guidelines of this project.
  • I have tested and validated my code changes.

@arudell
Adam Rudell (arudell) requested a review from a team as a code owner July 14, 2026 20:44
@arudell Adam Rudell (arudell) changed the title Enable support for vnet peering tracing [Automated Tracing] Enable support for vnet peering and multiple interfaces Jul 14, 2026
@arudell
Adam Rudell (arudell) enabled auto-merge (squash) July 28, 2026 22:02
Copilot AI review requested due to automatic review settings July 28, 2026 22:02
@arudell
Adam Rudell (arudell) merged commit 46f180e into main Jul 28, 2026
9 checks passed
@arudell
Adam Rudell (arudell) deleted the enable-support-for-vnet-peering-tracing branch July 28, 2026 22:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds multi-interface tracing and gateway discovery across peered virtual networks.

Changes:

  • Accepts network-interface arrays and documents pipeline usage.
  • Resolves local and remote virtual gateways.
  • Removes unused provider-network variables.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/modules/SdnDiag.Common.psm1 Expands interface tracing and gateway mapping.
src/modules/SdnDiag.Health.psm1 Removes unused variables.


[CmdletBinding(DefaultParameterSetName = 'RestCredential')]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
foreach ($vgw in $virtualGateways) {
# gatewaySubnets.resourceRef can include additional path segments,
# so escape and use regex match against the network resource reference
if ($vgw.properties.gatewaySubnets.resourceRef -match [regex]::Escape($gatewayNetworkResourceRef)) {
$virtualGateways = Get-SdnResource @ncRestParams -Resource 'virtualGateways'
$virtualNetworks = Get-SdnResource @ncRestParams -Resource 'virtualNetworks'

foreach ($interface in $NetworkInterface) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants