Skip to content

dns/dyndns: provider for Azure DNS - #1547

Closed
martgras wants to merge 2 commits into
opnsense:masterfrom
martgras:azuredns
Closed

dns/dyndns: provider for Azure DNS#1547
martgras wants to merge 2 commits into
opnsense:masterfrom
martgras:azuredns

Conversation

@martgras

@martgras martgras commented Oct 16, 2019

Copy link
Copy Markdown
Contributor

Add support for Azure DNS in the Dynamic DNS service

Usage instruction

Prerequisites

You need the Azure Cli 2.0 tools to create a service principal for access to your DNS Zone.
Either install Azure Cli 2.0 locally or use the Azure Cloud Shell

See https://docs.microsoft.com/en-us/cli/azure/overview?view=azure-cli-latest

Log-in to Azure

(not required when using the Azure Cloud Shell)

az login 
[
  {
    "cloudName": "AzureCloud",
    "id": "12345678-9abc-def0-1234-567890abcdef",
    "isDefault": true,
    "name": "myAzureSubscription",
    "state": "Enabled",
    "tenantId": "11111111-2222-3333-4444-555555555555",
    "user": {
      "name": "someone@example.com",
      "type": "user"
    }
  }
]

List your DNS Zones

az network dns zone list
[
  {
    "etag": "00000002-0000-0000-f641-73c64955d301",
    "id": "/subscriptions/12345678-9abc-def0-1234-567890abcdef/resourceGroups/exampledns_rg/providers/Microsoft.Network/dnszones/example.com",
    "location": "global",
    "maxNumberOfRecordSets": 5000,
    "name": "example.com",
    "nameServers": [
      "ns1-02.azure-dns.com.",
      "ns2-02.azure-dns.net.",
      "ns3-02.azure-dns.org.",
      "ns4-02.azure-dns.info."
    ],
    "numberOfRecordSets": 11,
    "resourceGroup": "exampledns_rg",
    "tags": {},
    "type": "Microsoft.Network/dnszones"
  }
]

The return "id" field contains the resource ID for the DNS Zone

Create a service principal

The service principal is used to grant acme.sh access to the DNS Zone using the id value from the previous commands output

(See https://docs.microsoft.com/en-us/cli/azure/ad/sp?view=azure-cli-latest#az_ad_sp_create_for_rbac for more details )

az ad sp create-for-rbac --name  "AcmeDnsValidator" --role "DNS Zone Contributor" --scopes /subscriptions/12345678-9abc-def0-1234-567890abcdef/resourceGroups/exampledns_rg/providers/Microsoft.Network/dnszones/example.com
{
  "appId": "3b5033b5-7a66-43a5-b3b9-a36b9e7c25ed",
  "displayName": "AcmeDnsValidator",
  "name": "http://AcmeDnsValidator",
  "password": "1b0224ef-34d4-5af9-110f-77f527d561bd",
  "tenant": "11111111-2222-3333-4444-555555555555"
}

Use the returned appId value as the username and note also the password as the password will be shown only once

Example using the above values to create a dynamic DNS entry for the host dyndemo.example.com

Service type: AzureDNS (or AzureDNS(v6)
Interface to monitor: WAN
Hostname: dyndemo
Username: 3b5033b5-7a66-43a5-b3b9-a36b9e7c25ed
Password: 1b0224ef-34d4-5af9-110f-77f527d561bd
Resource Id: /subscriptions/12345678-9abc-def0-1234-567890abcdef/resourceGroups/exampledns_rg/providers/Microsoft.Network/dnszones/example.com
TTL: any value > 0 in seconds
Description: My Dynamic DNS on Azure

@martgras martgras changed the title Azure DNS support for Dynamic DNS dns/dyndns: provider for Azure DNS Oct 16, 2019
@fichtner fichtner self-assigned this Oct 30, 2019
@fichtner

Copy link
Copy Markdown
Member

@martgras sorry for the delay, work is too busy at the moment :(

merged another PR and now there's a bit of merge conflicts. would you mind taking care of those and I'll try to test this next week.

Thank you,
Franco

@martgras

Copy link
Copy Markdown
Contributor Author

@fichtner merged the changes

fichtner pushed a commit that referenced this pull request Jan 3, 2020
@fichtner

fichtner commented Jan 3, 2020

Copy link
Copy Markdown
Member

Merged manually via ab0ccc3, thanks! ❤️

@fichtner fichtner closed this Jan 3, 2020
@martgras
martgras deleted the azuredns branch January 4, 2020 14:07
@bumasl

bumasl commented Jun 2, 2020

Copy link
Copy Markdown

MV opnsense Azure DNS does not update the public IP address, the domain updates the private IP address, does anyone know how to update my domain with the public IP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants