Skip to content

az network watcher flow-log configure/show does not work as expected by passing in NSG ID #7065

@zwswim

Description

@zwswim

Describe the bug
A clear and concise description of what the bug is.
By passing nsg ID, the following command returns error: The Resource 'Microsoft.Network/networkSecurityGroups/classicnsgWestCEUAP_wezheng' under resource group 'juzEastUS2EUAPAG' was not found

In the error returned, the resource provider is Microsoft.Network, which is different from the one, "Microsoft.ClassicNetwork", passed in. The guess that the provider is hardcode instead of parsed from the NSG ID the client passed in.

Btw, another potential bug is: it looks like that I have to pass in the optional parameter --subscription, since I already set the required param NSG with the nsg resource id. If I do not have the --subscription there, it give me "resource group not found" error

To Reproduce
Steps to reproduce the behavior.

1> Create a classic nsg under Azure networkwatcher team test subscription 96e68903-0a56-4819-9987-8d08ad6a1f99

2> run CTL command:
az network watcher flow-log configure --nsg /subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/juzEastUS2EUAPAG/providers/Microsoft.ClassicNetwork/networkSecurityGroups/classicnsgWestCEUAP_wezheng --subscription 96e68903-0a56-4819-9987-8d08ad6a1f99 --enabled true --storage-account /subscriptions/96e68903-0a56-4819-9987-8d08ad6a1f99/resourceGroups/FlowAnalysisTest/providers/Microsoft.Storage/storageAccounts/flowanalysistestdiag145

Expected behavior
Since I set required parameter NSG ID, all the information such as Subscription and provider should be get from the NSG id.

Environment summary
Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

CLI version: 2.0

Additional context
Similar problem for network watcher flow-log show

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions