Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az rest fails to parse json response #28296

Closed
Ilia-Kosenkov opened this issue Feb 2, 2024 · 4 comments
Closed

az rest fails to parse json response #28296

Ilia-Kosenkov opened this issue Feb 2, 2024 · 4 comments
Assignees
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Similar-Issue
Milestone

Comments

@Ilia-Kosenkov
Copy link

Describe the bug

A couple of days ago our deployment script suddenly stopped working due to the errors listed below. We use az rest to do some querying & configuration on deployment to Azure, and suddenly all our services are affected. I did not notice any version update in anything related to az leading to this error. I can run our script locally, and it works fine (using the same version of az). The only difference between my machine and CI/CD runner is that I run Windows 11 and CI/CD worker has Ubuntu.

Related command

az rest -m GET -u $spUrl --url-parameters $principalQuery
where

  • $spUrl = 'https://graph.microsoft.com/v1.0/servicePrincipals'
  • $principalQuery = "{`"`$select`":`"id, displayName`",`"`$filter`":`"displayName eq '<removed>'`"}"

Errors

json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

Issue script & Debug output

2024-02-02T14:58:26.6982331Z INFO: az_command_data_logger: command args: rest -m {} -u {} --url-parameters {} --debug
2024-02-02T14:58:26.6982953Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fa1a48db6a0>]
2024-02-02T14:58:26.7006038Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
2024-02-02T14:58:26.7006686Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fa1a49393a0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fa1a49394e0>]
2024-02-02T14:58:26.7018649Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
2024-02-02T14:58:26.7019188Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
2024-02-02T14:58:26.7025077Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fa1a59a20c0>, <function CLIQuery.handle_query_parameter at 0x7fa1a59dbba0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7fa1a4939440>]
2024-02-02T14:58:26.7551089Z DEBUG: cli.azure.cli.core.util: unexpected character after line continuation character (<unknown>, line 1)
2024-02-02T14:58:26.8966349Z DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
2024-02-02T14:58:26.8967700Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 574, in shell_safe_json_parse
2024-02-02T14:58:26.8968071Z     return json.loads(json_or_dict_string, strict=strict)
2024-02-02T14:58:26.8968291Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8968597Z   File "/opt/az/lib/python3.11/json/__init__.py", line 359, in loads
2024-02-02T14:58:26.8968848Z     return cls(**kw).decode(s)
2024-02-02T14:58:26.8969004Z            ^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8969208Z   File "/opt/az/lib/python3.11/json/decoder.py", line 337, in decode
2024-02-02T14:58:26.8969782Z     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2024-02-02T14:58:26.8969974Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8970175Z   File "/opt/az/lib/python3.11/json/decoder.py", line 353, in raw_decode
2024-02-02T14:58:26.8970405Z     obj, end = self.scan_once(s, idx)
2024-02-02T14:58:26.8970581Z                ^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8970822Z json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
2024-02-02T14:58:26.8970971Z 
2024-02-02T14:58:26.8971174Z The above exception was the direct cause of the following exception:
2024-02-02T14:58:26.8971288Z 
2024-02-02T14:58:26.8971454Z Traceback (most recent call last):
2024-02-02T14:58:26.8971949Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 926, in send_raw_request
2024-02-02T14:58:26.8972210Z     temp = shell_safe_json_parse(s)
2024-02-02T14:58:26.8972393Z            ^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8972751Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 600, in shell_safe_json_parse
2024-02-02T14:58:26.8973048Z     raise InvalidArgumentValueError(msg, recommendation=recommendation) from json_ex
2024-02-02T14:58:26.8973347Z azure.cli.core.azclierror.InvalidArgumentValueError: Failed to parse string as JSON:
2024-02-02T14:58:26.8974083Z {\"$select\":\"id, displayName\",\"$filter\":\"displayName eq '<removed>'\"}
2024-02-02T14:58:26.8974405Z Error detail: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
2024-02-02T14:58:26.8974536Z 
2024-02-02T14:58:26.8974736Z During handling of the above exception, another exception occurred:
2024-02-02T14:58:26.8974850Z 
2024-02-02T14:58:26.8975020Z Traceback (most recent call last):
2024-02-02T14:58:26.8975369Z   File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
2024-02-02T14:58:26.8975604Z     cmd_result = self.invocation.execute(args)
2024-02-02T14:58:26.8975796Z                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8976158Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
2024-02-02T14:58:26.8976394Z     raise ex
2024-02-02T14:58:26.8976849Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
2024-02-02T14:58:26.8977101Z     results.append(self._run_job(expanded_arg, cmd_copy))
2024-02-02T14:58:26.8977280Z                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8977595Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
2024-02-02T14:58:26.8977802Z     result = cmd_copy(params)
2024-02-02T14:58:26.8977951Z              ^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8978257Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
2024-02-02T14:58:26.8978487Z     return self.handler(*args, **kwargs)
2024-02-02T14:58:26.8978634Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8978958Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
2024-02-02T14:58:26.8979184Z     return op(**command_args)
2024-02-02T14:58:26.8979328Z            ^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8979632Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/util/custom.py", line 24, in rest_call
2024-02-02T14:58:26.8979898Z     r = send_raw_request(cmd.cli_ctx, method, url, headers, uri_parameters, body,
2024-02-02T14:58:26.8980094Z         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.8980401Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 929, in send_raw_request
2024-02-02T14:58:26.8980657Z     key, value = s.split('=', 1)
2024-02-02T14:58:26.8980804Z     ^^^^^^^^^^
2024-02-02T14:58:26.8980973Z ValueError: not enough values to unpack (expected 2, got 1)
2024-02-02T14:58:26.8981129Z 
2024-02-02T14:58:26.9697106Z ERROR: cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
2024-02-02T14:58:26.9698226Z ERROR: az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
2024-02-02T14:58:26.9711917Z ERROR: cli.azure.cli.core.azclierror: not enough values to unpack (expected 2, got 1)
2024-02-02T14:58:26.9712484Z Traceback (most recent call last):
2024-02-02T14:58:26.9714302Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 574, in shell_safe_json_parse
2024-02-02T14:58:26.9714828Z     return json.loads(json_or_dict_string, strict=strict)
2024-02-02T14:58:26.9715202Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9715883Z   File "/opt/az/lib/python3.11/json/__init__.py", line 359, in loads
2024-02-02T14:58:26.9716295Z     return cls(**kw).decode(s)
2024-02-02T14:58:26.9716764Z            ^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9719476Z   File "/opt/az/lib/python3.11/json/decoder.py", line 337, in decode
2024-02-02T14:58:26.9720273Z     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2024-02-02T14:58:26.9720652Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9721050Z   File "/opt/az/lib/python3.11/json/decoder.py", line 353, in raw_decode
2024-02-02T14:58:26.9721480Z     obj, end = self.scan_once(s, idx)
2024-02-02T14:58:26.9721823Z                ^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9722239Z json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
2024-02-02T14:58:26.9722567Z 
2024-02-02T14:58:26.9722948Z The above exception was the direct cause of the following exception:
2024-02-02T14:58:26.9723354Z 
2024-02-02T14:58:26.9723844Z Traceback (most recent call last):
2024-02-02T14:58:26.9724577Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 926, in send_raw_request
2024-02-02T14:58:26.9725260Z     temp = shell_safe_json_parse(s)
2024-02-02T14:58:26.9725753Z            ^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9726592Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 600, in shell_safe_json_parse
2024-02-02T14:58:26.9727301Z     raise InvalidArgumentValueError(msg, recommendation=recommendation) from json_ex
2024-02-02T14:58:26.9727867Z azure.cli.core.azclierror.InvalidArgumentValueError: Failed to parse string as JSON:
2024-02-02T14:58:26.9728623Z {\"$select\":\"id, displayName\",\"$filter\":\"displayName eq '<removed>'\"}
2024-02-02T14:58:26.9729208Z Error detail: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
2024-02-02T14:58:26.9729486Z 
2024-02-02T14:58:26.9729880Z During handling of the above exception, another exception occurred:
2024-02-02T14:58:26.9730263Z 
2024-02-02T14:58:26.9730654Z Traceback (most recent call last):
2024-02-02T14:58:26.9731185Z   File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
2024-02-02T14:58:26.9731410Z     cmd_result = self.invocation.execute(args)
2024-02-02T14:58:26.9731618Z                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9731969Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
2024-02-02T14:58:26.9732215Z     raise ex
2024-02-02T14:58:26.9732535Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
2024-02-02T14:58:26.9732792Z     results.append(self._run_job(expanded_arg, cmd_copy))
2024-02-02T14:58:26.9732970Z                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9733296Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
2024-02-02T14:58:26.9733522Z     result = cmd_copy(params)
2024-02-02T14:58:26.9733658Z              ^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9733970Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
2024-02-02T14:58:26.9734390Z     return self.handler(*args, **kwargs)
2024-02-02T14:58:26.9734538Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9734868Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
2024-02-02T14:58:26.9735095Z     return op(**command_args)
2024-02-02T14:58:26.9735241Z            ^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9735546Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/util/custom.py", line 24, in rest_call
2024-02-02T14:58:26.9735814Z     r = send_raw_request(cmd.cli_ctx, method, url, headers, uri_parameters, body,
2024-02-02T14:58:26.9736012Z         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9736325Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 929, in send_raw_request
2024-02-02T14:58:26.9736684Z     key, value = s.split('=', 1)
2024-02-02T14:58:26.9736821Z     ^^^^^^^^^^
2024-02-02T14:58:26.9736995Z ValueError: not enough values to unpack (expected 2, got 1)
2024-02-02T14:58:26.9739898Z ERROR: az_command_data_logger: not enough values to unpack (expected 2, got 1)
2024-02-02T14:58:26.9740450Z Traceback (most recent call last):
2024-02-02T14:58:26.9741160Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 574, in shell_safe_json_parse
2024-02-02T14:58:26.9741442Z     return json.loads(json_or_dict_string, strict=strict)
2024-02-02T14:58:26.9741604Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9741788Z   File "/opt/az/lib/python3.11/json/__init__.py", line 359, in loads
2024-02-02T14:58:26.9741982Z     return cls(**kw).decode(s)
2024-02-02T14:58:26.9742131Z            ^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9742295Z   File "/opt/az/lib/python3.11/json/decoder.py", line 337, in decode
2024-02-02T14:58:26.9742514Z     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
2024-02-02T14:58:26.9742683Z                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9742871Z   File "/opt/az/lib/python3.11/json/decoder.py", line 353, in raw_decode
2024-02-02T14:58:26.9743057Z     obj, end = self.scan_once(s, idx)
2024-02-02T14:58:26.9743212Z                ^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9743422Z json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
2024-02-02T14:58:26.9743551Z 
2024-02-02T14:58:26.9743729Z The above exception was the direct cause of the following exception:
2024-02-02T14:58:26.9743826Z 
2024-02-02T14:58:26.9743971Z Traceback (most recent call last):
2024-02-02T14:58:26.9744355Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 926, in send_raw_request
2024-02-02T14:58:26.9744577Z     temp = shell_safe_json_parse(s)
2024-02-02T14:58:26.9744722Z            ^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9745034Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 600, in shell_safe_json_parse
2024-02-02T14:58:26.9745308Z     raise InvalidArgumentValueError(msg, recommendation=recommendation) from json_ex
2024-02-02T14:58:26.9745568Z azure.cli.core.azclierror.InvalidArgumentValueError: Failed to parse string as JSON:
2024-02-02T14:58:26.9745941Z {\"$select\":\"id, displayName\",\"$filter\":\"displayName eq '<removed>'\"}
2024-02-02T14:58:26.9746220Z Error detail: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
2024-02-02T14:58:26.9746333Z 
2024-02-02T14:58:26.9746508Z During handling of the above exception, another exception occurred:
2024-02-02T14:58:26.9746608Z 
2024-02-02T14:58:26.9746754Z Traceback (most recent call last):
2024-02-02T14:58:26.9747052Z   File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
2024-02-02T14:58:26.9747271Z     cmd_result = self.invocation.execute(args)
2024-02-02T14:58:26.9747422Z                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9747735Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
2024-02-02T14:58:26.9748096Z     raise ex
2024-02-02T14:58:26.9748431Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
2024-02-02T14:58:26.9748673Z     results.append(self._run_job(expanded_arg, cmd_copy))
2024-02-02T14:58:26.9748851Z                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9749167Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
2024-02-02T14:58:26.9749386Z     result = cmd_copy(params)
2024-02-02T14:58:26.9749519Z              ^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9749831Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
2024-02-02T14:58:26.9750255Z     return self.handler(*args, **kwargs)
2024-02-02T14:58:26.9750413Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9750730Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
2024-02-02T14:58:26.9750961Z     return op(**command_args)
2024-02-02T14:58:26.9751106Z            ^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9751421Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/util/custom.py", line 24, in rest_call
2024-02-02T14:58:26.9751675Z     r = send_raw_request(cmd.cli_ctx, method, url, headers, uri_parameters, body,
2024-02-02T14:58:26.9751871Z         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-02T14:58:26.9752183Z   File "/opt/az/lib/python3.11/site-packages/azure/cli/core/util.py", line 929, in send_raw_request
2024-02-02T14:58:26.9752446Z     key, value = s.split('=', 1)
2024-02-02T14:58:26.9752582Z     ^^^^^^^^^^
2024-02-02T14:58:26.9752751Z ValueError: not enough values to unpack (expected 2, got 1)
2024-02-02T14:58:26.9753070Z To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
2024-02-02T14:58:26.9753348Z DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fa1a4b1d440>]
2024-02-02T14:58:26.9753581Z INFO: az_command_data_logger: exit code: 1

Expected behavior

As was the case, the query above returns service principal with the given name.

Environment Summary

2024-02-02T14:58:19.3363268Z [command]/usr/bin/az --version
2024-02-02T14:58:20.6718734Z azure-cli                         2.56.0
2024-02-02T14:58:20.6719382Z 
2024-02-02T14:58:20.6720184Z core                              2.56.0
2024-02-02T14:58:20.6720698Z telemetry                          1.1.0
2024-02-02T14:58:20.6720774Z 
2024-02-02T14:58:20.6720915Z Extensions:
2024-02-02T14:58:20.6721250Z azure-devops                      0.26.0
2024-02-02T14:58:20.6721443Z 
2024-02-02T14:58:20.6721581Z Dependencies:
2024-02-02T14:58:20.6721716Z msal                            1.24.0b2
2024-02-02T14:58:20.6721935Z azure-mgmt-resource             23.1.0b2
2024-02-02T14:58:20.6722008Z 
2024-02-02T14:58:20.6722209Z Python location '/opt/az/bin/python3'
2024-02-02T14:58:20.6722458Z Extensions directory '/opt/az/azcliextensions'
2024-02-02T14:58:20.6722545Z 
2024-02-02T14:58:20.6722759Z Python (Linux) 3.11.5 (main, Jan  8 2024, 09:08:13) [GCC 11.4.0]

Additional context

No response

@Ilia-Kosenkov Ilia-Kosenkov added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Feb 2, 2024
Copy link

Hi @Ilia-Kosenkov
Find similar issue #11552.

Issue title Error configuration function app with powershell object for --settings
Create time 2019-12-11
Comment number 7

Please confirm if this resolves your issue.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Service Attention This issue is responsible by Azure service team. labels Feb 2, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Feb 2, 2024

Thank you for opening this issue, we will look into it.

@yonzhan yonzhan added this to the Backlog milestone Feb 2, 2024
@yonzhan yonzhan added question The issue doesn't require a change to the product in order to be resolved. Most issues start as that and removed bug This issue requires a change to an existing behavior in the product in order to be resolved. labels Feb 2, 2024
@Ilia-Kosenkov
Copy link
Author

I am sorry I think I incorrectly identified the issue. It seems the root cause could have been in the recent update of pwsh (or something else related to Azure DevOps runners or tasks and their parameter handling), which slightly changed how parameters were passed into a pwsh script that was calling az rest. After we identified the issue and updated the input escaping logic, it again works perfectly. I am closing this issue.

@JamesDawson
Copy link

Thanks @Ilia-Kosenkov for posting your finding, it definitely saved me some time!

Just to provide some more details for anyone finding this issue in the future, the solution we went with for our module (that include wrappers for calling az and az rest), was to set $PSNativeCommandArgumentPassing = "Legacy".

In our case the issue was caused where we previously had to use Linux-style escaping for quotes included in an argument supplying request headers as a JSON string:

--headers '{\"Content-Type\": \"application/json\"}'

Changing the escaping style as below also resolved the issue, but wouldn't have been backwards-compatible, hence why we chose the solution above.

--headers '{`"Content-Type`": `"application/json`"}'

In our case, the 'Legacy' behaviour falls out of scope once the wrapper function returns so we didn't have to worry about the override having wider side-effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Similar-Issue
Projects
None yet
Development

No branches or pull requests

4 participants