This application will discover your current public IP address and then update an A-record of your choice within an Azure DNS Zone.
Create a DNS Zone using the Azure Portal following these instructions.
- Inside the Azure Portal, find your Azure Active Directory page in the left-hand menu.
- Choose App Registrations from the left-hand menu for your Azure Active Directory.
- Click the New Registration button.
- Provide a name - e.g. AzureDnsDocker - and leave all other values as their defaults.
- Click Register.
- Copy the Application (Client) ID value; you'll need this for the
CLIENTIDenvironment variable. - Copy the Directory (Tenant) ID value; you'll need this for the
TENANTIDenvironment variable. - Click the Certificates & secrets option in your app's left-hand menu.
- Click the New Client Secret button.
- Give the secret a name - e.g. AzureDnsDocker - and choose an expiration period you're comfortable with.
- Copy the new secret value; you'll need this for the
SECRETenvironment variable. - Go back to the main Azure left-hand menu (top left) and click Home.
- Under the Navigate heading, choose Subscriptions.
- Find the subscription associated with the DNS Zone and copy the Subscription ID; you'll need this for the
SUBSCRIPTIONIDenvironment variable.
- Go to your DNS Zone within the Azure Portal.
- In the zone's left-hand menu, choose Access control (IAM).
- Click the Add button and choose Add role assignment.
- Choose the DNS Zone Contributor role.
- In the Select box, start typing the name you chose for your app in the previous section, select the item in the results, and then click Save.
docker run -d --name azure-dns-docker \
-e TENANTID={tenant-id-guid} \
-e CLIENTID={client-id-guid} \
-e SECRET={secret} \
-e SUBSCRIPTIONID={subscription-id-guid} \
-e RESOURCEGROUP={resource-group-name} \
-e ZONENAME={domain-name}
-e RECORDNAME={host-name}
cpwood/azure-dns-docker
For example, to set the A-record for foo.bar.com in the bar.com DNS Zone within a Resource Group Bar, you'd do this:
docker run -d --name azure-dns-docker \
-e TENANTID=004097ec-5f22-400d-87ef-9c5a75c8a95c \
-e CLIENTID=03022824-f618-430e-8e73-18cef20d35ab \
-e SECRET=oaaodgioadgadoigjda_g8sg7 \
-e SUBSCRIPTIONID=0a32c718-edf0-443c-bba3-37578e0346c6 \
-e RESOURCEGROUP=Bar \
-e ZONENAME=bar.com
-e RECORDNAME=foo
cpwood/azure-dns-docker
You can also specify the following two optional environment variables:
TTL- the Time-To-Live value for the created A-record (default value is300- 300 seconds, i.e. 5 minutes); andDELAY- the delay between each attempt to check the public IP address and update the DNS Zone (default value is90000- 90,000 milliseconds, i.e. 15 minutes).
No, however you could manually create CNAME records within your DNS Zone pointing to the A-record updated by this application.