Skip to content

[Feature]: Start-AzVirtualNetworkGatewayConnectionPacketCapture should validate JSON for filterdata parameter #30088

Description

Description of the new feature

There currently does not seem to be validation for the FilterData parameter, which means that when stopping the packet capture we only see an error ErrorCode: NoPacketCaptureResponseDataFound.

It would be helpful to validate the expected JSON string or to use a proper class so that type casting could be used instead.

Example with wrong filter

# Filter should have rather been: $filterdata = @{Filters = @(@{DestinationSubnets = @('10.0.0.0/16')})} | ConvertTo-Json -Compress -Depth 3
$filterdata = @{DestinationSubnets = @('10.0.0.0/16')} | ConvertTo-Json -Compress
Start-AzVirtualNetworkGatewayConnectionPacketCapture -ResourceGroupName some-rg -Name some-connection -FilterData  $filterdata

The command is accepted despite the wrong filter and the trace is started, but when stopping:

Stop-AzVirtualNetworkGatewayConnectionPacketCapture: Long running operation failed with status 'Failed'. Additional Info:'An internal error occured. The response did not contain any data. Please check storage for the capture.'
StatusCode: 200
ReasonPhrase: OK
Status: Failed
ErrorCode: NoPacketCaptureResponseDataFound
ErrorMessage: An internal error occured. The response did not contain any data. Please check storage for the capture.

Proposed implementation details (optional)

No response

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions