I have several hundred vNets over several hundred subscriptions.
We have updated the IP of our DNS server that we use in the vNet of each subscription.
I would like to use Powershell to check each vNet in each Subscription for the list of DNS servers and if one of the IP's in the list matches, then change it to the new IP.
Im able to use powershell to get the DNS servers with:
$vnet = Get-AzVirtualNetwork -resourcegroup "ResGroup" -name "VNETNAME"
$vnet.DhcpOptions.DnsServers
I can change the DNSservers in the object with $vnet.DhcpOptions.DnsServers += "IP_address"
But how do I push the change to Azure ?