---
title: "Discussion on \"Dynamic DNS with Edgerouter and Azure\" | Hashnode"
description: "Discussion on \"Dynamic DNS with Edgerouter and Azure\". And some fun with Azure Functions and Powershell along the way"
url: "https://hashnode.com/posts/dynamic-dns-with-edgerouter-and-azure/6183fb5dfd5d634d01697281"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Dynamic DNS with Edgerouter and Azure](https://blog.nielsb.net/dynamic-dns-with-edgerouter-and-azure?utm_source=hashnode&utm_medium=feed)

And some fun with Azure Functions and Powershell along the way

Nov 4, 2021 · 10 min read · blog.nielsb.net  
Updated Aug 18, 2022  
Read the article

-   [#dns](https://hashnode.com/tag/dns)
-   [#azure](https://hashnode.com/tag/azure)
-   [#router](https://hashnode.com/tag/router)

## Written by

[Niels Buit](https://hashnode.com/@nielsb)

@nielsb · Amsterdam, Netherlands

  
[View profile](https://hashnode.com/@nielsb)

I work in the Customer Architecture &amp; Engineering team at Microsoft. We help customers around the globe build the best solutions on Azure. The content of this blog should be considered personal opinion and is not an official Microsoft publication.

## Responses 2

Markdown supported · ⌘↵ to post

[Eduard van Valkenburg](https://hashnode.com/@eavanvalkenburg)

[Jan 5, 2023](https://hashnode.com/posts/dynamic-dns-with-edgerouter-and-azure/6183fb5dfd5d634d01697281/comment/63b6d73af7b8ce96c16c7101)

I found out the hard way that this same thing doesn't work when using a Unifi Dream Router, I guess it uses a different package for the ddns, but in order to get it working I built a Python version of this Azure Function, with instructions here: [github.com/eavanvalkenburg/dyndns](https://github.com/eavanvalkenburg/dyndns)

[Eduard van Valkenburg](https://hashnode.com/@eavanvalkenburg)

[Nov 5, 2021](https://hashnode.com/posts/dynamic-dns-with-edgerouter-and-azure/6183fb5dfd5d634d01697281/comment/61855554936da605cb9aa982)

Great stuff!

My setup is slightly different but I managed to get it to work!

I'm using a Unifi Security Gateway (USG) and I wanted to set the IP for my root domain, which in DNS speak is @. So to get it to work I changed the strZone regex to: "^(\[a-zA-Z@\]{1,})(.)(\[a-zA-Z.\]{1,})".

Then in the Unifi Controller interface I create a dynamic DNS record with _@.domain.com_ as hostname (and the rest the same as Niels above). This fixes the updates between unifi and DNS!

The other things I needed to do to get my system working is setup letsencrypt with the azure-dns plugin, the plugin can be found [here](https://github.com/binkhq/certbot-dns-azure). Just follow the instructions there, but I did need to create a seperate service principal in my azure AD, so make sure you are able to do that!

Finally two minor tips:

1.  I use a lot of subdomains and in my old solution for this I just had a list of those that I had some code loop through, so those were all A records with the IP address, in the DNS Zone in Azure you can do it smarter (and with that you only need 1 dynamic DNS record in Unifi) and that is to set the subdomain as A records with the _Alias record set_ set to _yes_ and pointing to the record that gets updates (@ for me). This aliasing is smarter then regular CNAMEs in DNS because it does return the IP address that it points to rather than having to do 2 lookups!
2.  you can SSH into your USG and then run these two commands once you have the dynamic DNS setup in the portal, to force the call to your function: `update dns dynamic interface <interface, in my case eth0>` and then to check the outcome: `show dns dynamic status`. If you are unsure of the interface run the second one first and then you will see the interface!

[Niels Buit](https://hashnode.com/@nielsb)

[Nov 5, 2021](https://hashnode.com/posts/dynamic-dns-with-edgerouter-and-azure/6183fb5dfd5d634d01697281/comment/61855554936da605cb9aa982#reply-618573ea936da605cb9aac6a)

That’s awesome, thanks for sharing! 👍
