Impossible to `az network vnet update --dns-servers` if you haven't first set a Custom DNS server from the portal.
See original GitHub issueHello all, I have recently tried to az network vent update --dns-servers
a vnet that was using the default Azure DNS Servers. Upon doing so, the following stacktrace appears:
Dir: /home/tj/git/Movere.Dev.Builder [master]
Usr: tj - Tue 24, 1:10PM > az network vnet update --name mov-dev-we-vnet --resource-group movere-dev-we --dns-servers 172.17.32.4 8.8.8.8
'NoneType' object has no attribute 'dns_servers'
Traceback (most recent call last):
File "/usr/bin/azure-cli/lib/python3.6/site-packages/azure/cli/main.py", line 36, in main
cmd_result = APPLICATION.execute(args)
File "/usr/bin/azure-cli/lib/python3.6/site-packages/azure/cli/core/application.py", line 212, in execute
result = expanded_arg.func(params)
File "/usr/bin/azure-cli/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__
return self.handler(*args, **kwargs)
File "/usr/bin/azure-cli/lib/python3.6/site-packages/azure/cli/core/commands/arm.py", line 450, in handler
raise ex
File "/usr/bin/azure-cli/lib/python3.6/site-packages/azure/cli/core/commands/arm.py", line 405, in handler
instance = custom_function(instance, **custom_func_args)
File "/usr/bin/azure-cli/lib/python3.6/site-packages/azure/cli/command_modules/network/custom.py", line 1672, in update_vnet
instance.dhcp_options.dns_servers = dns_servers
AttributeError: 'NoneType' object has no attribute 'dns_servers'
However, executing that command once you have set any arbitrary custom DNS server from the portal will succeed. This seems like a bug, but may not be based on the verb az network UPDATE
. But I’m not sure.
If this is not the supported method to specify a DNS server for a vnet from the command line for the first time, please advise on how this should correctly be done.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Create, change, or delete an Azure virtual network
Create and delete a virtual network and change settings, like DNS servers and IP address spaces, for an existing virtual network.
Read more >I changed DNS settings, but they haven't taken effect
If you changed DNS settings, here are some common reasons that the changes haven't taken effect yet.
Read more >az cil vnet --dns-servers - Stack Overflow
I have a problem with using --dns-servers flag in az cli. When I try to update more than ...
Read more >How to Change DNS For a Domain - Namecheap
CustomDNS – if you wish to point your domain to custom nameservers (for example, your Personal DNS servers or third-party hosting nameservers if...
Read more >Your Recursive DNS Service Solution - Cisco Umbrella
If you haven't already signed up for Umbrella's recursive DNS services, ... you'll need to configure your recursive DNS to use Umbrella's DNS...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, @zimmertr thanks for that! I suspect after you run your deployments, if you show your VNET, you’ll see
dhcpOptions: null
. When the VNET is created using VNET create, you’d see:Which is why I couldn’t reproduce. I’ll get this fix into the next release (mid-November)
In powershell is not working az network vnet update -g myrg -n myvnet --dns-servers ‘’