-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.bicep
More file actions
70 lines (63 loc) · 1.64 KB
/
Copy pathmain.bicep
File metadata and controls
70 lines (63 loc) · 1.64 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
@description('Location for all resources')
param location string = resourceGroup().location
@description('Name of the VM instance')
param vmName string
@description('VM size (default tuned for low-cost substrate)')
param vmSize string = 'Standard_B2s'
@description('Optional source image ID. If empty, Ubuntu 22.04 LTS marketplace image is used.')
param sourceImageId string = ''
@description('Source address prefix allowed to SSH')
param sshSourceAddressPrefix string = '0.0.0.0/0'
var ubuntuImageReference = {
publisher: 'Canonical'
offer: '0001-com-ubuntu-server-jammy'
sku: '22_04-lts-gen2'
version: 'latest'
}
resource nsg 'Microsoft.Network/networkSecurityGroups@2024-07-01' = {
name: '${vmName}-nsg'
location: location
properties: {
securityRules: [
{
name: 'SSH'
properties: {
priority: 300
direction: 'Inbound'
access: 'Allow'
protocol: 'Tcp'
sourcePortRange: '*'
destinationPortRange: '22'
sourceAddressPrefix: sshSourceAddressPrefix
destinationAddressPrefix: '*'
}
}
]
}
}
resource vm 'Microsoft.Compute/virtualMachines@2023-09-01' = {
name: vmName
location: location
properties: {
hardwareProfile: {
vmSize: vmSize
}
storageProfile: {
imageReference: empty(sourceImageId)
? ubuntuImageReference
: {
id: sourceImageId
}
}
osProfile: {
computerName: vmName
adminUsername: 'azureuser'
linuxConfiguration: {
disablePasswordAuthentication: true
}
}
networkProfile: {
networkInterfaces: []
}
}
}