Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

az network dns zone list fails (subscription not found) for a known good subscription #27766

Open Vaevictus opened 11 months ago

Vaevictus commented 11 months ago

Describe the bug

az network dns zone list fails. I am unable to create these zones in the web portal either (they create, then when browsing to the resource they 404)

interestingly, the following command does not fail:

az network private-dns zone list [] and the web portal allows me to create private dns zones without problem.

Related command

az network dns zone list

Errors

az network dns zone list (BadRequest) The specified subscription 22b20269-XXXX-4118-a306-77649e5c75e4 does not exist Code: BadRequest Message: The specified subscription 22b20269-XXXX-4118-a306-77649e5c75e4 does not exist

az network private-dns zone list []

Issue script & Debug output

``az network dns zone list --debug cli.knack.cli: Command arguments: ['network', 'dns', 'zone', 'list', '--debug'] 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 0x7fe9eff892d0>, <function OutputProducer.on_global_arguments at 0x7fe9efe87eb0>, <function CLIQuery.on_global_arguments at 0x7fe9efed5120>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'network': ['azure.cli.command_modules.network', 'azure.cli.command_modules.privatedns'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: network 0.570 112 348 cli.azure.cli.core: privatedns 0.005 14 66 cli.azure.cli.core: Total (2) 0.575 126 414 cli.azure.cli.core: Loaded 125 groups, 414 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : network dns zone list cli.azure.cli.core: Command table: network dns zone list cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fe9eecfe9e0>] cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7fe9eed13520>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7fe9eed61480>, <function register_cache_arguments..add_cache_arguments at 0x7fe9eed615a0>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fe9efe87f40>, <function CLIQuery.handle_query_parameter at 0x7fe9efed51b0>, <function register_ids_argument..parse_ids_arguments at 0x7fe9eed61510>] cli.azure.cli.core.commands.client_factory: Getting management service client client_type=DnsManagementClient cli.azure.cli.core.auth.persistence: build_persistence: location='/home/craig/.azure/msal_token_cache.json', encrypt=False cli.azure.cli.core.auth.binary_cache: load: /home/craig/.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 = {'token_endpoint': 'https://login.microsoftonline.com/0a523852-1ccb-4ba9-9854-8f6598597ff5/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/0a523852-1ccb-4ba9-9854-8f6598597ff5/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/0a523852-1ccb-4ba9-9854-8f6598597ff5/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/0a523852-1ccb-4ba9-9854-8f6598597ff5/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/0a523852-1ccb-4ba9-9854-8f6598597ff5/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/0a523852-1ccb-4ba9-9854-8f6598597ff5/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/0a523852-1ccb-4ba9-9854-8f6598597ff5/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'} msal.application: Broker enabled? False cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={} cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={} msal.application: Cache hit an AT msal.telemetry: Generate or reuse correlation_id: 8ba63f42-4ab8-4f53-909c-37e6abe2ec9f cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/22b20269-ce3e-4118-a306-77649e5c75e4/providers/Microsoft.Network/dnszones?api-version=2018-05-01' cli.azure.cli.core.sdk.policies: Request method: 'GET' cli.azure.cli.core.sdk.policies: Request headers: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json' cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '28bb9057-7b65-11ee-a7ab-9cb6d0c77287' cli.azure.cli.core.sdk.policies: 'CommandName': 'network dns zone list' cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--debug' cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.47.0 (DEB) azsdk-python-azure-mgmt-dns/8.0.0 Python/3.10.10 (Linux-6.5.0-10-generic-x86_64-with-glibc2.38)' cli.azure.cli.core.sdk.policies: 'Authorization': '*****' cli.azure.cli.core.sdk.policies: Request body: cli.azure.cli.core.sdk.policies: This request has no body urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443 urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/22b20269-ce3e-4118-a306-77649e5c75e4/providers/Microsoft.Network/dnszones?api-version=2018-05-01 HTTP/1.1" 400 112 cli.azure.cli.core.sdk.policies: Response status: 400 cli.azure.cli.core.sdk.policies: Response headers: cli.azure.cli.core.sdk.policies: 'Cache-Control': 'private' cli.azure.cli.core.sdk.policies: 'Content-Length': '112' cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8' cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff' cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains' cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '28bb9057-7b65-11ee-a7ab-9cb6d0c77287' cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-IIS/10.0' cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET' cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-resource-requests': '499' cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-resource-entities-read': '60000' cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'df12c5dd-7b42-4a8c-abd2-f07e1dde46ab' cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'FRANCESOUTH:20231104T225451Z:df12c5dd-7b42-4a8c-abd2-f07e1dde46ab' cli.azure.cli.core.sdk.policies: 'Date': 'Sat, 04 Nov 2023 22:54:50 GMT' cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {"code":"BadRequest","message":"The specified subscription 22b20269-ce3e-4118-a306-77649e5c75e4 does not exist"} cli.azure.cli.core.azclierror: Traceback (most recent call last): File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/opt/az/lib/python3.10/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.10/site-packages/azure/cli/core/commands/init.py", line 710, in _run_job result = list(result) File "/opt/az/lib/python3.10/site-packages/azure/core/paging.py", line 129, in next return next(self._page_iterator) File "/opt/az/lib/python3.10/site-packages/azure/core/paging.py", line 76, in next self._response = self._get_next(self.continuation_token) File "/opt/az/lib/python3.10/site-packages/azure/mgmt/dns/v2018_05_01/operations/_zones_operations.py", line 527, in get_next raise HttpResponseError(response=response, error_format=ARMErrorFormat) azure.core.exceptions.HttpResponseError: (BadRequest) The specified subscription 22b20269-ce3e-4118-a306-77649e5c75e4 does not exist Code: BadRequest Message: The specified subscription 22b20269-ce3e-4118-a306-77649e5c75e4 does not exist

