-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bicep_dns_code
120 lines (113 loc) · 2.65 KB
/
Bicep_dns_code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
param location string = 'westus2'
param privateDnsZoneName string = 'privatednszone.dnspoc.com'
param recordSetName string = 'my-recordset'
param aRecordValue string = '10.0.0.1'
param cnameRecordSetName string = 'my-cnamerecordset'
param cnameRecordValue string = 'vm.pocdns.com'
resource privatednszone 'Microsoft.Network/privateDnsZones@2020-09-01' = {
name: privateDnsZoneName
location: location
}
resource recordSet 'Microsoft.Network/privateDnsZones/A@2020-09-01' = {
name: '${recordSetName}.${privateDnsZoneName}'
parent: privatednszone
properties: {
TTL: 3600
ARecords: [
{
ipv4Address: aRecordValue
}
]
}
}
resource cnameRecordSet 'Microsoft.Network/privateDnsZones/CNAME@2020-09-01' = {
name: '${cnameRecordSetName}.${privateDnsZoneName}'
parent: privatednszone
properties: {
TTL: 3600
CNAMERecord: {
cname: cnameRecordValue
}
}
}
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2020-11-01' = {
name: 'my-vnet'
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/16'
]
}
subnets: [
{
name: 'my-subnet'
properties: {
addressPrefix: '10.0.0.0/24'
}
}
]
}
}
resource networkInterface 'Microsoft.Network/networkInterfaces@2020-11-01' = {
name: 'my-networkinterface'
location: location
properties: {
ipConfigurations: [
{
name: 'my-ipconfiguration'
properties: {
subnet: {
id: virtualNetwork.properties.subnets[0].id
}
privateIPAllocationMethod: 'Dynamic'
privateIPAddressVersion: 'IPv4'
privateIPAddress: '10.0.0.2'
dnsSettings: {
dnsServers: [
privatednszone.properties.dnsServers[0].ipAddresses[0]
]
}
}
}
]
}
}
resource virtualMachine 'Microsoft.Compute/virtualMachines@2022-03-01' = {
name: 'my-vm'
location: location
properties: {
hardwareProfile: {
vmSize: 'Standard_DS2_v2'
}
osProfile: {
computerName: 'my-vm'
adminUsername: 'adminUser'
adminPassword: 'adminPassword'
linuxConfiguration: {
disablePasswordAuthentication: false
}
}
storageProfile: {
imageReference: {
publisher: 'Canonical'
offer: 'UbuntuServer'
sku: '20.04-LTS'
version: 'latest'
}
osDisk: {
createOption: 'FromImage'
managedDisk: {
storageAccountType: 'Standard_LRS'
}
}
}
networkProfile: {
networkInterfaces: [
{
id: networkInterface.id
}
]
}
}
}