Help with Meraki-CLI to update firewall rules

NetEng1
New here

Help with Meraki-CLI to update firewall rules

Here's my argument:

meraki appliance updateNetworkApplianceFirewallL3FirewallRules --networkId <networkID> --kwargs "{
    "rules":[
{
            "comment": "Block",
            "policy": "deny",
            "protocol": "any",
            "srcPort": "any",
            "srcCidr": "any",
            "destPort": "any",
            "destCidr": "<IP.ADDR>/32",
            "syslogEnabled": false
      }
]
}"
 
Trying to update firewall rule to block an IP for multiple sites but get following error:
 
2025-02-14 12:41:25,820 [CRITI] Error loading JSON kwargs. Check syntax.
2025-02-14 12:41:25,820 [ERROR] Expecting property name enclosed in double quotes: line 3 column 5 (char 7)
Traceback (most recent call last):
File "/home/sgre/.local/share/pipx/venvs/meraki-cli/lib/python3.12/site-packages/meraki_cli/__main__.py", line 466, in _get_method_params
kwargs = json.loads(kwargs_value) # Interpret the JSON
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 3 column 5 (char 7)
 
 
Any advise on where I have gone wrong?
2 Replies 2
alemabrahao
Kind of a big deal

The error indicates that there is a problem with the JSON syntax in the arguments (kwargs) passed to the updateNetworkApplianceFirewallL3FirewallRules command.

The specific error is: Expecting property name enclosed in double quotes: line 3 column 5 (char 7)

This suggests that there is a problem with the double quotes somewhere in the JSON.

When examining the JSON provided, I noticed that there is a space before the { curly brace that begins the rules object. This may be causing the error.

Try removing the space before the { curly brace and see if the command works:

--kwargs "{ "rules": [{ "comment": "Block", "policy": "deny", "protocol": "any", "srcPort": "any", "srcCidr": "any", "destPort": "any", "destCidr": "<IP.ADDR>/32", "syslogEnabled": false }] }"

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
Inderdeep
Kind of a big deal

Get notified when there are additional replies to this discussion.