Skip to content

AZ CLI upgrade to 2.76.0 broke 'az network application-gateway waf-policy custom-rule' command #31963

@Tedkata

Description

@Tedkata

Describe the bug

Reference to this ticket, you can check my comment also on bottom #31954

Related command

  • name: Public IP
    id: ip
    uses: haythem/public-ip@v1.3

  • name: Print Public IP
    run: |
    echo ${{ steps.ip.outputs.ipv4 }}
    echo ${{ steps.ip.outputs.ipv6 }}

  • name: Create Custom Rule WAF for Github
    run: |
    az network application-gateway waf-policy custom-rule create --action Allow --name ${{ env.SOMENAME }} --policy-name ${{ env.SOMEPOLICY }} --priority ${{ env.PRIORITYNUMBER }} --resource-group ${{ env.RESGROUP }} --rule-type MatchRule --match- conditions '[{"variables":[{"variable_name":"RemoteAddr"}],"operator":"IPMatch","values":["${{ steps.ip.outputs.ipv4 }}/32"]}]'

Errors

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: Expect <class 'str'>, got 931130 (<class 'int'>)
Traceback (most recent call last):
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 49, in process_data
json_data = shell_safe_json_parse(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/util.py", line 575, in shell_safe_json_parse
return json.loads(json_or_dict_string, strict=strict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/json/init.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not int

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 666, in execute
raise ex
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command.py", line 155, in call
return self._handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/_create.py", line 37, in _handler
self._execute_operations()
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/_create.py", line 197, in _execute_operations
self.WebApplicationFirewallPoliciesGet(ctx=self.ctx)()
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/_create.py", line 256, in call
return self.on_200(session)
^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/network/aaz/latest/network/application_gateway/waf_policy/custom_rule/_create.py", line 314, in on_200
self.ctx.set_var(
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command_ctx.py", line 84, in set_var
self.vars[name] = data
~~~~~~~~~^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 79, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 286, in process_data
value[key] = sub_data
~~~~~^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 79, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 286, in process_data
value[key] = sub_data
~~~~~^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 79, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 286, in process_data
value[key] = sub_data
~~~~~^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 79, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 462, in process_data
value[idx] = sub_data
~~~~~^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 316, in setitem
self._data[idx] = item_schema.process_data(data, key=idx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 286, in process_data
value[key] = sub_data
~~~~~^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 79, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 462, in process_data
value[idx] = sub_data
~~~~~^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 316, in setitem
self._data[idx] = item_schema.process_data(data, key=idx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 286, in process_data
value[key] = sub_data
~~~~~^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 79, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 462, in process_data
value[idx] = sub_data
~~~~~^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 316, in setitem
self._data[idx] = item_schema.process_data(data, key=idx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 51, in process_data
raise AAZInvalidValueError('Expect {}, got {} ({})'.format(self.DataType, data, type(data)))
azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'str'>, got 931130 (<class 'int'>)

Issue script & Debug output

Hi, I’m still hitting this error when creating a WAF custom rule, even on Azure CLI 2.76.0 / 2.77.0 (on ubuntu-latest GitHub Actions runner).

Expected behavior

successful pipeline execution.

Environment Summary

azure-cli 2.76.0

Additional context

No response

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamNetworkaz network vnet/lb/nic/dns/etc...Possible-SolutionSimilar-Issuecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions