Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add private-dns-zone example #1130

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/examples/101/private-dns-zone/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
param privateDnsZoneName string = 'contoso.com'
param autoVmRegistration bool = true
param vnetName string = 'Vnet1'
param vnetAddressPrefix string = '10.0.0.0/16'
param subnetName string = 'Subnet1'
param subnetAddressPrefix string = '10.0.1.0/24'
param location string = resourceGroup().location

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2020-06-01' = {
name: vnetName
location: location
properties: {
addressSpace: {
addressPrefixes: [
vnetAddressPrefix
]
}
}
}

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2020-06-01' = {
name: '${virtualNetwork.name}/${subnetName}'
properties: {
addressPrefix: subnetAddressPrefix
}
}

resource privateDnsZone 'Microsoft.Network/privateDnsZones@2018-09-01' = {
name: privateDnsZoneName
location: 'global'
}

resource virtualNetworkLink 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2018-09-01' = {
name: '${privateDnsZone.name}/${privateDnsZone.name}-link'
location: 'global'
properties: {
registrationEnabled: autoVmRegistration
virtualNetwork: {
id: virtualNetwork.id
}
}
}
83 changes: 83 additions & 0 deletions docs/examples/101/private-dns-zone/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"privateDnsZoneName": {
"type": "string",
"defaultValue": "contoso.com"
},
"autoVmRegistration": {
"type": "bool",
"defaultValue": true
},
"vnetName": {
"type": "string",
"defaultValue": "Vnet1"
},
"vnetAddressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/16"
},
"subnetName": {
"type": "string",
"defaultValue": "Subnet1"
},
"subnetAddressPrefix": {
"type": "string",
"defaultValue": "10.0.1.0/24"
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
},
"functions": [],
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2020-06-01",
"name": "[parameters('vnetName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('vnetAddressPrefix')]"
]
}
}
},
{
"type": "Microsoft.Network/virtualNetworks/subnets",
"apiVersion": "2020-06-01",
"name": "[format('{0}/{1}', parameters('vnetName'), parameters('subnetName'))]",
"properties": {
"addressPrefix": "[parameters('subnetAddressPrefix')]"
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
]
},
{
"type": "Microsoft.Network/privateDnsZones",
"apiVersion": "2018-09-01",
"name": "[parameters('privateDnsZoneName')]",
"location": "global"
},
{
"type": "Microsoft.Network/privateDnsZones/virtualNetworkLinks",
"apiVersion": "2018-09-01",
"name": "[format('{0}/{1}-link', parameters('privateDnsZoneName'), parameters('privateDnsZoneName'))]",
"location": "global",
"properties": {
"registrationEnabled": "[parameters('autoVmRegistration')]",
"virtualNetwork": {
"id": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/privateDnsZones', parameters('privateDnsZoneName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
]
}
]
}
4 changes: 4 additions & 0 deletions docs/examples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@
"filePath": "101/nat-gateway-vnet/main.bicep",
"description": "101/nat-gateway-vnet"
},
{
"filePath": "101/private-dns-zone/main.bicep",
"description": "101/private-dns-zone"
},
{
"filePath": "101/redis-cache/main.bicep",
"description": "101/redis-cache"
Expand Down