Azure / Azure/azure-cli-extensions

Unable to add management IP to Azure Firewall instance

Open
#4,765 2 comments 0 reactions 2 assignees Claimed by @YuanyuanNi View on GitHub
Auto-Assign customer-reported feature-request Network
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug
I would like to enable forced tunneling on Azure Firewall via Azure CLI.

**Command Name**
`az network firewall management-ip-config update
Extension Name: azure-firewall. Version: 0.13.0.`

**Errors:**
```
The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'public_ip_address'
Traceback (most recent call last):
File "/opt/az/lib/python3.8/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
raise ex
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
result = cmd_copy(params)
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.8/site-packages/azure/cli/core/commands/command_operation.py", line 200, in handler
instance = custom_function(instance=instance, **custom_func_args)
File "/home/k/.azure/cliextensions/azure-firewall/azext_firewall/custom.py", line 249, in update_af_management_ip_configuration
instance.management_ip_configuration.public_ip_address = SubResource(id=public_ip_address)
AttributeError: 'NoneType' object has no attribute 'public_ip_address'

```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- `az network firewall create --resource-group {} --name {} --firewall-policy {}`
- `az network firewall management-ip-config update --resource-group {} --firewall-name {} --vnet-name {} --public-ip-address {}`

## Expected Behavior
I could create an Azure Firewall instance with forced tunneling enabled via Azure CLI.

## Environment Summary
```
Linux-5.4.0-1077-azure-x86_64-with-glibc2.28 (Cloud Shell), Common Base Linux Delridge (quinault)
Python 3.8.13
Installer: DEB

azure-cli 2.36.0

Extensions:
azure-firewall 0.13.0
ai-examples 0.2.5
ssh 1.1.0

Dependencies:
msal 1.17.0
azure-mgmt-resource 20.0.0
```
## Additional Context
None

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.