You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to create an Azure network flowlog using azure.azcollection.azure_rm_networkflowlog, the location parameter does not appear to be honored.
ISSUE TYPE
Bug Report
COMPONENT NAME
azure_rm_networkflowlog
ANSIBLE VERSION
/usr/lib/python3.11/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
"cipher": algorithms.TripleDES,
/usr/lib/python3.11/site-packages/paramiko/transport.py:256: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
"class": algorithms.TripleDES,
ansible [core 2.14.5]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.11/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.11.10 (main, Sep 11 2024, 21:23:52) [GCC 12.2.1 20220924] (/usr/bin/python3)
jinja version = 3.1.4
libyaml = True
COLLECTION VERSION
Collection Version
------------------ -------
azure.azcollection 2.7.0
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT
Azure
STEPS TO REPRODUCE
Setup:
My NetworkWatcherRG resource group was created in Central US.
I have NetworkWatchers in both Central US and NorthCentral US.
Looping over my 3 vNets where 2 are located in Central US and 1 is located in NorthCentral US, only the 2 in Central US are created and the 3rd throws this error: "msg": "Error creating Flow Log vnet-northcentralus-dev-myflowlog-1_flowlog - (InvalidFlowLogTargetResource) Target resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-ncsu-my-resource-group-1/providers/Microsoft.Network/virtualNetworks/vnet-northcentralus-dev-myflowlog-1 passed for the flow log is invalid.\nCode: InvalidFlowLogTargetResource\nMessage: Target resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-ncsu-my-resource-group-1/providers/Microsoft.Network/virtualNetworks/vnet-northcentralus-dev-myflowlog-1 passed for the flow log is invalid."}
As a test, using the azCLI, I can successfully create the flowlog for the vNet in NorthCentral. azCLI command used: az network watcher flow-log create --location northcentralus --resource-group rg-ncus-my-resource-group-1 --name vnet-northcentralus-dev-myflowlog-1_flowlog --vnet vnet-northcentralus-dev-myflowlog-1 --storage-account /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-northcentralus-networkwatcher-myresources-1/providers/Microsoft.Storage/storageAccounts/strnorthcentralusnw
After the test validating that using azCLI will create the desired flowlog, when I rerun my playbook, I observe a different error that implies that the flowlog is attempting to be created in centralus even when northcentralus is specified as the location in my vars file: "msg": "Error creating Flow Log vnet-northcentralus-dev-myflowlog-1_flowlog - (InvalidResourceLocation) The resource 'NetworkWatcher_northcentralus/vnet-northcentralus-dev-myflowlog-1_flowlog' already exists in location 'northcentralus' in resource group 'NetworkWatcherRG'. A resource with the same name cannot be created in location 'centralus'. Please select a new resource name.\nCode: InvalidResourceLocation\nMessage: The resource 'NetworkWatcher_northcentralus/vnet-northcentralus-dev-myflowlog-1_flowlog' already exists in location 'northcentralus' in resource group 'NetworkWatcherRG'. A resource with the same name cannot be created in location 'centralus'. Please select a new resource name."}
Upon successful playbook run, I expect to have 3 network flow logs where 2 are created in centralus and 1 is created in northcentralus.
ACTUAL RESULTS
The flow logs for Central US are created as expected. The third flow log encounters the following error: "msg": "Error creating Flow Log vnet-northcentralus-dev-myflowlog-1_flowlog - (InvalidFlowLogTargetResource) Target resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-ncsu-my-resource-group-1/providers/Microsoft.Network/virtualNetworks/vnet-northcentralus-dev-myflowlog-1 passed for the flow log is invalid.\nCode: InvalidFlowLogTargetResource\nMessage: Target resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-ncsu-my-resource-group-1/providers/Microsoft.Network/virtualNetworks/vnet-northcentralus-dev-myflowlog-1 passed for the flow log is invalid."}
Error output noted above.
The text was updated successfully, but these errors were encountered:
SUMMARY
When attempting to create an Azure network flowlog using
azure.azcollection.azure_rm_networkflowlog
, the location parameter does not appear to be honored.ISSUE TYPE
COMPONENT NAME
azure_rm_networkflowlog
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Azure
STEPS TO REPRODUCE
Setup:
"msg": "Error creating Flow Log vnet-northcentralus-dev-myflowlog-1_flowlog - (InvalidFlowLogTargetResource) Target resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-ncsu-my-resource-group-1/providers/Microsoft.Network/virtualNetworks/vnet-northcentralus-dev-myflowlog-1 passed for the flow log is invalid.\nCode: InvalidFlowLogTargetResource\nMessage: Target resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-ncsu-my-resource-group-1/providers/Microsoft.Network/virtualNetworks/vnet-northcentralus-dev-myflowlog-1 passed for the flow log is invalid."}
As a test, using the azCLI, I can successfully create the flowlog for the vNet in NorthCentral. azCLI command used:
az network watcher flow-log create --location northcentralus --resource-group rg-ncus-my-resource-group-1 --name vnet-northcentralus-dev-myflowlog-1_flowlog --vnet vnet-northcentralus-dev-myflowlog-1 --storage-account /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-northcentralus-networkwatcher-myresources-1/providers/Microsoft.Storage/storageAccounts/strnorthcentralusnw
After the test validating that using azCLI will create the desired flowlog, when I rerun my playbook, I observe a different error that implies that the flowlog is attempting to be created in centralus even when northcentralus is specified as the location in my vars file:
"msg": "Error creating Flow Log vnet-northcentralus-dev-myflowlog-1_flowlog - (InvalidResourceLocation) The resource 'NetworkWatcher_northcentralus/vnet-northcentralus-dev-myflowlog-1_flowlog' already exists in location 'northcentralus' in resource group 'NetworkWatcherRG'. A resource with the same name cannot be created in location 'centralus'. Please select a new resource name.\nCode: InvalidResourceLocation\nMessage: The resource 'NetworkWatcher_northcentralus/vnet-northcentralus-dev-myflowlog-1_flowlog' already exists in location 'northcentralus' in resource group 'NetworkWatcherRG'. A resource with the same name cannot be created in location 'centralus'. Please select a new resource name."}
Example playbook task:
Example vars:
EXPECTED RESULTS
Upon successful playbook run, I expect to have 3 network flow logs where 2 are created in centralus and 1 is created in northcentralus.
ACTUAL RESULTS
The flow logs for Central US are created as expected. The third flow log encounters the following error:
"msg": "Error creating Flow Log vnet-northcentralus-dev-myflowlog-1_flowlog - (InvalidFlowLogTargetResource) Target resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-ncsu-my-resource-group-1/providers/Microsoft.Network/virtualNetworks/vnet-northcentralus-dev-myflowlog-1 passed for the flow log is invalid.\nCode: InvalidFlowLogTargetResource\nMessage: Target resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/rg-ncsu-my-resource-group-1/providers/Microsoft.Network/virtualNetworks/vnet-northcentralus-dev-myflowlog-1 passed for the flow log is invalid."}
The text was updated successfully, but these errors were encountered: