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 network private-dns zone import fails if zone already exists > v2.51 #27508

Closed
mikestiers-MSFT opened this issue Oct 2, 2023 · 5 comments · Fixed by #27559
Closed

az network private-dns zone import fails if zone already exists > v2.51 #27508

mikestiers-MSFT opened this issue Oct 2, 2023 · 5 comments · Fixed by #27559
Assignees
Labels
Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Network - DNS az network dns Network az network vnet/lb/nic/dns/etc... 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.

Comments

@mikestiers-MSFT
Copy link

mikestiers-MSFT commented Oct 2, 2023

Describe the bug

AZ CLI 2.53 (and possibly 2.52) fails on importing a private DNS zone if it already exists. This does not happen in 2.51.

Error: (PreconditionFailed) The Zone test.com exists already and hence cannot be created again.

In this example I just created an empty zone, exported, then imported, but the same happens if you provide a much more complicated zone file to import.

  1. Create a new private dns zone
  2. Export the zone for testing purposes
    az network private-dns zone export -g "dnstest" -n "test.com" -f export.txt
  3. Import the file
    az network private-dns zone import -g "dnstest" -n "test.com" -f export.txt

Here is the output of 2.53

== BEGINNING ZONE IMPORT: test.com ==

(PreconditionFailed) The Zone test.com exists already and hence cannot be created again.
Code: PreconditionFailed
Message: The Zone test.com exists already and hence cannot be created again.

Here is the output of 2.51

== BEGINNING ZONE IMPORT: test.com ==

(1/2) Imported 1 records of type 'soa' and name '@'
(2/2) Imported 1 records of type 'a' and name 'test'

== 2/2 RECORDS IMPORTED SUCCESSFULLY: 'test.com' ==

Related command

az network private-dns zone export -g "dnstest" -n "test.com" -f export.txt
az network private-dns zone import -g "dnstest" -n "test.com" -f export.txt

Errors

(PreconditionFailed) The Zone test.com exists already and hence cannot be created again.
Code: PreconditionFailed
Message: The Zone test.com exists already and hence cannot be created again.

Issue script & Debug output

