In the connected world of today you sometimes need a simple way to connect to your home IP.
There are lots of free and great Dynamic DNS services available, however, it's lots more fun to run your own with your own custom domain name. With a few simple components you can manage your own DNS zone in Azure.
Included components:
- ARM template to deploy basic infrastructure:
- Azure DNS zone for managing your domain
- Azure Blob Storage to hold function code
- Azure Function on a consumption plan to update your DNS
Current functionality is very basic, I'll be adding more in the near future. Feel free to suggest changes by forking this repo and creating a pull request or opening an issue.
To get a your own copy up and running follow these simple steps.
- Azure Powershell
- Azure Subscription
- A domain name with the ability to update the NS servers
-
Clone the repo
git clone https://github.com/Pauwelz/azure-dynamic-dns.git
-
Create Resource Group and deploy base infrastructure
cd .\azure-dynamic-dns\ $rgName = "rg-dyndns-prod" $domainName = "domain.tld" New-AzResourceGroup -Name $rgName -Location 'France Central' New-AzResourceGroupDeployment -ResourceGroupName $rgName ` -TemplateFile .\src\infra\infra.json -zoneName $domainName
-
Build and publish the function app
dotnet publish .\src\dnsmanagement\dnsmanagement.csproj -c Release Compress-Archive -Path .\src\dnsmanagement\bin\Release\net6.0\publish\* ` -DestinationPath dnsmanagement.zip -Force Publish-AzWebApp -ResourceGroupName $rgName -Name (Get-AzResourceGroupDeployment ` -ResourceGroupName $rgName -Name infra).Parameters.siteName.Value ` -ArchivePath $PWD\dnsmanagement.zip -Force
-
Get the NameServers to input in your domain management panel
(Get-AzDnsZone -Name $domainName -ResourceGroupName $rgName).NameServers | fl
This will provide you with something as follows:
ns1-05.azure-dns.com. ns2-05.azure-dns.net. ns3-05.azure-dns.org. ns4-05.azure-dns.info.
You can now input these as the authoritative nameservers in your registrars panel
-
Open up the Azure Portal and go to the newly created Function App
-
Get the function URL of the UpdateDnsFunction
-
Browsing to the URL will give you the following output
Successfully updated @.domainname.tld to 127.0.0.1
-
Congratulations your domainname will now point to your home IP
Distributed under the MIT License. See LICENSE
for more information.