Hi Sahar Yacout,
I have shared troubleshooting steps which I have tried from my end, it worked for me.
First log into VM, then check your DNS domain. Below is my default DNS domain.
Edit the file /etc/dhcp/dhclient.conf
and add the search domain and save the file.
append domain-search "test.example.com";
then Restart Networkmanager sudo systemctl restart NetworkManager
Now check the /etc/resolv.conf
file, search domain is successfully added to the network interface:
I have rebooted, you can see that search domain is not resetting
For more information, please visit https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/linux/custom-dns-configuration-for-azure-linux-vms?tabs=RHEL#configure-search-domains
If you have any further queries, please do let us know.
If the answer is helpful, please click "Accept Answer" and "Upvote it."