PS /home/mike> az network private-dns zone import -g "dnstest" -n "test.com" -f export.txt --debug
cli.knack.cli: Command arguments: ['network', 'private-dns', 'zone', 'import', '-g', 'dnstest', '-n', 'test.com', '-f', 'export.txt', '--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 0x7f6ec83c41f0>, <function OutputProducer.on_global_arguments at 0x7f6ec82ded30>, <function CLIQuery.on_global_arguments at 0x7f6ec8276310>]
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 1.390 115 352
cli.azure.cli.core: privatedns 0.019 14 63
cli.azure.cli.core: Total (2) 1.409 129 415
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: ai-examples 0.093 1 1 /usr/lib/python3.9/site-packages/azure-cli-extensions/ai-examples
cli.azure.cli.core: Total (1) 0.093 1 1
cli.azure.cli.core: Loaded 129 groups, 416 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : network private-dns zone import
cli.azure.cli.core: Command table: network private-dns zone import
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f6ec7719430>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/mike/.azure/commands/2023-10-02.15-56-37.network_private-dns_zone_import.2473.log'.
az_command_data_logger: command args: network private-dns zone import -g {} -n {} -f {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f6ec76c4040>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f6ec76f40d0>, <function register_cache_arguments..add_cache_arguments at 0x7f6ec76fbee0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f6ec82dedc0>, <function CLIQuery.handle_query_parameter at 0x7f6ec82763a0>, <function register_ids_argument..parse_ids_arguments at 0x7f6ec76fbe50>]
cli.azure.cli.core.util: attempting to read file export.txt as utf-8-sig
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=PrivateDnsManagementClient
urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool: http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2084
msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
== BEGINNING ZONE IMPORT: test.com ==

cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool: http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2084
msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
cli.azure.cli.core.auth.adal_authentication: MSIAuthenticationWrapper.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool: http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2084
msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
cli.azure.cli.core.auth.adal_authentication: Normalize expires_on: '1696265372' -> 1696265372
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions//resourcegroups/dnstest?api-version=2022-09-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': '44179252-613c-11ee-ad66-00155de1a1b8'
cli.azure.cli.core.sdk.policies: 'CommandName': 'network private-dns zone import'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n -f --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.53.0 (RPM) azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.9.14 (Linux-5.10.102.2-microsoft-standard-x86_64-with-glibc2.35) cloud-shell/1.0'
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//resourcegroups/dnstest?api-version=2022-09-01 HTTP/1.1" 200 221
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '11997'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '7a675142-6ed4-42c0-9afe-2d375e44e0ce'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '7a675142-6ed4-42c0-9afe-2d375e44e0ce'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20231002T155638Z:7a675142-6ed4-42c0-9afe-2d375e44e0ce'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 02 Oct 2023 15:56:37 GMT'
cli.azure.cli.core.sdk.policies: 'Content-Length': '221'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"id":"/subscriptions//resourceGroups/dnstest","name":"dnstest","type":"Microsoft.Resources/resourceGroups","location":"eastus","tags":{},"properties":{"provisioningState":"Succeeded"}}
cli.azure.cli.core.aaz._arg_fmt: using location 'eastus' from resource group 'dnstest'
urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool: http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2084
msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
cli.azure.cli.core.auth.adal_authentication: MSIAuthenticationWrapper.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342
urllib3.connectionpool: http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 2084
msrestazure.azure_active_directory: MSI: Retrieving a token from http://localhost:50342/oauth2/token, with payload {'resource': 'https://management.core.windows.net/'}
cli.azure.cli.core.auth.adal_authentication: Normalize expires_on: '1696265372' -> 1696265372
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsZones/test.com?api-version=2018-09-01'
cli.azure.cli.core.sdk.policies: Request method: 'PUT'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'If-None-Match': '*'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'Content-Length': '22'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '44179252-613c-11ee-ad66-00155de1a1b8'
cli.azure.cli.core.sdk.policies: 'CommandName': 'network private-dns zone import'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n -f --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.53.0 (RPM) (AAZ) azsdk-python-core/1.26.0 Python/3.9.14 (Linux-5.10.102.2-microsoft-standard-x86_64-with-glibc2.35) cloud-shell/1.0'
cli.azure.cli.core.sdk.policies: 'Authorization': '
'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"location": "global"}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsZones/test.com?api-version=2018-09-01 HTTP/1.1" 202 2
cli.azure.cli.core.sdk.policies: Response status: 202
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': '2'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Location': 'https://management.azure.com/subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsOperationResults/RnJvbnRFbmRBc3luY09wZXJhdGlvbjtVcHNlcnRQcml2YXRlRG5zWm9uZTtlYTg5OTRjNS0zNWRlLTQ0YWUtODBhZi0yNTk1Yjk3NjRlZGRfMTY2NTlmYWUtMjY0Zi00NmMyLWFmODctMzkzMjY0Njg4NThk?api-version=2018-09-01'
cli.azure.cli.core.sdk.policies: 'Retry-After': '30'
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: 'Azure-AsyncOperation': 'https://management.azure.com:443/subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsOperationStatuses/RnJvbnRFbmRBc3luY09wZXJhdGlvbjtVcHNlcnRQcml2YXRlRG5zWm9uZTtlYTg5OTRjNS0zNWRlLTQ0YWUtODBhZi0yNTk1Yjk3NjRlZGRfMTY2NTlmYWUtMjY0Zi00NmMyLWFmODctMzkzMjY0Njg4NThk?api-version=2018-09-01'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '44179252-613c-11ee-ad66-00155de1a1b8'
cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-IIS/10.0'
cli.azure.cli.core.sdk.policies: 'X-AspNet-Version': '4.0.30319'
cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-resource-requests': '11998'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'df33098c-d1df-403d-a6c1-bbbd1ef6835f'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20231002T155638Z:df33098c-d1df-403d-a6c1-bbbd1ef6835f'
cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 02 Oct 2023 15:56:38 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {}
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com:443/subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsOperationStatuses/RnJvbnRFbmRBc3luY09wZXJhdGlvbjtVcHNlcnRQcml2YXRlRG5zWm9uZTtlYTg5OTRjNS0zNWRlLTQ0YWUtODBhZi0yNTk1Yjk3NjRlZGRfMTY2NTlmYWUtMjY0Zi00NmMyLWFmODctMzkzMjY0Njg4NThk?api-version=2018-09-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '44179252-613c-11ee-ad66-00155de1a1b8'
cli.azure.cli.core.sdk.policies: 'CommandName': 'network private-dns zone import'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n -f --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.53.0 (RPM) (AAZ) azsdk-python-core/1.26.0 Python/3.9.14 (Linux-5.10.102.2-microsoft-standard-x86_64-with-glibc2.35) cloud-shell/1.0'
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: https://management.azure.com:443 "GET /subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsOperationStatuses/RnJvbnRFbmRBc3luY09wZXJhdGlvbjtVcHNlcnRQcml2YXRlRG5zWm9uZTtlYTg5OTRjNS0zNWRlLTQ0YWUtODBhZi0yNTk1Yjk3NjRlZGRfMTY2NTlmYWUtMjY0Zi00NmMyLWFmODctMzkzMjY0Njg4NThk?api-version=2018-09-01 HTTP/1.1" 202 23
cli.azure.cli.core.sdk.policies: Response status: 202
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': '23'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Location': 'https://management.azure.com/subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsOperationResults/RnJvbnRFbmRBc3luY09wZXJhdGlvbjtVcHNlcnRQcml2YXRlRG5zWm9uZTtlYTg5OTRjNS0zNWRlLTQ0YWUtODBhZi0yNTk1Yjk3NjRlZGRfMTY2NTlmYWUtMjY0Zi00NmMyLWFmODctMzkzMjY0Njg4NThk?api-version=2018-09-01'
cli.azure.cli.core.sdk.policies: 'Retry-After': '30'
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: 'Azure-AsyncOperation': 'https://management.azure.com:443/subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsOperationStatuses/RnJvbnRFbmRBc3luY09wZXJhdGlvbjtVcHNlcnRQcml2YXRlRG5zWm9uZTtlYTg5OTRjNS0zNWRlLTQ0YWUtODBhZi0yNTk1Yjk3NjRlZGRfMTY2NTlmYWUtMjY0Zi00NmMyLWFmODctMzkzMjY0Njg4NThk?api-version=2018-09-01'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '44179252-613c-11ee-ad66-00155de1a1b8'
cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-IIS/10.0'
cli.azure.cli.core.sdk.policies: 'X-AspNet-Version': '4.0.30319'
cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-resource-requests': '497'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'd0a46544-62e6-4073-89f4-f90fab1841b9'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20231002T155639Z:d0a46544-62e6-4073-89f4-f90fab1841b9'
cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 02 Oct 2023 15:56:38 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"status":"InProgress"}
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com:443/subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsOperationStatuses/RnJvbnRFbmRBc3luY09wZXJhdGlvbjtVcHNlcnRQcml2YXRlRG5zWm9uZTtlYTg5OTRjNS0zNWRlLTQ0YWUtODBhZi0yNTk1Yjk3NjRlZGRfMTY2NTlmYWUtMjY0Zi00NmMyLWFmODctMzkzMjY0Njg4NThk?api-version=2018-09-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '44179252-613c-11ee-ad66-00155de1a1b8'
cli.azure.cli.core.sdk.policies: 'CommandName': 'network private-dns zone import'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n -f --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.53.0 (RPM) (AAZ) azsdk-python-core/1.26.0 Python/3.9.14 (Linux-5.10.102.2-microsoft-standard-x86_64-with-glibc2.35) cloud-shell/1.0'
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: https://management.azure.com:443 "GET /subscriptions//resourceGroups/dnstest/providers/Microsoft.Network/privateDnsOperationStatuses/RnJvbnRFbmRBc3luY09wZXJhdGlvbjtVcHNlcnRQcml2YXRlRG5zWm9uZTtlYTg5OTRjNS0zNWRlLTQ0YWUtODBhZi0yNTk1Yjk3NjRlZGRfMTY2NTlmYWUtMjY0Zi00NmMyLWFmODctMzkzMjY0Njg4NThk?api-version=2018-09-01 HTTP/1.1" 200 None
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'private'
cli.azure.cli.core.sdk.policies: 'Transfer-Encoding': 'chunked'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies: 'Vary': 'Accept-Encoding'
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': '44179252-613c-11ee-ad66-00155de1a1b8'
cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-IIS/10.0'
cli.azure.cli.core.sdk.policies: 'X-AspNet-Version': '4.0.30319'
cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-resource-requests': '496'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '3bee2989-22e1-4b77-9d6e-46d70073ed07'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20231002T155709Z:3bee2989-22e1-4b77-9d6e-46d70073ed07'
cli.azure.cli.core.sdk.policies: 'Date': 'Mon, 02 Oct 2023 15:57:08 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"error":{"code":"PreconditionFailed","message":"The Zone test.com exists already and hence cannot be created again."},"status":"Failed"}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.9/site-packages/azure/core/polling/base_polling.py", line 517, in run
self._poll()
File "/usr/lib64/az/lib/python3.9/site-packages/azure/core/polling/base_polling.py", line 557, in _poll
raise OperationFailed("Operation failed or canceled")
azure.core.polling.base_polling.OperationFailed: Operation failed or canceled

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_poller.py", line 45, in run
super().run()
File "/usr/lib64/az/lib/python3.9/site-packages/azure/core/polling/base_polling.py", line 535, in run
raise HttpResponseError(
azure.core.exceptions.HttpResponseError: (PreconditionFailed) The Zone test.com exists already and hence cannot be created again.
Code: PreconditionFailed
Message: The Zone test.com exists already and hence cannot be created again.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 663, in execute
raise ex
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job
result = cmd_copy(params)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 333, in call
return self.handler(*args, **kwargs)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/privatedns/custom.py", line 102, in import_zone
result = LongRunningOperation(cmd.cli_ctx)(poller)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 1013, in call
raise exception
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 1000, in call
result = poller.result()
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_poller.py", line 108, in result
self.wait(timeout)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_poller.py", line 130, in wait
raise self._exception
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_poller.py", line 94, in _start
raise error
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_poller.py", line 86, in _start
self._polling_method.run()
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_poller.py", line 50, in run
self._http_response_error_callback(err.response)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/aaz/_operation.py", line 332, in on_error
raise HttpResponseError(response=response, error_format=error_format)
azure.core.exceptions.HttpResponseError: (PreconditionFailed) The Zone test.com exists already and hence cannot be created again.
Code: PreconditionFailed
Message: The Zone test.com exists already and hence cannot be created again.

cli.azure.cli.core.azclierror: (PreconditionFailed) The Zone test.com exists already and hence cannot be created again.
Code: PreconditionFailed
Message: The Zone test.com exists already and hence cannot be created again.
az_command_data_logger: (PreconditionFailed) The Zone test.com exists already and hence cannot be created again.
Code: PreconditionFailed
Message: The Zone test.com exists already and hence cannot be created again.
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f6ec7719670>]
az_command_data_logger: exit code: 1
cli.main: Command ran in 33.302 seconds (init: 0.301, invoke: 33.001)
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 3728 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/usr/bin/python3.9 /usr/lib/az/lib/python3.9/site-packages/azure/cli/telemetry/init.py /home/mike/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

