2022-05-09 02:41:33 +08:00
## Configuration
To use this provider, add an entry to `creds.json` with `TYPE` set to `AZURE_DNS`
along with the API credentials.
Example:
2019-09-19 09:45:14 +08:00
2023-03-03 05:17:27 +08:00
{% code title="creds.json" %}
2022-02-18 01:22:31 +08:00
```json
2019-09-19 09:45:14 +08:00
{
2022-05-09 02:41:33 +08:00
"azuredns_main": {
"TYPE": "AZURE_DNS",
"SubscriptionID": "AZURE_SUBSCRIPTION_ID",
"ResourceGroup": "AZURE_RESOURCE_GROUP",
2023-05-22 01:30:30 +08:00
"TenantID": "AZURE_TENANT_ID",
2022-05-09 02:41:33 +08:00
"ClientID": "AZURE_CLIENT_ID",
2023-05-22 01:30:30 +08:00
"ClientSecret": "AZURE_CLIENT_SECRET"
2022-05-09 02:41:33 +08:00
}
2019-09-19 09:45:14 +08:00
}
2022-02-18 01:22:31 +08:00
```
2023-03-03 05:17:27 +08:00
{% endcode %}
2019-09-19 09:45:14 +08:00
2022-05-09 02:41:33 +08:00
You can also use environment variables:
2019-09-19 09:45:14 +08:00
2023-01-20 20:56:20 +08:00
```shell
2022-02-18 01:22:31 +08:00
export AZURE_SUBSCRIPTION_ID=XXXXXXXXX
export AZURE_RESOURCE_GROUP=YYYYYYYYY
export AZURE_TENANT_ID=ZZZZZZZZ
export AZURE_CLIENT_ID=AAAAAAAAA
export AZURE_CLIENT_SECRET=BBBBBBBBB
2019-09-19 09:45:14 +08:00
```
2023-03-03 05:17:27 +08:00
{% code title="creds.json" %}
2022-02-18 01:22:31 +08:00
```json
2019-09-19 09:45:14 +08:00
{
2022-05-09 02:41:33 +08:00
"azuredns_main": {
"TYPE": "AZURE_DNS",
"SubscriptionID": "$AZURE_SUBSCRIPTION_ID",
"ResourceGroup": "$AZURE_RESOURCE_GROUP",
"ClientID": "$AZURE_CLIENT_ID",
2023-05-22 01:30:30 +08:00
"TenantID": "$AZURE_TENANT_ID",
"ClientSecret": "$AZURE_CLIENT_SECRET"
2022-05-09 02:41:33 +08:00
}
2019-09-19 09:45:14 +08:00
}
2022-02-18 01:22:31 +08:00
```
2023-03-03 05:17:27 +08:00
{% endcode %}
2019-09-19 09:45:14 +08:00
## Metadata
This provider does not recognize any special metadata fields unique to Azure DNS.
## Usage
2023-03-11 21:42:01 +08:00
An example configuration:
2019-09-19 09:45:14 +08:00
2023-03-11 21:42:01 +08:00
{% code title="dnsconfig.js" %}
2023-01-20 20:56:20 +08:00
```javascript
2022-05-09 02:41:33 +08:00
var REG_NONE = NewRegistrar("none");
var DSP_AZURE_MAIN = NewDnsProvider("azuredns_main");
2019-09-19 09:45:14 +08:00
2023-06-17 20:58:17 +08:00
D("example.com", REG_NONE, DnsProvider(DSP_AZURE_MAIN),
2022-05-09 02:41:33 +08:00
A("test", "1.2.3.4")
2019-09-19 09:45:14 +08:00
);
2022-02-18 01:22:31 +08:00
```
2023-03-11 21:42:01 +08:00
{% endcode %}
2019-09-19 09:45:14 +08:00
## Activation
DNSControl depends on a standard [Client credentials Authentication ](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli?view=azure-cli-latest ) with permission to list, create and update hosted zones.
## New domains
If a domain does not exist in your Azure account, DNSControl will *not* automatically add it with the `push` command. You can do that either manually via the control panel, or via the command `dnscontrol create-domains` command.