Azure / Azure/azure-cli

Azure Firewall : Return [unable to find 'xxx'...] when added Application Rule for Azure Firewall

Open
#18,728 2 comments 0 reactions 1 assignee Claimed by @kairu-ms View on GitHub
act-quality-productivity-squad feature-request Network p2_e2 UsageProblem
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62

**Describe the bug**
When we add Application Rule for Azure Firewall, Application Rule is added correctly but we got below message. Rule is able to add without issue so that this might be incorrect the program is working. 'xxx' will be rule name.

unable to find 'xxx'...

**To Reproduce**
We can repro with below sample command. We got [unable to find 'test'...] with below.

```
az network firewall application-rule create --collection-name 'name' --firewall-name 'fw-name' --name 'test.com' --protocols Https=443 --resource-group 'fw-rgname' --source-addresses '*' --target-fqdns 'test.com'
```

I confirmed output with "--debug" below. These response is returned after all command is completed.

```
cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception:
cli.azure.cli.core.util: Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/home/takeshi/.azure/cliextensions/azure-firewall/azext_firewall/custom.py", line 442, in create_af_application_rule
AzureFirewallApplicationRule, item_name, params, collection_params)
File "/home/takeshi/.azure/cliextensions/azure-firewall/azext_firewall/custom.py", line 363, in _upsert_af_rule
return _find_item_at_path(af, '{}.{}.rules.{}'.format(collection_param_name, collection_name, item_name))
File "/home/takeshi/.azure/cliextensions/azure-firewall/azext_firewall/custom.py", line 61, in _find_item_at_path
raise CLIError("unable to find '{}'...".format(comp))
knack.util.CLIError: unable to find 'test'...

cli.azure.cli.core.azclierror: unable to find 'test'...
az_command_data_logger: unable to find 'test'...
```

**Expected behavior**
We should get no such response.

**Environment summary**
Azure CloudShell

```
> az --version
azure-cli 2.25.0

core 2.25.0
telemetry 1.0.6

Extensions:
azure-firewall 0.11.0
front-door 1.0.9
ai-examples 0.2.5
ssh 0.1.5

Python location '/opt/az/bin/python3'
Extensions directory '/home/takeshi/.azure/cliextensions'
Extensions system directory '/opt/az/lib/python3.6/site-packages/azure-cli-extensions'

Python (Linux) 3.6.10 (default, Jun 11 2021, 05:19:31)
[GCC 8.3.0]
```

**Additional context**
Please let us know if this is not bug...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.