Expected behavior

In 2.51 the import process works if the zone already exists. The documentation for import also specifically states that importing to an existing zone will merge and not fail.

This happens in the portal CLI

Environment Summary

azure-cli 2.53.0

core 2.53.0
telemetry 1.1.0

Extensions:
ai-examples 0.2.5
ml 2.20.0
ssh 2.0.1

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location '/usr/bin/python3.9'
Extensions directory '/home/mike/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.9/site-packages/azure-cli-extensions'

Python (Linux) 3.9.14 (main, Feb 8 2023, 03:39:52)
[GCC 11.2.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

@mikestiers-MSFT mikestiers-MSFT added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Oct 2, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc... labels Oct 2, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Oct 2, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Oct 2, 2023

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

@yonzhan yonzhan added Service Attention This issue is responsible by Azure service team. Network - DNS az network dns and removed bug This issue requires a change to an existing behavior in the product in order to be resolved. labels Oct 2, 2023
@microsoft-github-policy-service
Copy link
Contributor

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

@microsoft-github-policy-service
Copy link
Contributor

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

@microsoft-github-policy-service
Copy link
Contributor

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

@microsoft-github-policy-service
Copy link
Contributor

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

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 Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. Network - DNS az network dns Network az network vnet/lb/nic/dns/etc... 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.
Projects
None yet
3 participants