Setting Up Pi-Hole on Azure VM as Home DNS Server

Jordan Stubblefield
3 min readNov 21, 2023

--

The goal here is to create a Pi-Hole instance in Azure that we can then point our home router to in order to resolve DNS queries. Using Virtual Machines is perhaps the lowest barrier to entry to accomplish this.

Step 1: Create Azure Virtual Machine

This tutorial uses the Ubuntu Server 22.04 LTS VM image

In the VM Create menu, do the following:

  1. Basics Tab: Take note of the username and password. You will use them to log in via Bastion. If you ‘d rather SSH, create an SSH key instead and use that to authenticate.
  2. Management Tab: Disable auto-shutdown
  3. Click Review + Create to create the VM.

Step 2a: Update VM Network Settings

In the Network Settings blade of your VM resource, add rules for ports 80 (TCP), 443 (TCP), 53 (UDP), and 67 (UDP). In those rules, it is wise to set the Source IP to your router IP address to limit outside traffic. Pi-Hole documentation states that these ports are required for Pi-Hole functionality.

VM resource network settings blade

For the sake of security, we’ll use Bastion to connect to the VM. Go to the Bastion blade of the VM resource to deploy a Bastion. Auto-configuration is fine. It will take a long time so be patient.

VM Bastion blade

Once complete, you can connect in this same blade. If you do not know your username and password, you can reset or create a new user in the Reset Password blade.

Reset Password blade

Step 3: Install Pi-Hole

Connect to the VM (we’re using Bastion) and install Pi-Hole using the Pi-Hole install documentation: https://docs.pi-hole.net/main/basic-install/.

You may need to add “sudo” before “bash”

Once installed, all you have to do is grab the VM public IP address and update your router DNS to use this public IP.

For a Verizon Fios router, the DNS setting is located under Advanced > Network Settings > Network Connections > Broadband Connection (Ethernet/Coax) Settings. Only update DNS Address 1 and leave DNS Address 2 at 0.0.0.0.

Verizon Fios G3100 Router

That’s it! Now you can open the Pi-Hole admin interface by navigating to the VM Public IP admin page at http://<VM IP>/admin. On the dashboard you can verify that it is processing DNS queries.

Summary

This is a very basic Pi-Hole setup. The advanced configuration is your preference but I hope this helps to get you started!

--

--