Pauwelz / azure-dynamic-dns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure Dynamic DNS

About The Project

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:

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.

Built With

Getting Started

To get a your own copy up and running follow these simple steps.

Prerequisites

Installation

  1. Clone the repo

    git clone https://github.com/Pauwelz/azure-dynamic-dns.git
  2. 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
  3. 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
  4. 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

Usage

  1. Open up the Azure Portal and go to the newly created Function App

  2. Get the function URL of the UpdateDnsFunction

  3. Browsing to the URL will give you the following output

    Successfully updated @.domainname.tld to 127.0.0.1

  4. Congratulations your domainname will now point to your home IP

License

Distributed under the MIT License. See LICENSE for more information.

About

License:MIT License


Languages

Language:C# 100.0%