Skip to content

[network] Fix --ttl option missing from az network private-dns record-set * add-record commands#33277

Draft
Copilot wants to merge 2 commits intodevfrom
copilot/fix-ttl-option-private-dns
Draft

[network] Fix --ttl option missing from az network private-dns record-set * add-record commands#33277
Copilot wants to merge 2 commits intodevfrom
copilot/fix-ttl-option-private-dns

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 28, 2026

Related command
az network private-dns record-set {a,aaaa,cname,mx,ptr,srv,txt} add-record
az network private-dns record-set cname set-record

Description

--ttl was silently absent from all private-dns record-set * add-record subcommands, causing unrecognized arguments: --ttl 600 at runtime despite the option being documented and supported on the equivalent public DNS commands.

  • _params.py: Register --ttl argument in the add-record context for all record types (a, aaaa, cname, mx, ptr, srv, txt) and for cname set-record
  • custom.py: Add ttl=None to _privatedns_add_save_record() and all add_privatedns_*_record() functions; when provided, TTL overrides the existing value (consistent with public DNS module behavior)

Testing Guide

# Before fix: fails with "unrecognized arguments: --ttl 600"
# After fix: creates record set with ttl=600
az network private-dns record-set a add-record \
  -g MyResourceGroup -z www.mysite.com \
  -n MyRecordSet -a 10.0.0.1 --ttl 600

New playback test test_add_record_with_ttl validates that the TTL value is correctly propagated in the API request and reflected in the response.

History Notes

[network] az network private-dns record-set {a,aaaa,cname,mx,ptr,srv,txt} add-record: Add --ttl option to set record set TTL (time-to-live) when adding records


This checklist is used to make sure that common guidelines for a pull request are followed.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • azcliprod.blob.core.windows.net
    • Triggering command: /usr/bin/python python -m pytest src/azure-cli/azure/cli/command_modules/privatedns/tests/latest/test_privatedns_commands.py::PrivateDnsRecordSetsTests::test_add_record_when_record_set_is_empty -x --tb=short -q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Apr 28, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented Apr 28, 2026

⚠️AzureCLI-BreakingChangeTest
⚠️privatedns
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd network private-dns record-set a add-record cmd network private-dns record-set a add-record added parameter ttl
⚠️ 1006 - ParaAdd network private-dns record-set aaaa add-record cmd network private-dns record-set aaaa add-record added parameter ttl
⚠️ 1006 - ParaAdd network private-dns record-set cname set-record cmd network private-dns record-set cname set-record added parameter ttl
⚠️ 1006 - ParaAdd network private-dns record-set mx add-record cmd network private-dns record-set mx add-record added parameter ttl
⚠️ 1006 - ParaAdd network private-dns record-set ptr add-record cmd network private-dns record-set ptr add-record added parameter ttl
⚠️ 1006 - ParaAdd network private-dns record-set srv add-record cmd network private-dns record-set srv add-record added parameter ttl
⚠️ 1006 - ParaAdd network private-dns record-set txt add-record cmd network private-dns record-set txt add-record added parameter ttl

Copilot AI changed the title [WIP] Fix --ttl option for A records in private DNS [network] Fix --ttl option missing from az network private-dns record-set * add-record commands Apr 28, 2026
Copilot AI requested a review from a0x1ab April 28, 2026 07:59
@a0x1ab
Copy link
Copy Markdown
Member

a0x1ab commented Apr 28, 2026

@copilot I am still seeing errors. Are you sure the changes are correct?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 28, 2026

@copilot I am still seeing errors. Are you sure the changes are correct?

The changes in this PR are correct — the fix hasn't been released yet, so if you're running azure-cli 2.85.0 you'll still see the error.

To verify the fix locally, install directly from this branch:

pip install -e "git+https://github.com/Azure/azure-cli.git@copilot/fix-ttl-option-private-dns#egg=azure-cli&subdirectory=src/azure-cli"

Or clone the repo and run pip install -e src/azure-cli. After that, az network private-dns record-set a add-record --help will show --ttl and the command will accept it:

--ttl  : Record set TTL (time-to-live)

All 22 unit tests (including the new test_add_record_with_ttl) pass against the patched code.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • azcliprod.blob.core.windows.net
    • Triggering command: /usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli network private-dns record-set a add-record --help (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--ttl option does not work when adding A records to private DNS with latest azure cli.

3 participants