cli.azure.cli.core.azclierror: (BadRequest) The specified subscription 22b20269-ce3e-4118-a306-77649e5c75e4 does not exist Code: BadRequest Message: The specified subscription 22b20269-ce3e-4118-a306-77649e5c75e4 does not exist az_command_data_logger: (BadRequest) The specified subscription 22b20269-ce3e-4118-a306-77649e5c75e4 does not exist Code: BadRequest Message: The specified subscription 22b20269-ce3e-4118-a306-77649e5c75e4 does not exist cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fe9eecfec20>] cli.main: Command ran in 1.461 seconds (init: 0.195, invoke: 1.266) 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 3673 in cache telemetry.check: Returns Positive. telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "/usr/bin/../../opt/az/bin/python3 /opt/az/lib/python3.10/site-packages/azure/cli/telemetry/init.py /home/craig/.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process.

Expected behavior

Expecting an empty array

Environment Summary

azure-cli 2.47.0 *

core 2.47.0 telemetry 1.0.8

Dependencies: msal 1.20.0 azure-mgmt-resource 22.0.0

Python location '/opt/az/bin/python3' Extensions directory '/home/craig/.azure/cliextensions'

Python (Linux) 3.10.10 (main, Mar 31 2023, 09:26:59) [GCC 11.3.0]

Legal docs and information: aka.ms/AzureCliLegal

You have 3 update(s) available. Consider updating your CLI installation with 'az upgrade'

Additional context

x

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

Hi @Vaevictus,

2.47.0 is not the latest Azure CLI(2.53.1).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

yonzhan commented 11 months ago

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

microsoft-github-policy-service[bot] commented 11 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dnssuppgithub.

arthurliu-db commented 11 months ago

Any updates on this? @yonzhan, @jiasli We are running into a similar issue. Our script runs 'az account list' which lists all account subscriptions that are accessible. It then goes through these subscriptions and runs az network dns zone list and then az network public-ip list However, for one of the subscriptions, it fails to run the second of the two commands.

Exception: Unexpected error: b'ERROR: (BadRequest) The specified subscription 3cbdeac4-XXXX-XXXX-XXXX-4a7a07cf0799 does not exist\nCode: BadRequest\nMessage: The specified subscription 3cbdeac4-XXXX-XXXX-XXXX-4a7a07cf0799 does not exist\n'