Using Azure DNS for dynamic DNS

You may also like...

11 Responses

  1. Jaco says:

    Simply brilliant! I used this as a starting point and modified it slightly for my own unique situation.

  2. Rob M says:

    Great post. I believe that readers should note that storing creds in an xml file works fine for Azure AD accounts but not for Live ID.

  3. Hemant Patel says:

    Great solution, but I am having problems getting it to work via the Task Scheduler, I have scheduled it to work every morning when the Azure VM starts-up, but it does not change the IP. I think it is to do with either the “Login-AzureRMAccount” or “Update the apex record”, but cannot workout which?

  4. Lewis says:

    Hi Hemant, the best thing to do is run one line at a time in a PowerShell ISE window and see what the problem is there. As Rob M said, the use of stored credentials is both necessary and a limitation.

    To create your own credentials, open a PowerShell window in the same folder as your script and type:

    Get-Credential | Export-Clixml "\AzureRMCreds.xml"
    

    Type in the credentials you would normally use to log on to Azure (assuming these are organisational credentials such as user@something.onmicrosoft.com. As Rob M said, this doesn’t work for Outlook or Live account logins.

    The commands will create an encrypted credential file which can be used by the script to authenticate with Azure.

    If you’re struggling with the apex record creation, it might be that you need to set up the zone since this isn’t done in the script. It’s assumed you’ve already got a zone and an apex record set up. However you do that is your choice – personally, I did it manually in the portal.

  5. Dominic Purnell says:

    Hi,

    You can use your live ID by putting in microsoftaccount\mymailaddress.com.

    Also can I ask please how you stored your made your DDWRT credentails file?

    Thanks, Dom

  6. Lewis says:

    Hi Dominic, the answer is in the comment above yours. Basically it’s exactly the same as that comment, only the change of a name. All you’re doing is storing the credentials in an encrypted XML file format. I should point out though that an exported credential that’s encrypted on MachineA cannot be copied and used on MachineB, you would need to create the credential file on MachineB in order to use it there.

  7. Dominic Purnell says:

    Thanks Lewis, scratch what I say about live credentials. Great article!

  8. This is amazing, Is there a way to you can prevent the “confirmation” (Confirm
    Are you sure you want to perform this action?
    Performing the operation “Creating record set …” on target “updated”.
    [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Y”):) from being displayed?

    I’ve tried using:
    -Confirm:$false
    -Confirm:0
    -Force
    -Overwrite

    Any suggestions?

  9. Dominic Purnell says:

    Has anyone had any issues running this in task scheduler in Windows 10? Powershell runs it fine and scheduler reports no issues when triggered however it just will not update! running under an admin context.

    Thanks!

  10. Lui says:

    Hi,
    Thanks for this perfect post and script! 🙂

  11. Bruno says:

    Nice article! Just want to add, for those of you who have CLI Cisco devices, it’s also possible to update Azure DNS record through HTTP, like we usually do with Dyn (https://docs.microsoft.com/en-us/rest/api/dns/recordsets/createorupdate).

Discover more from lewisroberts.com

Subscribe now to keep reading and get access to the full archive.

Continue reading