Skip to content
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

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

Closed
zwswim opened this issue Aug 16, 2018 · 8 comments
Assignees
Labels
Network - Network Watcher az network watcher Network az network vnet/lb/nic/dns/etc...
Milestone

Comments

@zwswim
Copy link

zwswim commented Aug 16, 2018

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

@zwswim zwswim changed the title az network watcher flow-log configure does not work as expected by passing in NSG ID az network watcher flow-log configure/show does not work as expected by passing in NSG ID Aug 16, 2018
@tjprescott
Copy link
Member

As far as needing to pass --subscription, that is definitely a bug. CLI 2.0 doesn't support classic resources, but I'll see if there's a quick fix to make that work.

@tjprescott tjprescott added bug This issue requires a change to an existing behavior in the product in order to be resolved. Network labels Aug 16, 2018
@tjprescott tjprescott self-assigned this Aug 16, 2018
@tjprescott tjprescott added this to the Sprint 45 - Ignite milestone Aug 16, 2018
@tjprescott
Copy link
Member

PR merged. Will be in Ignite release.

tjprescott added a commit that referenced this issue Sep 11, 2018
* Bump API version

* [Network] Public IP Prefix (#7081)

* Initial Work

* Finish command work and test.

* Add help entries.

* Vnet show/list table format.

* [Network] Service endpoint policies (#7080)

* Intial work

* Finish command work and add test.

* Remove policy-definition create workaround.

* Code review feedback.

* [Network] Load Balancer Outbound Rules (#7114)

* Initial work on Outbound Rules

* Progress on outbound rules.

* Final work on LB outbound rules.

* Add `--enable-tcp-reset` to inbound-nat-rule, inbound-nat-pool, and rule create/update commands.

* Fix 2 Network Live test issues.

* [IgniteNetwork] Fix issues with Network Watcher flog-log configure (#7143)

* Fix #7065. Fix #7066.

* Code review feedback.

* [IgniteNetwork] Add `run-configuration-diagnostic` command and fix `test-connectivity` (#7165)

* Add run-configuration-diagnostic command.

* Add `run-configuration-diagnostic` command. Fix `test-connectivty` command because of SDK breaking change.

* [IgniteNetwork] Subnet delegation (#7200)

* Subnet delegation support.

* Finish work and add test.

* Close #7181. (#7205)

* Code review comments.

* Disable test recordings on IgniteNetwork branch.

* Clean up static issues.

* Add private WHL for draft SDK.

* Fix #7146. Fix #7191. Fix #7213. (#7232)

* [IgniteNetwork] DNS Alias Records (#7233)

* Initial work.

* Add test.

* Add checks to DNS test. Add private DNS whl file.

* Close #7242. (#7246)

* Vnet show/list table format.

* Bump API version

* [Network] Public IP Prefix (#7081)

* Initial Work

* Finish command work and test.

* Add help entries.

* [Network] Service endpoint policies (#7080)

* Intial work

* Finish command work and add test.

* Remove policy-definition create workaround.

* Code review feedback.

* [Network] Load Balancer Outbound Rules (#7114)

* Initial work on Outbound Rules

* Progress on outbound rules.

* Final work on LB outbound rules.

* Add `--enable-tcp-reset` to inbound-nat-rule, inbound-nat-pool, and rule create/update commands.

* Fix 2 Network Live test issues.

* [IgniteNetwork] Fix issues with Network Watcher flog-log configure (#7143)

* Fix #7065. Fix #7066.

* Code review feedback.

* [IgniteNetwork] Add `run-configuration-diagnostic` command and fix `test-connectivity` (#7165)

* Add run-configuration-diagnostic command.

* Add `run-configuration-diagnostic` command. Fix `test-connectivty` command because of SDK breaking change.

* [IgniteNetwork] Subnet delegation (#7200)

* Subnet delegation support.

* Finish work and add test.

* Close #7181. (#7205)

* Code review comments.

* Disable test recordings on IgniteNetwork branch.

* Clean up static issues.

* Add private WHL for draft SDK.

* Fix #7146. Fix #7191. Fix #7213. (#7232)

* [IgniteNetwork] DNS Alias Records (#7233)

* Initial work.

* Add test.

* Add checks to DNS test. Add private DNS whl file.

* Close #7242. (#7246)

* Record DNS tests.

* Record tests 2018-08-01

* Re-enable tests. Begin re-recording.

* Test re-recording.

* Re-record test.

* Re-record tests.

* Re-record tests

* Re-record tests

* Re-record more tests. Unlimited tests!!

* [IgniteNetwork] Read-only support for InterfaceEndpoints (#7272)
@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@mozehgir mozehgir added the Network az network vnet/lb/nic/dns/etc... label Jul 26, 2019
@rem-aj
Copy link

rem-aj commented Oct 3, 2019

Hello @tjprescott I notice this issue is closed since last summer, however I am still experiencing this issue currently, passing in subscription ID as a workaround doesnt fix it either.

$ az network watcher flow-log configure --resource-group XXX--enabled true --nsg XXX--storage-account XXX
ResourceNotFound - The Resource 'Microsoft.Storage/storageAccounts/XXX' under resource group 'XXX' was not found.

It is true that the storage account does not exist under the resource group, as I'm using the resource group where the NSG is actually in, even if I switch the resource group to the one where the storage account is, it still fails with the exact same error.

I'm using 2.0.71 * for az-cli version currently which is a recent version.

@tjprescott
Copy link
Member

@myronfanqiu fyi

@mmyyrroonn mmyyrroonn reopened this Oct 8, 2019
@KarenHammons KarenHammons added Network - Network Watcher az network watcher and removed Network az network vnet/lb/nic/dns/etc... labels Oct 11, 2019
@haroldrandom haroldrandom added bug This issue requires a change to an existing behavior in the product in order to be resolved. Network - Network Watcher az network watcher Network-cli Service Attention This issue is responsible by Azure service team. labels Oct 25, 2019
@haroldrandom haroldrandom removed this from the S161 milestone Nov 18, 2019
@haroldrandom haroldrandom added this to the S162 milestone Nov 18, 2019
@haroldrandom haroldrandom removed the Service Attention This issue is responsible by Azure service team. label Dec 7, 2019
@haroldrandom haroldrandom modified the milestones: S162, S163 Dec 12, 2019
@haroldrandom
Copy link
Contributor

It the bug still?

@yonzhan yonzhan removed the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jan 2, 2020
@yonzhan yonzhan modified the milestones: S163, S164 Jan 2, 2020
@haroldrandom haroldrandom modified the milestones: S164, S165 Jan 14, 2020
@mmyyrroonn mmyyrroonn modified the milestones: S165, S166 Feb 15, 2020
@mmyyrroonn mmyyrroonn added Network az network vnet/lb/nic/dns/etc... and removed Network-cli labels Feb 18, 2020
@haroldrandom
Copy link
Contributor

As for the different provoder for network, I found it's been fixed.

As for the wanted behavior "all the information such as Subscription and provider should be get from the NSG id", it's been fixed too.

@haroldrandom
Copy link
Contributor

haroldrandom commented Feb 28, 2020

@rem-aj There is an implicit restriction in flow-log.

Firstly, only one watcher can be existed per subscription and region. One watcher can have many flow logs, they are in the same resource group (a default created one named "NetworkWatcherRG") and same location.

Secondly, all the related sub-resources NSG, storage account, workspace can be in differenct resource group but are required in the same location of flow log per subscription.

So it doesn't matter which resource group they are in, but region is.

In the logic we implemented, we didn't count subscription in, it has no effect.
The resoruce group is used to assemble the ID when user provide name for NSG, storage account and workspace. While configure and user provides NSG ID, we will take the location of NSD as identify to find Network Watche.

The solution is to make your storage account be in the same region of NSG.

BTW, a new command is developing az network watcher flow-log will do the same job which will give more intuition on usgae.
#12350.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Network - Network Watcher az network watcher Network az network vnet/lb/nic/dns/etc...
Projects
None yet
Development

No branches or pull requests

10 participants