Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

"az rest" fails with error "not enough values to unpack" #28956

Closed CybercrawlerS closed 4 months ago

CybercrawlerS commented 4 months ago

Describe the bug

The follow command produces the enclosed error,

SCOPE="https://graph.microsoft.com"
TOKEN=$(az account get-access-token --resource $SCOPE --query 'accessToken' | xargs)

az rest --method post --uri 'https://graph.microsoft.com/v1.0/me/sendMail' --headers "Authorization: Bearer $TOKEN" --body "$emailData"`

Related command

az rest --method post --uri 'https://graph.microsoft.com/v1.0/me/sendMail' --headers "Authorization: Bearer $TOKEN" --body "$emailData"

Errors

Error:

`The command failed with an unexpected error. Here is the traceback:

not enough values to unpack (expected 2, got 1)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 273, in shell_safe_json_parse
    return json.loads(json_or_dict_string)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 279, in shell_safe_json_parse
    return ast.literal_eval(json_or_dict_string)
  File "/usr/lib/python3.8/ast.py", line 59, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IktYbjY3QnJtMjY0UktPck9RdzVMM21IY2ZTUXhlV2Frd0RjTEtSRTRFa2siLCJhbGciOi<<THIS-SECTION-IS-REMOVED-INTENTIONALL>>thRBgpAVD-54xCP_N9t_NI_SsGc7u78rMF5zzy8uGIqLB4XqvTq3_asL17fLlQP5_U4eJQq74Meciti_bNV3OYpdZdHoSAKtqHzXaIQpKMAlemFqbl4O_HSkMluaBsRSV9p86S8Je-m5TkghNdNWEvor4kWecCcgwdpf-STh5mrIEAB-RLVulgiNahXhf9DlYL2OPt_g997Q
                 ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 542, in send_raw_request
    temp = shell_safe_json_parse(s)
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 281, in shell_safe_json_parse
    raise CLIError(json_ex)
