Closed MatthijsvdVeer closed 4 years ago
Hi @MatthijsvdVeer , thanks for submitting this issue. There is an ongoing problem in CloudShell, the workaround is to run 'az login' prior to running the command. That should resolve your problem. Please give it a try.
Hi @digimaun, I tried your workaround and it works. Thanks for that. Is there a fix in the making, and will you leave this issue open until that's released? I just noticed another similar issue that's closed.
There is a highly referenced issue thread we have been linking to bring more visibility here https://github.com/Azure/azure-cli/issues/11749. A fix is in the making to resolve this pain point - but I can't speak to when that will be available. We will leave this open until the fix is released.
I'm happy to follow up that the cloudshell issue should be fixed for digital twins. You should no longer need to az login
prior to running the data plane az dt [model, twin, route]
commands in cloudshell.
Closing this issue. If you still run into issues, we can re-open.
Describe the bug
When running the command
az dt route list -m <adt-instance-name>
I get the below error. Otheraz dt
commands are working.Command Name
az dt route list Extension Name: azure-iot. Version: 0.9.7.
Errors:
To Reproduce:
Steps to reproduce the behaviour. Note that argument values have been redacted, as they may contain sensitive information.
az dt route list -n {adt-instance-name} -g {resource group} --debug
This is the debug ouput (some data redacted):The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.util : 400 Client Error: Bad Request for url: http://localhost:50342/oauth2/token Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 654, in execute raise ex File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 718, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 711, in _run_job six.reraise(sys.exc_info()) File "/opt/az/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 701, in _run_job result = list(result) File "/opt/az/lib/python3.6/site-packages/msrest/paging.py", line 143, in next self.advance_page() File "/opt/az/lib/python3.6/site-packages/msrest/paging.py", line 129, in advance_page self._response = self._get_next(self.next_link) File "/home/{REDACTED}/.azure/cliextensions/azure-iot/azext_iot/sdk/digitaltwins/operations/event_routes_operations.py", line 93, in internal_paging response = self._client.send(request, stream=False, operation_config) File "/opt/az/lib/python3.6/site-packages/msrest/service_client.py", line 336, in send pipeline_response = self.config.pipeline.run(request, kwargs) File "/opt/az/lib/python3.6/site-packages/msrest/pipeline/init.py", line 197, in run return first_node.send(pipeline_request, kwargs) # type: ignore File "/opt/az/lib/python3.6/site-packages/msrest/pipeline/init.py", line 150, in send response = self.next.send(request, kwargs) File "/opt/az/lib/python3.6/site-packages/msrest/pipeline/requests.py", line 65, in send self._creds.signed_session(session) File "/home/{REDACTED}/.azure/cliextensions/azure-iot/azext_iot/digitaltwins/providers/auth.py", line 31, in signed_session return self.refresh_session(session) File "/home/{REDACTED}/.azure/cliextensions/azure-iot/azext_iot/digitaltwins/providers/auth.py", line 47, in refresh_session session.headers["Authorization"] = self.generate_token() File "/home/{REDACTED}/.azure/cliextensions/azure-iot/azext_iot/digitaltwins/providers/auth.py", line 54, in generate_token creds, subscription, tenant = profile.get_raw_token(resource=self.resource_id) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 643, in get_raw_token creds = self._get_token_from_cloud_shell(resource) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 391, in _get_token_from_cloud_shell auth = MSIAuthenticationWrapper(resource=resource) File "/opt/az/lib/python3.6/site-packages/msrestazure/azure_active_directory.py", line 592, in init self.set_token() File "/opt/az/lib/python3.6/site-packages/msrestazure/azure_active_directory.py", line 598, in settoken self.scheme, , self.token = get_msi_token(self.resource, self.port, self.msi_conf) File "/opt/az/lib/python3.6/site-packages/msrestazure/azure_active_directory.py", line 486, in get_msi_token result.raise_for_status() File "/opt/az/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:50342/oauth2/token 400 Client Error: Bad Request for url: http://localhost:50342/oauth2/token Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 654, in execute raise ex File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 718, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 711, in _run_job six.reraise(sys.exc_info()) File "/opt/az/lib/python3.6/site-packages/six.py", line 703, in reraise raise value File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/init.py", line 701, in _run_job result = list(result) File "/opt/az/lib/python3.6/site-packages/msrest/paging.py", line 143, in next self.advance_page() File "/opt/az/lib/python3.6/site-packages/msrest/paging.py", line 129, in advance_page self._response = self._get_next(self.next_link) File "/home/{REDACTED}/.azure/cliextensions/azure-iot/azext_iot/sdk/digitaltwins/operations/event_routes_operations.py", line 93, in internal_paging response = self._client.send(request, stream=False, operation_config) File "/opt/az/lib/python3.6/site-packages/msrest/service_client.py", line 336, in send pipeline_response = self.config.pipeline.run(request, kwargs) File "/opt/az/lib/python3.6/site-packages/msrest/pipeline/init.py", line 197, in run return first_node.send(pipeline_request, kwargs) # type: ignore File "/opt/az/lib/python3.6/site-packages/msrest/pipeline/init.py", line 150, in send response = self.next.send(request, kwargs) File "/opt/az/lib/python3.6/site-packages/msrest/pipeline/requests.py", line 65, in send self._creds.signed_session(session) File "/home/{REDACTED}/.azure/cliextensions/azure-iot/azext_iot/digitaltwins/providers/auth.py", line 31, in signed_session return self.refresh_session(session) File "/home/{REDACTED}/.azure/cliextensions/azure-iot/azext_iot/digitaltwins/providers/auth.py", line 47, in refresh_session session.headers["Authorization"] = self.generate_token() File "/home/{REDACTED}/.azure/cliextensions/azure-iot/azext_iot/digitaltwins/providers/auth.py", line 54, in generate_token creds, subscription, tenant = profile.get_raw_token(resource=self.resource_id) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 643, in get_raw_token creds = self._get_token_from_cloud_shell(resource) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 391, in _get_token_from_cloud_shell auth = MSIAuthenticationWrapper(resource=resource) File "/opt/az/lib/python3.6/site-packages/msrestazure/azure_active_directory.py", line 592, in init self.set_token() File "/opt/az/lib/python3.6/site-packages/msrestazure/azure_active_directory.py", line 598, in settoken self.scheme, , self.token = get_msi_token(self.resource, self.port, self.msi_conf) File "/opt/az/lib/python3.6/site-packages/msrestazure/azure_active_directory.py", line 486, in get_msi_token result.raise_for_status() File "/opt/az/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:50342/oauth2/token cli.azure.cli.core.util : To open an issue, please run: 'az feedback'
To open an issue, please run: 'az feedback' Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f159cf1ee18>] az_command_data_logger : exit code: 1 telemetry.save : Save telemetry record of length 5437 in cache telemetry.check : Negative: The /home/{REDACTED}/.azure/telemetry.txt was modified at 2020-08-11 13:01:55.345532, which in less than 600.000000 s Command ran in 0.543 seconds (init: 0.045, invoke: 0.498)
Linux-4.15.0-1092-azure-x86_64-with-debian-stretch-sid (Cloud Shell) Python 3.6.10 Installer: DEB
azure-cli 2.9.1 *
Extensions: azure-iot 0.9.7