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. 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:
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!
Eduard van Valkenburg
Cloud Solution Architect @ Microsoft
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