Jun 25 2019 03:05 AM
Hello,
Does anybody know if it is possible to somehow automate the backup of DNS zone records?
I can perform a manual export using the following command but would like it on a schedule, with the output dumped into a azure storage if possible.
az network dns zone export -g myresourcegroup -n contoso.com -f contoso.com.txt
https://docs.microsoft.com/en-us/azure/dns/dns-import-export
cheers
Jun 25 2019 04:26 PM
You can accomplish this with an automation account and runbook. As far as I am aware there is now way baked into the Azure portal to do this natively. It would have to be accomplished by scheduling that script you have outlined. Let me know if you would like some assistance with that and I can point you in the right direction. @GregHunter
Jun 26 2019 01:44 AM
Hi Bryan,
Do you mean there is 'no' way baked into the portal to do this naively?
Some assistance would be much appreciated! I was hoping to pipe the out of the above command into a blob file using the 'az storage blob upload' command, but I dont think this is possible.
thanks @Bryan Haslip
Jan 14 2021 07:21 AM
Hi Bryan! I know the post I am replying on is very old but it is exceptionally relevant to what I am currently fighting and I was hoping you could provide some direction.
I have a PowerShell script that I can log into the Azure Cloud Shell and run manually that exports all our public DNS zones and saves them to files. The goal is to get a backup. Obviously a manual backup is less than ideal so I am trying to automate this.
As you recommended, I have been fighting getting this working in an automation account for weeks now. Essentially, it is not recognizing the az command. In an effort to simplify troubleshooting I have created and published a runbook that runs only this (Resource Group name cut intentionally):
Jan 17 2021 09:15 AM
Az CLI is not available in the cloud hosted Automation workers.
You can either:
1) try to download and install Az CLI on the fly with PowerShell before running "az" commands. Of course, you would need first to authenticate with the Run As Account or other service principal.
2) use an Azure VM or a machine on-premises as a Hybrid Worker. Runbooks will run in this machine, which is owned by you and where you can install whatever dependencies are needed. If you want to reuse Run As Accounts inside the worker, you will have to install the Run As certificate.
Jan 18 2021 06:13 AM
@hspinto Just ot make sure I understand option 1 correctly, you mean in the script I am trying to run add the commands to download the Az CLI so it will install in the sandboxed environment each time it runs?