question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Impossible to `az network vnet update --dns-servers` if you haven't first set a Custom DNS server from the portal.

See original GitHub issue

Hello 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:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tjprescottcommented, Oct 31, 2017

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:

dhcpOptions: {
   dnsServers: []
}

Which is why I couldn’t reproduce. I’ll get this fix into the next release (mid-November)

0reactions
jjindrichcommented, Nov 30, 2022

In powershell is not working az network vnet update -g myrg -n myvnet --dns-servers ‘’

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found