Skip to content

[Az.Network] Updated New-AzNetworkWatcherPacketCaptureV2 command and added a new sub command 'New-AzPacketCaptureSettingsConfig' for Network watcher Packet capture include ring buffer change. #27880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 20, 2025

Conversation

v-sapanchal
Copy link
Contributor

Description

Modified the existing Packet capture command include ring buffer change, in order to that, created a new sub command for capture settings,
Example:
image
image

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/Network/Network/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@v-sapanchal v-sapanchal added this to the Az 14.2.0 (07/01/2025) milestone Jun 2, 2025
@v-sapanchal v-sapanchal marked this pull request as ready for review June 13, 2025 10:47
@Copilot Copilot AI review requested due to automatic review settings June 13, 2025 10:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request updates the Packet Capture commands by introducing a new subcommand (New-AzPacketCaptureSettingsConfig) to encapsulate capture settings and by modifying New-AzNetworkWatcherPacketCaptureV2 to support ring buffer configurations via new parameters. Key changes include:

  • Adding a new cmdlet to generate capture settings objects.
  • Updating Packet Capture V2 to accept ContinuousCapture, CaptureSettings, and LocalPath parameters.
  • Adjusting help files, tests, and command mappings to incorporate the new functionality.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/StaticAnalysis/Exceptions/Az.Network/SignatureIssues.csv Updated signature exceptions for New-AzNetworkWatcherPacketCaptureV2 to flag naming convention issues.
tools/StaticAnalysis/Exceptions/Az.Network/ExampleIssues.csv Added new example entries for New-AzPacketCaptureSettingsConfig.
src/Network/Network/help/New-AzPacketCaptureSettingsConfig.md New help file documenting the new subcommand.
src/Network/Network/help/New-AzNetworkWatcherPacketCaptureV2.md Updated help file reflecting new parameters and example with ring buffer capture.
src/Network/Network/NetworkWatcher/PacketCapture/NewPacketCaptureSettingsCommand.cs New implementation for creating packet capture settings objects.
src/Network/Network/NetworkWatcher/PacketCapture/NewAzureNetworkWatcherPacketCaptureCommandV2.cs Modified to add support for ContinuousCapture, CaptureSettings, and LocalPath parameters.
src/Network/Network/Models/PSPacketCaptureSettings.cs New model supporting file count, file size, and session time limit settings.
src/Network/Network/ChangeLog.md Updated to mention new commands and parameter additions.
src/Network/Network/Az.Network.psd1 Updated command exports to include the new subcommand.
src/Network/Network.Test/ScenarioTests/NetworkWatcherAPITests.ps1 & cs Added tests validating the new capture settings functionality.
src/Accounts/Accounts/Utilities/CommandMappings.json Included the new command mapping for New-AzPacketCaptureSettingsConfig.
Comments suppressed due to low confidence (2)

tools/StaticAnalysis/Exceptions/Az.Network/SignatureIssues.csv:462

  • The exception message flags the 'CaptureSettings' parameter naming for New-AzNetworkWatcherPacketCaptureV2. Consider revising the parameter name to use a singular noun for consistency, or update the enforced naming convention if appropriate.
+"Az.Network","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherPacketCaptureCommandV2","New-AzNetworkWatcherPacketCaptureV2","1","8410","Parameter CaptureSettings of cmdlet New-AzNetworkWatcherPacketCaptureV2 does not follow the enforced naming convention of using a singular noun for a parameter name.","Consider using a singular noun for the parameter name."

src/Network/Network/NetworkWatcher/PacketCapture/NewAzureNetworkWatcherPacketCaptureCommandV2.cs:308

  • There is an inconsistency in parameter naming between 'LocalFilePath' and 'LocalPath'. Consolidate these names to a single consistent identifier to avoid confusion and improve clarity in both the cmdlet implementation and its documentation.
packetCaptureProperties.StorageLocation.FilePath = this.LocalFilePath;

@vidai-msft
Copy link
Contributor

/azp run azure-powershell - security-tools

Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@v-sapanchal
Copy link
Contributor Author

Please do not merge this PR for now, getting reviewed by NW team.

@v-sapanchal
Copy link
Contributor Author

Hi @vidai-msft,
can you please review this PR now and merge it.
Internal review is done now.

@vidai-msft
Copy link
Contributor

/azp run azure-powershell - security-tools

Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@vidai-msft
Copy link
Contributor

@v-sapanchal Please revert all the changes on ExamplesIssues.csv and SignatureIssues.csv.

@v-sapanchal
Copy link
Contributor Author

Hi @vidai-msft,
As you asked about "Does this cmdlet update server side properties? If so, then SupportsShouldProcess is required." in one of the comment, it's not updating any server side properties, but for SignatureIssues,
I have added SupportsShouldProcess as false. but still I am getting this error in SignatureIssues.csv.
can you please help me.

@vidai-msft
Copy link
Contributor

Hi @vidai-msft, As you asked about "Does this cmdlet update server side properties? If so, then SupportsShouldProcess is required." in one of the comment, it's not updating any server side properties, but for SignatureIssues, I have added SupportsShouldProcess as false. but still I am getting this error in SignatureIssues.csv. can you please help me.

@v-sapanchal Generally New-* cmdlet implies something would be created. If this cmdlet won't create anything on the server side but just an in-memory object instead, then it is qualified to suppress it.

@v-sapanchal
Copy link
Contributor Author

Hi @vidai-msft, As you asked about "Does this cmdlet update server side properties? If so, then SupportsShouldProcess is required." in one of the comment, it's not updating any server side properties, but for SignatureIssues, I have added SupportsShouldProcess as false. but still I am getting this error in SignatureIssues.csv. can you please help me.

@v-sapanchal Generally New-* cmdlet implies something would be created. If this cmdlet won't create anything on the server side but just an in-memory object instead, then it is qualified to suppress it.

Yes, got the answer, this is static check for New prefix. For running all the check successfully, I have set it as 'true' for now.
If you want me to add, I can add it for suppress.

@vidai-msft vidai-msft enabled auto-merge (squash) June 20, 2025 15:08
Copy link
Contributor

@vidai-msft vidai-msft left a comment

Choose a reason for hiding this comment

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

LGTM

@vidai-msft
Copy link
Contributor

/azp run azure-powershell - security-tools

Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@vidai-msft vidai-msft merged commit 48acd16 into Azure:main Jun 20, 2025
12 checks passed
@v-sapanchal
Copy link
Contributor Author

Thanks @vidai-msft for your help.

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.

3 participants