Hello @TH2022 ,
Welcome to Microsoft QnA and apologies for the delay in response.
I am assuming you are trying to change the DNS server form within the VM's OS (from ncpa.cpl), however that is not recommended.
The recommended way to change the DNS settings for a VM would be to directly change the DNS IP from the nic settings via Azure Portal. Go to the VM->Networking-> Select the network interface -> DNS Servers -> Enter the custom DNS server IP.
Hope this helps. Please feel free to reach back to me via comments incase you have further queries. Thanks.