Skip to content

Commit

Permalink
Adding private dns zones children (#1044)
Browse files Browse the repository at this point in the history
* add A records

* update readme

* add AAAA, CNAME and MX records

* adding PTR and SOA records

* adding SOA, SRV and TXT records

* remove record

* fix readme

* update

* fix

* Update to latest

* update dir names

* update

* update

* test

* fix

* test

* fix

Co-authored-by: MrMCake <[email protected]>
  • Loading branch information
rahalan and AlexanderSehr authored Mar 4, 2022
1 parent 3fb40b1 commit 59d2602
Show file tree
Hide file tree
Showing 38 changed files with 1,014 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ stages:
parameters:
removeDeployment: '${{ parameters.removeDeployment }}'
deploymentBlocks:
- path: $(modulePath)/.parameters/min.parameters.json
- path: $(modulePath)/.parameters/parameters.json

- stage: Publishing
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ms.network.privatednszones.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
strategy:
fail-fast: false
matrix:
parameterFilePaths: ['parameters.json']
parameterFilePaths: ['min.parameters.json', 'parameters.json']
steps:
- name: 'Checkout'
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "<<namePrefix>>-az-privdns-x-001.com"
}
}
}
114 changes: 113 additions & 1 deletion arm/Microsoft.Network/privateDnsZones/.parameters/parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"value": "<<namePrefix>>-az-privdns-x-001.com"
"value": "<<namePrefix>>-az-privdns-x-002.com"
},
"roleAssignments": {
"value": [
Expand All @@ -15,6 +15,118 @@
}
]
},
"AAAA": {
"value": [
{
"name": "AAAA_2001_0db8_85a3_0000_0000_8a2e_0370_7334",
"ttl": 3600,
"aaaaRecords": [
{
"ipv6Address": "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
}
]
}
]
},
"A": {
"value": [
{
"name": "A_10.240.4.4",
"ttl": 3600,
"aRecords": [
{
"ipv4Address": "10.240.4.4"
}
]
}
]
},
"CNAME": {
"value": [
{
"name": "CNAME_test",
"ttl": 3600,
"cnameRecord": {
"cname": "test"
}
}
]
},
"MX": {
"value": [
{
"name": "MX_contoso",
"ttl": 3600,
"mxRecords": [
{
"exchange": "contoso.com",
"preference": 100
}
]
}
]
},
"PTR": {
"value": [
{
"name": "PTR_contoso",
"ttl": 3600,
"ptrRecords": [
{
"ptrdname": "contoso.com"
}
]
}
]
},
"SOA": {
"value": [
{
"name": "@",
"ttl": 3600,
"soaRecord": {
"email": "azureprivatedns-host.microsoft.com",
"expireTime": 2419200,
"host": "azureprivatedns.net",
"minimumTtl": 10,
"refreshTime": 3600,
"retryTime": 300,
"serialNumber": "1"
}
}
]
},
"SRV": {
"value": [
{
"name": "SRV_contoso",
"ttl": 3600,
"srvRecords": [
{
"port": 9332,
"priority": 0,
"target": "test.contoso.com",
"weight": 0
}
]
}
]
},
"TXT": {
"value": [
{
"name": "TXT_test",
"ttl": 3600,
"txtRecords": [
{
"value": [
"test"
]
}
]
}
]
},
"virtualNetworkLinks": {
"value": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

45 changes: 45 additions & 0 deletions arm/Microsoft.Network/privateDnsZones/A/deploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@description('Required. Private DNS zone name.')
param privateDnsZoneName string

@description('Required. The name of the A record.')
param name string

@description('Optional. The list of A records in the record set.')
param aRecords array = []

@description('Optional. The metadata attached to the record set.')
param metadata object = {}

@description('Optional. The TTL (time-to-live) of the records in the record set.')
param ttl int = 3600

@description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered')
param cuaId string = ''

module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) {
name: 'pid-${cuaId}'
params: {}
}

resource privateDnsZone 'Microsoft.Network/privateDnsZones@2020-06-01' existing = {
name: privateDnsZoneName
}

resource A 'Microsoft.Network/privateDnsZones/A@2020-06-01' = {
name: name
parent: privateDnsZone
properties: {
aRecords: aRecords
metadata: metadata
ttl: ttl
}
}

@description('The name of the deployed A record')
output name string = A.name

@description('The resource ID of the deployed A record')
output resourceId string = A.id

@description('The resource group of the deployed A record')
output resourceGroupName string = resourceGroup().name
44 changes: 44 additions & 0 deletions arm/Microsoft.Network/privateDnsZones/A/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Private DNS Zone A record `[Microsoft.Network/privateDnsZones/A]`

This module deploys a Private DNS Zone A record.

