-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.bicep
149 lines (142 loc) · 3.22 KB
/
main.bicep
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
param location string
param vnetName string = 'myVNet'
param vmsubnetName string = 'myVmSubnet'
param bastionsubnetName string = 'AzureBastionSubnet'
param vmName string = 'myVM'
param adminUsername string
@secure()
param adminPassword string
var vmsubnetRef = resourceId('Microsoft.Network/virtualNetworks/subnets', vnetName, vmsubnetName)
var bastionsubnetRef = resourceId('Microsoft.Network/virtualNetworks/subnets', vnetName, bastionsubnetName)
resource vnet 'Microsoft.Network/virtualNetworks@2021-05-01' = {
name: vnetName
location: location
properties: {
addressSpace: {
addressPrefixes: ['10.0.0.0/16']
}
subnets: [
{
name: vmsubnetName
properties: {
addressPrefix: '10.0.1.0/24'
networkSecurityGroup: {
id: nsg.id
}
}
}
{
name: bastionsubnetName
properties: {
addressPrefix: '10.0.0.0/24'
}
}
]
}
}
resource publicIP 'Microsoft.Network/publicIPAddresses@2022-01-01' = {
name: 'myPublicIP'
location: location
sku: {
name: 'Standard'
}
properties: {
publicIPAllocationMethod: 'Static'
}
}
resource networkInterface 'Microsoft.Network/networkInterfaces@2021-05-01' = {
name: 'myNIC'
location: location
dependsOn: [
vnet
]
properties: {
ipConfigurations: [
{
name: 'ipconfig'
properties: {
subnet: {
id: vmsubnetRef
}
privateIPAllocationMethod: 'Dynamic'
}
}
]
}
}
resource vm 'Microsoft.Compute/virtualMachines@2023-07-01' = {
name: vmName
location: location
properties: {
hardwareProfile: {
vmSize: 'Standard_E4s_v3'
}
osProfile: {
computerName: vmName
adminUsername: adminUsername
adminPassword: adminPassword
windowsConfiguration: {
provisionVMAgent: true
enableAutomaticUpdates: true
patchSettings: {
patchMode: 'AutomaticByOS'
assessmentMode: 'ImageDefault'
enableHotpatching: false
}
}
}
storageProfile: {
imageReference: {
publisher: 'microsoftwindowsdesktop'
offer: 'windows-11'
sku: 'win11-22h2-pro'
version: 'latest'
}
osDisk: {
name: 'osdisk'
createOption: 'FromImage'
managedDisk: {
storageAccountType: 'Premium_LRS'
}
diskSizeGB: 256
}
}
networkProfile: {
networkInterfaces: [
{
id: networkInterface.id
}
]
}
}
}
resource bastionHost 'Microsoft.Network/bastionHosts@2023-05-01' = {
name: 'myBastionHost'
location: location
dependsOn: [
vnet
]
properties: {
ipConfigurations: [
{
name: 'IpConf'
properties: {
subnet: {
id: bastionsubnetRef
}
publicIPAddress: {
id: publicIP.id
}
}
}
]
}
}
resource nsg 'Microsoft.Network/networkSecurityGroups@2021-02-01' = {
name: 'myNsg'
location: location
properties: {
securityRules: [
]
}
}