{"slug":"access-azure-linux-vms-privately-using-tailscale","title":"Access Azure Linux VMs privately using Tailscale","tags":["tailscale","access-control","setup"],"agent_summary":"Last validated: Jan 5, 2026","trigger_phrases":[],"runnable":false,"markdown":"\r\n# Access Azure Linux VMs privately using Tailscale\r\n\r\nLast validated: Jan 5, 2026\r\n\r\nMicrosoft Azure is a cloud service provider offering Linux and Windows virtual machines, to which Tailscale can be used to provide secure connectivity. This topic covers Linux VMs running within Azure. For Windows VMs, refer to [Access Azure Windows VMs privately using Tailscale](https://tailscale.com/docs/install/cloud/azure/windows).\r\n\r\n## [Prerequisites](https://tailscale.com/docs/install/cloud/azure/linux\\#prerequisites)\r\n\r\nBefore you begin this guide, you'll need a Tailscale network set up and\r\nconfigured with at least one existing device. Read our [getting started guide](https://tailscale.com/docs/how-to/quickstart)\r\nif you need help with this.\r\n\r\n## [Step 1: Set up the Tailscale client for Linux VMs](https://tailscale.com/docs/install/cloud/azure/linux\\#step-1-set-up-the-tailscale-client-for-linux-vms)\r\n\r\nFirst, [create a Virtual Machine in the Azure Portal](https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.Compute%2FVirtualMachines)\r\nrunning Linux. Tailscale supports [many of the Linux distributions](https://tailscale.com/docs/install/linux)\r\noffered by Azure Marketplace images.\r\n\r\nIf at least one side of a tunnel has \"easy NAT,\" where Tailscale can determine the UDP port\r\nnumber on the far side of the NAT device, then it will make\r\n[direct connections to minimize latency.](https://tailscale.com/blog/how-tailscale-works)\r\nWe ensure that the Azure nodes can make direct connections by allowing UDP port 41641 to\r\ningress through the firewall.\r\n\r\nIn the Networking step of setting up the VM, choose Advanced for the NIC network security group\r\nand create a network security policy to allow UDP port 41641 to ingress.\r\n\r\n![Network Security Group allow port 41641](https://tailscale.com/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fnetwork-security-group.079689c7.jpg&w=3840&q=75)\r\n\r\nThen SSH to the system and follow the steps to\r\n[install Tailscale on Linux](https://tailscale.com/docs/install/linux).\r\n\r\n## [Step 2: Advertise routes from the VM](https://tailscale.com/docs/install/cloud/azure/linux\\#step-2-advertise-routes-from-the-vm)\r\n\r\nFor the benefit of the _other_ nodes in the tailnet we'll set up\r\n[split DNS](https://tailscale.com/docs/reference/dns-in-tailscale#tailscale-dns-settings) to allow\r\nuse of the same DNS names as are used inside of Azure. The\r\n[Azure DNS server address is 168.63.129.16](https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-name-resolution-for-vms-and-role-instances#azure-provided-name-resolution), which is an anycast address that will go\r\nto the nearest DNS server within Azure.\r\n\r\nWe'll have our VM advertise routes for both the subnet it sits on as well as the Azure DNS\r\nserver. For example, if the subnet address range is 10.1.0.0/24, the command would be:\r\n\r\n```shell\r\ntailscale set --advertise-routes=10.1.0.0/24,168.63.129.16/32 --accept-dns=false\r\n```\r\n\r\nFor Azure VMs it is generally best to let Azure handle the DNS configuration,\r\nnot have Tailscale override it, so we added `--accept-dns=false`.\r\n\r\n## [Step 3: Add Azure DNS for your tailnet](https://tailscale.com/docs/install/cloud/azure/linux\\#step-3-add-azure-dns-for-your-tailnet)\r\n\r\nIn the [DNS](https://login.tailscale.com/admin/dns) page of the admin console we add a nameserver\r\nrestricted to the `internal.cloudapp.net` domain, pointing to the Azure DNS server which we\r\nmade available through our VM.\r\n\r\n![Adding a Split DNS resolver for internal.cloudapp.net](https://tailscale.com/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fazure-add-DNS.35617d9c.jpg&w=3840&q=75)\r\n\r\nNow the same hostnames which work between nodes running within Azure will also be available\r\nto all nodes on our tailnet.\r\n\r\n## [Step 4: Remove public SSH access](https://tailscale.com/docs/install/cloud/azure/linux\\#step-4-remove-public-ssh-access)\r\n\r\nAs we can now SSH to the system over the private Tailscale network, there is no reason to leave\r\nthe SSH port open on a public IP address. In the Settings > Network tab select the ingress\r\nrule for \"SSH\" and delete it.\r\n\r\n![Disable public SSH port.](https://tailscale.com/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fazure-disable-ssh.a5877f02.jpg&w=3840&q=75)\r\n\r\n![Project Logo](https://cdn.brandfetch.io/tailscale.com/fallback/lettermark/theme/dark/h/256/w/256/icon?c=1bfwsmEH20zzEfSNTed)\r\n\r\nAsk AI\r\n\r\nreCAPTCHA\r\n\r\nRecaptcha requires verification.\r\n\r\nprotected by **reCAPTCHA**\r\n","html":"<h1>Access Azure Linux VMs privately using Tailscale</h1>\n<p>Last validated: Jan 5, 2026</p>\n<p>Microsoft Azure is a cloud service provider offering Linux and Windows virtual machines, to which Tailscale can be used to provide secure connectivity. This topic covers Linux VMs running within Azure. For Windows VMs, refer to <a href=\"https://tailscale.com/docs/install/cloud/azure/windows\">Access Azure Windows VMs privately using Tailscale</a>.</p>\n<h2><a href=\"https://tailscale.com/docs/install/cloud/azure/linux#prerequisites\">Prerequisites</a></h2>\n<p>Before you begin this guide, you'll need a Tailscale network set up and\r\nconfigured with at least one existing device. Read our <a href=\"https://tailscale.com/docs/how-to/quickstart\">getting started guide</a>\r\nif you need help with this.</p>\n<h2><a href=\"https://tailscale.com/docs/install/cloud/azure/linux#step-1-set-up-the-tailscale-client-for-linux-vms\">Step 1: Set up the Tailscale client for Linux VMs</a></h2>\n<p>First, <a href=\"https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.Compute%2FVirtualMachines\">create a Virtual Machine in the Azure Portal</a>\r\nrunning Linux. Tailscale supports <a href=\"https://tailscale.com/docs/install/linux\">many of the Linux distributions</a>\r\noffered by Azure Marketplace images.</p>\n<p>If at least one side of a tunnel has \"easy NAT,\" where Tailscale can determine the UDP port\r\nnumber on the far side of the NAT device, then it will make\r\n<a href=\"https://tailscale.com/blog/how-tailscale-works\">direct connections to minimize latency.</a>\r\nWe ensure that the Azure nodes can make direct connections by allowing UDP port 41641 to\r\ningress through the firewall.</p>\n<p>In the Networking step of setting up the VM, choose Advanced for the NIC network security group\r\nand create a network security policy to allow UDP port 41641 to ingress.</p>\n<p><img src=\"https://tailscale.com/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fnetwork-security-group.079689c7.jpg&#x26;w=3840&#x26;q=75\" alt=\"Network Security Group allow port 41641\"></p>\n<p>Then SSH to the system and follow the steps to\r\n<a href=\"https://tailscale.com/docs/install/linux\">install Tailscale on Linux</a>.</p>\n<h2><a href=\"https://tailscale.com/docs/install/cloud/azure/linux#step-2-advertise-routes-from-the-vm\">Step 2: Advertise routes from the VM</a></h2>\n<p>For the benefit of the <em>other</em> nodes in the tailnet we'll set up\r\n<a href=\"https://tailscale.com/docs/reference/dns-in-tailscale#tailscale-dns-settings\">split DNS</a> to allow\r\nuse of the same DNS names as are used inside of Azure. The\r\n<a href=\"https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-name-resolution-for-vms-and-role-instances#azure-provided-name-resolution\">Azure DNS server address is 168.63.129.16</a>, which is an anycast address that will go\r\nto the nearest DNS server within Azure.</p>\n<p>We'll have our VM advertise routes for both the subnet it sits on as well as the Azure DNS\r\nserver. For example, if the subnet address range is 10.1.0.0/24, the command would be:</p>\n<pre><code class=\"language-shell\">tailscale set --advertise-routes=10.1.0.0/24,168.63.129.16/32 --accept-dns=false\n</code></pre>\n<p>For Azure VMs it is generally best to let Azure handle the DNS configuration,\r\nnot have Tailscale override it, so we added <code>--accept-dns=false</code>.</p>\n<h2><a href=\"https://tailscale.com/docs/install/cloud/azure/linux#step-3-add-azure-dns-for-your-tailnet\">Step 3: Add Azure DNS for your tailnet</a></h2>\n<p>In the <a href=\"https://login.tailscale.com/admin/dns\">DNS</a> page of the admin console we add a nameserver\r\nrestricted to the <code>internal.cloudapp.net</code> domain, pointing to the Azure DNS server which we\r\nmade available through our VM.</p>\n<p><img src=\"https://tailscale.com/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fazure-add-DNS.35617d9c.jpg&#x26;w=3840&#x26;q=75\" alt=\"Adding a Split DNS resolver for internal.cloudapp.net\"></p>\n<p>Now the same hostnames which work between nodes running within Azure will also be available\r\nto all nodes on our tailnet.</p>\n<h2><a href=\"https://tailscale.com/docs/install/cloud/azure/linux#step-4-remove-public-ssh-access\">Step 4: Remove public SSH access</a></h2>\n<p>As we can now SSH to the system over the private Tailscale network, there is no reason to leave\r\nthe SSH port open on a public IP address. In the Settings > Network tab select the ingress\r\nrule for \"SSH\" and delete it.</p>\n<p><img src=\"https://tailscale.com/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fazure-disable-ssh.a5877f02.jpg&#x26;w=3840&#x26;q=75\" alt=\"Disable public SSH port.\"></p>\n<p><img src=\"https://cdn.brandfetch.io/tailscale.com/fallback/lettermark/theme/dark/h/256/w/256/icon?c=1bfwsmEH20zzEfSNTed\" alt=\"Project Logo\"></p>\n<p>Ask AI</p>\n<p>reCAPTCHA</p>\n<p>Recaptcha requires verification.</p>\n<p>protected by <strong>reCAPTCHA</strong></p>\n"}