## Resource Types

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Network/privateDnsZones/A` | 2020-06-01 |

## Parameters

| Parameter Name | Type | Default Value | Possible Values | Description |
| :-- | :-- | :-- | :-- | :-- |
| `aRecords` | array | `[]` | | Optional. The list of A records in the record set. |
| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered |
| `metadata` | object | `{object}` | | Optional. The metadata attached to the record set. |
| `name` | string | | | Required. The name of the A record. |
| `privateDnsZoneName` | string | | | Required. Private DNS zone name. |
| `ttl` | int | `3600` | | Optional. The TTL (time-to-live) of the records in the record set. |

### Parameter Usage: `aRecords`

```json
"aRecords": {
"value": [
{
"ipv4Address": "string"
}
]
}
```

## Outputs

| Output Name | Type | Description |
| :-- | :-- | :-- |
| `name` | string | The name of the deployed A record |
| `resourceGroupName` | string | The resource group of the deployed A record |
| `resourceId` | string | The resource ID of the deployed A record |

## Template references

- [Privatednszones/A](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Network/2020-06-01/privateDnsZones/A)
4 changes: 4 additions & 0 deletions arm/Microsoft.Network/privateDnsZones/A/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.4"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

45 changes: 45 additions & 0 deletions arm/Microsoft.Network/privateDnsZones/AAAA/deploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@description('Required. Private DNS zone name.')
param privateDnsZoneName string

@description('Required. The name of the AAAA record.')
param name string

@description('Optional. The list of AAAA records in the record set.')
param aaaaRecords array = []

@description('Optional. The metadata attached to the record set.')
param metadata object = {}

@description('Optional. The TTL (time-to-live) of the records in the record set.')
param ttl int = 3600

@description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered')
param cuaId string = ''

module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) {
name: 'pid-${cuaId}'
params: {}
}

resource privateDnsZone 'Microsoft.Network/privateDnsZones@2020-06-01' existing = {
name: privateDnsZoneName
}

resource AAAA 'Microsoft.Network/privateDnsZones/AAAA@2020-06-01' = {
name: name
parent: privateDnsZone
properties: {
aaaaRecords: aaaaRecords
metadata: metadata
ttl: ttl
}
}

@description('The name of the deployed AAAA record')
output name string = AAAA.name

@description('The resource ID of the deployed AAAA record')
output resourceId string = AAAA.id

@description('The resource group of the deployed AAAA record')
output resourceGroupName string = resourceGroup().name
44 changes: 44 additions & 0 deletions arm/Microsoft.Network/privateDnsZones/AAAA/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Private DNS Zone AAAA record `[Microsoft.Network/privateDnsZones/AAAA]`

This module deploys a Private DNS Zone AAAA record.

## Resource Types

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Network/privateDnsZones/AAAA` | 2020-06-01 |

## Parameters

| Parameter Name | Type | Default Value | Possible Values | Description |
| :-- | :-- | :-- | :-- | :-- |
| `aaaaRecords` | array | `[]` | | Optional. The list of AAAA records in the record set. |
| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered |
| `metadata` | object | `{object}` | | Optional. The metadata attached to the record set. |
| `name` | string | | | Required. The name of the AAAA record. |
| `privateDnsZoneName` | string | | | Required. Private DNS zone name. |
| `ttl` | int | `3600` | | Optional. The TTL (time-to-live) of the records in the record set. |

### Parameter Usage: `aaaaRecords`

```json
"aaaaRecords": {
"value": [
{
"ipv6Address": "string"
}
]
}
```

## Outputs

| Output Name | Type | Description |
| :-- | :-- | :-- |
| `name` | string | The name of the deployed AAAA record |
| `resourceGroupName` | string | The resource group of the deployed AAAA record |
| `resourceId` | string | The resource ID of the deployed AAAA record |

## Template references

- [Privatednszones/AAAA](https://docs.microsoft.com/en-us/azure/templates/Microsoft.Network/2020-06-01/privateDnsZones/AAAA)
4 changes: 4 additions & 0 deletions arm/Microsoft.Network/privateDnsZones/AAAA/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.4"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

45 changes: 45 additions & 0 deletions arm/Microsoft.Network/privateDnsZones/CNAME/deploy.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@description('Required. Private DNS zone name.')
param privateDnsZoneName string

@description('Required. The name of the CNAME record.')
param name string

@description('Optional. A CNAME record.')
param cnameRecord object = {}

@description('Optional. The metadata attached to the record set.')
param metadata object = {}

@description('Optional. The TTL (time-to-live) of the records in the record set.')
param ttl int = 3600

@description('Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered')
param cuaId string = ''

module pid_cuaId '.bicep/nested_cuaId.bicep' = if (!empty(cuaId)) {
name: 'pid-${cuaId}'
params: {}
}

resource privateDnsZone 'Microsoft.Network/privateDnsZones@2020-06-01' existing = {
name: privateDnsZoneName
}

resource CNAME 'Microsoft.Network/privateDnsZones/CNAME@2020-06-01' = {
name: name
parent: privateDnsZone
properties: {
cnameRecord: cnameRecord
metadata: metadata
ttl: ttl
}
}

@description('The name of the deployed CNAME record')
output name string = CNAME.name

@description('The resource ID of the deployed CNAME record')
output resourceId string = CNAME.id

@description('The resource group of the deployed CNAME record')
output resourceGroupName string = resourceGroup().name
Loading

0 comments on commit 59d2602

Please sign in to comment.