azure

package module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 3 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Azure DNS module for Caddy

This package contains a DNS provider module for Caddy. It can be used to manage DNS records in Azure DNS Hosted zones.

Caddy module name

dns.providers.azure

Authenticating

This module supports authentication using a service principal with a secret, a workload identity, and a managed identity.

See the associated README in the libdns package for important information about credentials.

Building

To compile this Caddy module, follow the steps describe at the Caddy Build from Source instructions and import the github.com/caddy-dns/azure plugin

Config examples

[!TIP] These examples are for authenticating using a service principal with a secret. To attempt to authenticate using a workload identity or a managed identity, remove all of tenant_id, client_id, and client_secret. Refer to the associated README in the libdns package for more information.

To use this module for the ACME DNS challenge, configure the ACME issuer in your Caddy JSON like so:

{
  "module": "acme",
  "challenges": {
    "dns": {
      "provider": {
        "name": "azure",
        "subscription_id": "{env.AZURE_SUBSCRIPTION_ID}",
        "resource_group_name": "{env.AZURE_RESOURCE_GROUP_NAME}",
        "tenant_id": "{env.AZURE_TENANT_ID}",
        "client_id": "{env.AZURE_CLIENT_ID}",
        "client_secret": "{env.AZURE_CLIENT_SECRET}"
      }
    }
  }
}

or with the Caddyfile:

tls {
  dns azure {
    subscription_id {$AZURE_SUBSCRIPTION_ID}
    resource_group_name {$AZURE_RESOURCE_GROUP_NAME}
    tenant_id {$AZURE_TENANT_ID}
    client_id {$AZURE_CLIENT_ID}
    client_secret {$AZURE_CLIENT_SECRET}
  }
}

You can replace {$*} or {env.*} with the actual values if you prefer to put it directly in your config instead of an environment variable.

Workload identity or managed identity

Leave out tenant_id, client_id, and client_secret:

tls {
  dns azure {
    subscription_id {$AZURE_SUBSCRIPTION_ID}
    resource_group_name {$AZURE_RESOURCE_GROUP_NAME}
  }
}

A workload identity is used if the environment variables AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_FEDERATED_TOKEN_FILE are set, and then a managed identity is attempted. Assign the DNS Zone Contributor role to the identity for the DNS zone.

[!WARNING] With Microsoft Entra Workload ID on AKS, AZURE_TENANT_ID and AZURE_CLIENT_ID are set on your pods automatically. Do not write tenant_id {$AZURE_TENANT_ID} or client_id {$AZURE_CLIENT_ID} in your config in this case. If any of tenant_id, client_id, and client_secret is not empty, authentication using a service principal with a secret is attempted, and it fails because client_secret is empty.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct{ *azure.Provider }

Provider wraps the provider implementation as a Caddy module.

func (Provider) CaddyModule

func (Provider) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Provider) Provision

func (p *Provider) Provision(ctx caddy.Context) error

Provision implements the Provisioner interface to initialize the Azure client

func (*Provider) UnmarshalCaddyfile

func (p *Provider) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile sets up the DNS provider from Caddyfile tokens. Syntax:

azure {
    subscription_id <string>
    resource_group_name <string>
    tenant_id <string>
    client_id <string>
    client_secret <string>
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址