Open Amrish-Sharma opened 10 months ago
Hi @Amrish-Sharma Find similar issue https://github.com/Azure/azure-cli/issues/21247. | ||
---|---|---|
Issue title | az login: Failed to establish a new connection: [Errno -2] Name does not resolve | |
Create time | 2022-02-10 | |
Comment number | 14 |
Please confirm if this resolves your issue.
Thank you for opening this issue, we will look into it.
Hi @Amrish-Sharma, by Failed to establish a new connection: [Errno -2] Name or service not known
, we do mean that the keyvault or secret doesn't exist. Are you unhappy with the error message?
Hi @evelyn-ys thanks for confirmation.
But this error is pretty generic and often confuses that there is some issue with either network or user-code.
Can we please have message instead that clarifies particular keyvault or secret is not present
I get the same issue trying to create a secret in a new vault: $ az keyvault secret set --vault-name $KEYVAULT_NAME --name Username --value Conny <urllib3.connection.HTTPSConnection object at 0x7fbb215407f0>: Failed to establish a new connection: [Errno -2] Name or service not known Same result from my laptop or in a Cloud Shell. $ host $KEYVAULT_NAME results in alist of aliases and eventually an ip-adress so it really does exists
Describe the bug
I have got a script which was working fine for az cli 2.34.1(2 years back) but when we checked now(with the same version as well as upgraded version we are facing error
az keyvault secret show --debug --name SECRET_NAME --vault-name VAULT_NAME
this is script_snippet for your referrence
In else, we have checker for failed_kv to create this secret values
But when we are trying to run this we got below error
/
Related command
az keyvault secret show --name SECRET_NAME --vault-name VAULT_NAME
Errors
<urllib3.connection.HTTPSConnection object at 0x7f768aadd0d0>: Failed to establish a new connection: [Errno -2] Name or service not known
Issue script & Debug output
cli.knack.log: File logging enabled - writing logs to '/home/codebuzz/.azure/logs'. cli.knack.cli: Command arguments: ['keyvault', 'secret', 'show', '--debug', '--name', 'SPClientSecret', '--vault-name', 'CE-management-TEST-kv'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f916412d3a0>, <function OutputProducer.on_global_arguments at 0x7f91640d1da0>, <function CLIQuery.on_global_arguments at 0x7f916410b880>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'keyvault': ['azure.cli.command_modules.keyvault'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: keyvault 0.031 20 113 cli.azure.cli.core: Total (1) 0.031 20 113 cli.azure.cli.core: Loaded 20 groups, 113 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : keyvault secret show cli.azure.cli.core: Command table: keyvault secret show cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f9162ff8c20>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/codebuzz/.azure/commands/2024-01-02.21-47-30.keyvault_secret_show.76214.log'. az_command_data_logger: command args: keyvault secret show --debug --name {} --vault-name {} cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f916306cea0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f916306cf40>, <function register_cache_arguments..add_cache_arguments at 0x7f916306d080>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f91640d1e40>, <function CLIQuery.handle_query_parameter at 0x7f916410b920>, <function register_ids_argument..parse_ids_arguments at 0x7f916306cfe0>]
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/codebuzz/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/codebuzz/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {redacted}
msal.application: Broker enabled? False
urllib3.connectionpool: Starting new HTTPS connection (1): ce-management-test-kv.vault.azure.net:443
urllib3.connectionpool: Starting new HTTPS connection (2): ce-management-test-kv.vault.azure.net:443
urllib3.connectionpool: Starting new HTTPS connection (3): ce-management-test-kv.vault.azure.net:443
urllib3.connectionpool: Starting new HTTPS connection (4): ce-management-test-kv.vault.azure.net:443
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/keyvault/_command_type.py", line 135, in keyvault_command_handler
show_exception_handler(ex)
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/arm.py", line 429, in show_exception_handler
raise ex
File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/keyvault/_command_type.py", line 112, in keyvault_command_handler
result = op(command_args)
^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
return func(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/keyvault/secrets/_client.py", line 72, in get_secret
bundle = self._client.get_secret(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/keyvault/secrets/_generated/_operations_mixin.py", line 1640, in get_secret
return mixin_instance.get_secret(vault_base_url, secret_name, secret_version, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
return func(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/keyvault/secrets/_generated/v7_4/operations/_key_vault_client_operations.py", line 760, in get_secret
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/_base.py", line 211, in run
return first_node.send(pipeline_request) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
[Previous line repeated 2 more times]
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/policies/_redirect.py", line 158, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/policies/_retry.py", line 468, in send
raise err
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/policies/_retry.py", line 446, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/policies/_authentication.py", line 118, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/_base.py", line 71, in send
response = self.next.send(request)
^^^^^^^^^^^^^^^^^^^^^^^
[Previous line repeated 1 more time]
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/_base.py", line 103, in send
self._sender.send(request.http_request, **request.context.options),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/core/pipeline/transport/_requests_basic.py", line 361, in send
raise error
azure.core.exceptions.ServiceRequestError: <urllib3.connection.HTTPSConnection object at 0x7f91617e5010>: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) ^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/keyvault/_command_type.py", line 138, in keyvault_command_handler return keyvault_exception_handler(self.command_loader, ex) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/keyvault/_command_type.py", line 51, in keyvault_exception_handler raise CLIError(ex) knack.util.CLIError: <urllib3.connection.HTTPSConnection object at 0x7f91617e5010>: Failed to establish a new connection: [Errno -2] Name or service not known
cli.azure.cli.core.azclierror: <urllib3.connection.HTTPSConnection object at 0x7f91617e5010>: Failed to establish a new connection: [Errno -2] Name or service not known az_command_data_logger: <urllib3.connection.HTTPSConnection object at 0x7f91617e5010>: Failed to establish a new connection: [Errno -2] Name or service not known cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f9162ff8ea0>] az_command_data_logger: exit code: 1 cli.main: Command ran in 8.318 seconds (init: 0.365, invoke: 7.954) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 3634 in cache telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.11/site-packages/azure/cli/telemetry/init.py /home/codebuzz/.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process.
Expected behavior
Keyvault doesn't exist
Environment Summary
azure-cli 2.55 terraform_azurm: 3.85
Additional context
No response