-
Notifications
You must be signed in to change notification settings - Fork 0
/
os4machine.bicep
156 lines (147 loc) · 3.97 KB
/
os4machine.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
150
151
152
153
154
155
156
param location string = 'germanywestcentral'
param networkInterfaceName string = 'openslides4-nic'
param networkSecurityGroupName string = 'openslides4-nsg'
param networkSecurityGroupRules array
param subnetName string = 'default'
param virtualNetworkName string = 'openslides4-vnet'
param addressPrefixes array
param subnets array
param publicIpAddressName string = 'openslides4-ip'
param publicIpAddressType string = 'Static'
param publicIpAddressSku string = 'Standard'
param pipDeleteOption string = 'Delete'
param virtualMachineName string = 'openslides4'
param virtualMachineComputerName string = 'openslides4'
param virtualMachineRG string = 'openslides-rg'
param osDiskType string = 'StandardSSD_LRS'
param osDiskDeleteOption string = 'Delete'
param virtualMachineSize string = 'Standard_B2ms'
param nicDeleteOption string = 'Delete'
param adminUsername string = 'os4user'
@secure()
param adminPassword string
@secure()
param customData string
param securityType string = 'TrustedLaunch'
param secureBoot bool = true
param vTPM bool = true
var nsgId = resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', networkSecurityGroupName)
var vnetName = virtualNetworkName
var vnetId = resourceId(resourceGroup().name, 'Microsoft.Network/virtualNetworks', virtualNetworkName)
var subnetRef = '${vnetId}/subnets/${subnetName}'
resource networkInterface 'Microsoft.Network/networkInterfaces@2021-08-01' = {
name: networkInterfaceName
location: location
properties: {
ipConfigurations: [
{
name: 'ipconfig1'
properties: {
subnet: {
id: subnetRef
}
privateIPAllocationMethod: 'Dynamic'
publicIPAddress: {
id: resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', publicIpAddressName)
properties: {
deleteOption: pipDeleteOption
}
}
}
}
]
networkSecurityGroup: {
id: nsgId
}
}
dependsOn: [
networkSecurityGroup
virtualNetwork
publicIpAddress
]
}
resource networkSecurityGroup 'Microsoft.Network/networkSecurityGroups@2019-02-01' = {
name: networkSecurityGroupName
location: location
properties: {
securityRules: networkSecurityGroupRules
}
}
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2021-01-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: addressPrefixes
}
subnets: subnets
}
}
resource publicIpAddress 'Microsoft.Network/publicIpAddresses@2020-08-01' = {
name: publicIpAddressName
location: location
properties: {
publicIPAllocationMethod: publicIpAddressType
}
sku: {
name: publicIpAddressSku
}
}
resource virtualMachine 'Microsoft.Compute/virtualMachines@2022-03-01' = {
name: virtualMachineName
location: location
properties: {
hardwareProfile: {
vmSize: virtualMachineSize
}
storageProfile: {
osDisk: {
createOption: 'fromImage'
managedDisk: {
storageAccountType: osDiskType
}
deleteOption: osDiskDeleteOption
}
imageReference: {
publisher: 'debian'
offer: 'debian-11'
sku: '11-gen2'
version: 'latest'
}
}
networkProfile: {
networkInterfaces: [
{
id: networkInterface.id
properties: {
deleteOption: nicDeleteOption
}
}
]
}
osProfile: {
computerName: virtualMachineComputerName
adminUsername: adminUsername
adminPassword: adminPassword
linuxConfiguration: {
patchSettings: {
patchMode: 'ImageDefault'
}
}
customData: customData
}
securityProfile: {
securityType: securityType
uefiSettings: {
secureBootEnabled: secureBoot
vTpmEnabled: vTPM
}
}
diagnosticsProfile: {
bootDiagnostics: {
enabled: true
}
}
}
}
output adminUsername string = adminUsername