knack.util.CLIError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 608, in execute
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 666, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 659, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 636, in _run_job
    result = cmd_copy(params)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 306, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 493, in default_command_handler
    return op(**command_args)
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/resource/custom.py", line 2036, in rest_call
    r = send_raw_request(cmd.cli_ctx, method, uri, headers, uri_parameters, body,
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 545, in send_raw_request
    key, value = s.split('=', 1)
ValueError: not enough values to unpack (expected 2, got 1)`

Issue script & Debug output

Command arguments: ['rest', '--method', 'post', '--uri', 'https://graph.microsoft.com/v1.0/me/sendMail', '--headers', 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IktYbjY3QnJtMjY0UktPck9RdzVMM21IY2ZTUXhlV2Frd0RjTEtSRTRFa2siLCJhbGciOiJSUzI1NiIsIng1dCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCIsImtpZCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC85Mjk1ZDA3Ny0<SCRAPED>uaXF1ZV9uYW1lIjoiUHJlbWt1bWFyLlNlbHZhcmFqQGVsZWt0YS5jb20iLCJ1cG4iOiJQcmVta3VtYXIuU2VsdmFyYWpAZWxla3RhLmNvbSIsInV0aSI6ImZIQlVpN2UtekVlS2QxTXdCVUYxQUEiLCJ2ZXIiOiIxLjAiLCJ3aWRzIjpbImI3OWZiZjRkLTNlZjktNDY4OS04MTQzLTc2YjE5NGU4NTUwOSJdLCJ4bXNfdGNkdCI6MTM5NTY2NTU2MSwieG1zX3RkYnIiOiJFVSJ9.euEoBGwfnox7EAJvaCDTdkQntPRNXyeiGCjyooTaxowSdsHgGtQj-gXCAnAIx3-dJHZKAgFNcHGDOz8ZWIXlWSUPBMA_oYxmqldjH2-qd0p2_rzKlU1R4bay5H2vFJocvSTn6a-NxLthRBgpAVD-54xCP_N9t_NI_SsGc7u78rMF5zzy8uGIqLB4XqvTq3_asL17fLlQP5_U4eJQq74Meciti_bNV3OYpdZdHoSAKtqHzXaIQpKMAlemFqbl4O_HSkMluaBsRSV9p86S8Je-m5TkghNdNWEvor4kWecCcgwdpf-STh5mrIEAB-RLVulgiNahXhf9DlYL2OPt_g997Q', '--body', '{\n                "message": {\n                    "subject": "Agent Pool ",\n                    "body": {\n                        "contentType": "Text",\n                        "content": "$pool_name is having $count jobs waiting in Queue at $sampling_time"\n                    },\n                    "toRecipients": [\n                        {\n                            "emailAddress": {\n                                "address": "removed@onpurpose.com"\n                            }\n                        }\n                    ]\n                }\n              }', '--debug']
Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fda3bb9daf0>, <function OutputProducer.on_global_arguments at 0x7fda3bb76820>, <function CLIQuery.on_global_arguments at 0x7fda3bb9aa60>]
Event: CommandInvoker.OnPreCommandTableCreate []
Installed command modules ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'deploymentmanager', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'interactive', 'iot', 'iotcentral', 'keyvault', 'kusto', 'lab', 'managedservices', 'maps', 'monitor', 'natgateway', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm']
Loaded module 'acr' in 0.002 seconds.
Loaded module 'acs' in 0.004 seconds.
Loaded module 'advisor' in 0.000 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'ams' in 0.002 seconds.
Loaded module 'apim' in 0.001 seconds.
Loaded module 'appconfig' in 0.001 seconds.
Loaded module 'appservice' in 0.003 seconds.
Loaded module 'backup' in 0.009 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'batch' in 0.003 seconds.
Loaded module 'batchai' in 0.001 seconds.
Loaded module 'billing' in 0.000 seconds.
Loaded module 'botservice' in 0.001 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'cdn' in 0.001 seconds.
Loaded module 'cloud' in 0.000 seconds.
Loaded module 'cognitiveservices' in 0.000 seconds.
Loaded module 'configure' in 0.000 seconds.
Loaded module 'consumption' in 0.001 seconds.
Loaded module 'container' in 0.001 seconds.
Loaded module 'cosmosdb' in 0.003 seconds.
Loaded module 'deploymentmanager' in 0.001 seconds.
Loaded module 'dla' in 0.001 seconds.
Loaded module 'dls' in 0.001 seconds.
Loaded module 'dms' in 0.001 seconds.
Loaded module 'eventgrid' in 0.001 seconds.
Loaded module 'eventhubs' in 0.001 seconds.
Loaded module 'extension' in 0.000 seconds.
Loaded module 'feedback' in 0.000 seconds.
Loaded module 'find' in 0.000 seconds.
Loaded module 'hdinsight' in 0.001 seconds.
Loaded module 'interactive' in 0.000 seconds.
Loaded module 'iot' in 0.002 seconds.
Loaded module 'iotcentral' in 0.000 seconds.
Loaded module 'keyvault' in 0.002 seconds.
Loaded module 'kusto' in 0.001 seconds.
Loaded module 'lab' in 0.001 seconds.
Loaded module 'managedservices' in 0.000 seconds.
Loaded module 'maps' in 0.000 seconds.
Loaded module 'monitor' in 0.002 seconds.
Loaded module 'natgateway' in 0.001 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'netappfiles' in 0.001 seconds.
Loaded module 'network' in 0.011 seconds.
Loaded module 'policyinsights' in 0.001 seconds.
Loaded module 'privatedns' in 0.002 seconds.
Loaded module 'profile' in 0.001 seconds.
Loaded module 'rdbms' in 0.002 seconds.
Loaded module 'redis' in 0.001 seconds.
Loaded module 'relay' in 0.001 seconds.
Loaded module 'reservations' in 0.001 seconds.
Loaded module 'resource' in 0.003 seconds.
Loaded module 'role' in 0.001 seconds.
Loaded module 'search' in 0.001 seconds.
Loaded module 'security' in 0.001 seconds.
Loaded module 'servicebus' in 0.002 seconds.
Loaded module 'servicefabric' in 0.001 seconds.
Loaded module 'signalr' in 0.001 seconds.
Loaded module 'sql' in 0.003 seconds.
Loaded module 'sqlvm' in 0.001 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'storage' in 0.011 seconds.
Loaded module 'vm' in 0.006 seconds.
Loaded all modules in 0.099 seconds. (note: there's always an overhead with the first module loaded)
Extensions directory: '/home/cybercrawler/.azure/cliextensions'
Found 1 extensions: ['azure-devops']
Extensions directory: '/home/cybercrawler/.azure/cliextensions'
Extension compatibility result: is_compatible=True cli_core_version=2.0.81 min_required=2.0.69 max_required=None
Extensions directory: '/home/cybercrawler/.azure/cliextensions'
Loaded extension 'azure-devops' in 0.010 seconds.
Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fda3b5a8dc0>]
az_command_data_logger : command args: rest --method {} --uri {} --headers {} --body {} --debug
metadata file logging enabled - writing logs to '/home/cybercrawler/.azure/commands'.
Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fda3b5c4e50>]
Event: CommandInvoker.OnPostArgumentLoad []
Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fda3b57e1f0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fda3b57e310>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7fda3a8939d0>]
Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fda3bb768b0>, <function CLIQuery.handle_query_parameter at 0x7fda3bb9aaf0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7fda3b57e280>, <function handler at 0x7fda3a7538b0>, <function DevCommandsLoader.post_parse_args at 0x7fda39f46310>]
cli.azure.cli.core.util : The command failed with an unexpected error. Here is the traceback:

The command failed with an unexpected error. Here is the traceback:

cli.azure.cli.core.util : not enough values to unpack (expected 2, got 1)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 273, in shell_safe_json_parse
    return json.loads(json_or_dict_string)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 279, in shell_safe_json_parse
    return ast.literal_eval(json_or_dict_string)
  File "/usr/lib/python3.8/ast.py", line 59, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IktYbjY3QnJtMjY0UktPck9RdzVMM21IY2ZTUXhlV2Frd0RjTEtSRTRFa2siLCJhbGciOiJSUzI1NiIsIng1dCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCIsImtpZCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC85Mjk1ZDA3Ny01NTYzLTRjMmQtOTQ1Ni1iZTVjM2FkOWY0ZWMvIiwiaWF0IjoxNzE1NjMxNDczLCJuYmY<SCRAPED>lIjoiUHJlbWt1bWFyLlNlbHZhcmFqQGVsZWt0YS5jb20iLCJ1cG4iOiJQcmVta3VtYXIuU2VsdmFyYWpAZWxla3RhLmNvbSIsInV0aSI6ImZIQlVpN2UtekVlS2QxTXdCVUYxQUEiLCJ2ZXIiOiIxLjAiLCJ3aWRzIjpbImI3OWZiZjRkLTNlZjktNDY4OS04MTQzLTc2YjE5NGU4NTUwOSJdLCJ4bXNfdGNkdCI6MTM5NTY2NTU2MSwieG1zX3RkYnIiOiJFVSJ9.euEoBGwfnox7EAJvaCDTdkQntPRNXyeiGCjyooTaxowSdsHgGtQj-gXCAnAIx3-dJHZKAgFNcHGDOz8ZWIXlWSUPBMA_oYxmqldjH2-qd0p2_rzKlU1R4bay5H2vFJocvSTn6a-NxLthRBgpAVD-54xCP_N9t_NI_SsGc7u78rMF5zzy8uGIqLB4XqvTq3_asL17fLlQP5_U4eJQq74Meciti_bNV3OYpdZdHoSAKtqHzXaIQpKMAlemFqbl4O_HSkMluaBsRSV9p86S8Je-m5TkghNdNWEvor4kWecCcgwdpf-STh5mrIEAB-RLVulgiNahXhf9DlYL2OPt_g997Q
                 ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 542, in send_raw_request
    temp = shell_safe_json_parse(s)
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 281, in shell_safe_json_parse
    raise CLIError(json_ex)
knack.util.CLIError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 608, in execute
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 666, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 659, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 636, in _run_job
    result = cmd_copy(params)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 306, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 493, in default_command_handler
    return op(**command_args)
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/resource/custom.py", line 2036, in rest_call
    r = send_raw_request(cmd.cli_ctx, method, uri, headers, uri_parameters, body,
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 545, in send_raw_request
    key, value = s.split('=', 1)
ValueError: not enough values to unpack (expected 2, got 1)
not enough values to unpack (expected 2, got 1)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 273, in shell_safe_json_parse
    return json.loads(json_or_dict_string)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 279, in shell_safe_json_parse
    return ast.literal_eval(json_or_dict_string)
  File "/usr/lib/python3.8/ast.py", line 59, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python3.8/ast.py", line 47, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJub25jZSI6IktYbjY3QnJtMjY0UktPck9RdzVMM21IY2ZTUXhlV2Frd0RjTEtSRTRFa2siLCJhbGciOiJSUzI1NiIsIng1dCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCIsImtpZCI6IkwxS2ZLRklfam5YYndXYzIyeFp4dzFzVUhIMCJ9.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC85Mjk1ZDA3Ny01NTYzLTRjMmQtOTQ1Ni1iZTVjM2FkOWY0ZWMvIiwiaWF0IjoxNzE1NjMxNDczLCJuYmYiOjE3MTU2MzE0NzMsImV4cCI6MTcxNTYzNjk0MywiYWNjdCI6MCwiYWNyIjoiMSIsImFjcnMiOlsidXJuOnVzZXI6cmVnaXN0ZXJzZWN1cml0eWluZm8iXSwiYWlvIjoiQVZRQXEvOFdBQUFBb3BFQU1ORUZaYWtHYjBhcmxEej<SCRAPEDImI3OWZiZjRkLTNlZjktNDY4OS04MTQzLTc2YjE5NGU4NTUwOSJdLCJ4bXNfdGNkdCI6MTM5NTY2NTU2MSwieG1zX3RkYnIiOiJFVSJ9.euEoBGwfnox7EAJvaCDTdkQntPRNXyeiGCjyooTaxowSdsHgGtQj-gXCAnAIx3-dJHZKAgFNcHGDOz8ZWIXlWSUPBMA_oYxmqldjH2-qd0p2_rzKlU1R4bay5H2vFJocvSTn6a-NxLthRBgpAVD-54xCP_N9t_NI_SsGc7u78rMF5zzy8uGIqLB4XqvTq3_asL17fLlQP5_U4eJQq74Meciti_bNV3OYpdZdHoSAKtqHzXaIQpKMAlemFqbl4O_HSkMluaBsRSV9p86S8Je-m5TkghNdNWEvor4kWecCcgwdpf-STh5mrIEAB-RLVulgiNahXhf9DlYL2OPt_g997Q
                 ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 542, in send_raw_request
    temp = shell_safe_json_parse(s)
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 281, in shell_safe_json_parse
    raise CLIError(json_ex)
knack.util.CLIError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 608, in execute
    raise ex
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 666, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 659, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 636, in _run_job
    result = cmd_copy(params)
  File "/usr/lib/python3/dist-packages/azure/cli/core/commands/__init__.py", line 306, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/azure/cli/core/__init__.py", line 493, in default_command_handler
    return op(**command_args)
  File "/usr/lib/python3/dist-packages/azure/cli/command_modules/resource/custom.py", line 2036, in rest_call
    r = send_raw_request(cmd.cli_ctx, method, uri, headers, uri_parameters, body,
  File "/usr/lib/python3/dist-packages/azure/cli/core/util.py", line 545, in send_raw_request
    key, value = s.split('=', 1)
ValueError: not enough values to unpack (expected 2, got 1)

Expected behavior

The command should execute flawlessly similar to 'curl' or 'invoke-restmethod'

Environment Summary

AZ Version:

{
  "azure-cli": "2.0.81",
  "azure-cli-core": "2.0.81",
  "azure-cli-telemetry": "1.0.4",
  "extensions": {
    "azure-devops": "0.17.0"
  }

Additional context

No response

azure-client-tools-bot-prd[bot] commented 4 months ago

Hi @CybercrawlerS,

This is not the official Azure CLI published by Microsoft.

How to tell if the installed Azure CLI is unofficial:

Please follow https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux to install Microsoft official Azure CLI.

If you feel that further discussion is needed, please add a comment with the text /clibot unresolve to reopen the issue.

yonzhan commented 4 months ago

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

azure-client-tools-bot-prd[bot] commented 4 months ago
Hi @CybercrawlerS Find similar issue https://github.com/Azure/azure-cli/issues/11552.
Issue title Error configuration function app with powershell object for --settings
Create time 2019-12-11
Comment number 7

Possible solution: The error message "not enough values to unpack (expected 2, got 1)" is usually caused by an incorrect JSON format. In the existing issue, the solution was to use the correct JSON format inside the JSON file. You can try using the same solution by creating a JSON file with the correct format and then running the command az functionapp config appsettings set --name <appname> -g <resourcegroup> --settings .json with the JSON file as the value for the --settings parameter.

Make sure that the JSON file is in the correct path and that the name of the file matches the name given to the --settings parameter. Also, check the structure of your JSON file to ensure it has the schema similar to what is exported from Azure Portal. You can export existing application settings from the Azure function.


Please confirm if this resolves your issue.

CybercrawlerS commented 4 months ago

No, The problem is not resolved.

On Mon, May 13, 2024 at 9:56 PM azure-client-tools-bot-prd[bot] < @.***> wrote:

Hi @CybercrawlerS https://github.com/CybercrawlerS Find similar issue #11552 https://github.com/Azure/azure-cli/issues/11552. Issue title Error configuration function app with powershell object for --settings Create time 2019-12-11 Comment number 7

Possible solution: The error message "not enough values to unpack (expected 2, got 1)" is usually caused by an incorrect JSON format. In the existing issue, the solution was to use the correct JSON format inside the JSON file. You can try using the same solution by creating a JSON file with the correct format and then running the command az functionapp config appsettings set --name

-g --settings .json with the JSON file as the value for the --settings parameter. Make sure that the JSON file is in the correct path and that the name of the file matches the name given to the --settings parameter. Also, check the structure of your JSON file to ensure it has the schema similar to what is exported from Azure Portal. You can export existing application settings from the Azure function. ------------------------------ Please confirm if this resolves your issue. — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you were mentioned.Message ID: ***@***.***>

-- Warm regards, Premkumar Selvaraj