-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingleLinuxVM.bicep
More file actions
102 lines (95 loc) · 2.28 KB
/
singleLinuxVM.bicep
File metadata and controls
102 lines (95 loc) · 2.28 KB
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
// Orchestrates the deployment of a single vnet n vm for practice
param virtualMachineName string = 'myVM'
param virtualMachineSize string = 'Standard_B1s'
param virtualMachineComputerName string = 'TestVM'
param adminUsername string = 'rdeshmu'
param virtualNetAddPrefix array = ['10.0.0.0/16']
param subnetName string = 'subnet1'
var subnetPrefix = '10.0.0.0/24'
// gives '10.0.0.0/24'
param ubuntuOSVersion string = 'Ubuntu-2004'
var subnetRef = '${virtualNetwork.id}/subnets/${subnetName}'
var imageReference = {
'Ubuntu-2004': {
publisher: 'Canonical'
offer: '0001-com-ubuntu-server-focal'
sku: '20_04-lts-gen2'
version: 'latest'
}
'Ubuntu-2204': {
publisher: 'Canonical'
offer: '0001-com-ubuntu-server-jammy'
sku: '22_04-lts-gen2'
version: 'latest'
}
}
param location string = 'westus'
@secure()
param adminPassword string
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2024-05-01' = {
name: 'myVnet'
location: resourceGroup().location
properties: {
addressSpace: {
addressPrefixes: virtualNetAddPrefix
}
subnets: [
{
name: subnetName
properties: {
addressPrefix: subnetPrefix
}
}
]
}
}
resource nic 'Microsoft.Network/networkInterfaces@2024-05-01' = {
name: 'myNIC'
location: resourceGroup().location
properties: {
ipConfigurations: [
{
name: 'ipNicConfig'
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: subnetRef
}
}
}
]
}
}
resource virtualMachine 'Microsoft.Compute/virtualMachines@2024-03-01' = {
name: virtualMachineName
location: resourceGroup().location
properties: {
hardwareProfile: {
vmSize: virtualMachineSize
}
osProfile: {
computerName: virtualMachineComputerName
adminUsername: adminUsername
adminPassword: adminPassword
}
storageProfile: {
imageReference: imageReference[ubuntuOSVersion]
osDisk: {
createOption: 'FromImage'
managedDisk: {
storageAccountType: 'Standard_LRS'
}
}
}
networkProfile: {
networkInterfaces: [
{
id: nic.id
properties: {
deleteOption: 'Delete'
}
}
]
}
}
}