-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(azure): add ssh jumper * feat(azure): add ssh jumper * feat(azure): add ssh jumper * feat(azure): add ssh jumper
- Loading branch information
Showing
14 changed files
with
349 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
@description('The name prefix to be used for the resource') | ||
param namePrefix string | ||
|
||
@description('The location to deploy the resource to') | ||
param location string | ||
|
||
@description('The subnet to deploy the network interface to') | ||
param subnetId string | ||
|
||
@description('Tags to be applied to the resource') | ||
param tags object | ||
|
||
@description('The SSH public key to be used for the virtual machine') | ||
@secure() | ||
param sshPublicKey string | ||
|
||
var name = '${namePrefix}-ssh-jumper' | ||
|
||
resource publicIp 'Microsoft.Network/publicIPAddresses@2023-11-01' = { | ||
name: '${name}-ip' | ||
location: location | ||
sku: { | ||
name: 'Standard' | ||
tier: 'Regional' | ||
} | ||
zones: [ | ||
'1' | ||
] | ||
properties: { | ||
publicIPAddressVersion: 'IPv4' | ||
publicIPAllocationMethod: 'Static' | ||
idleTimeoutInMinutes: 4 | ||
ipTags: [] | ||
} | ||
tags: tags | ||
} | ||
|
||
resource networkInterface 'Microsoft.Network/networkInterfaces@2023-11-01' = { | ||
name: name | ||
location: location | ||
properties: { | ||
ipConfigurations: [ | ||
{ | ||
name: '${name}-ipconfig' | ||
type: 'Microsoft.Network/networkInterfaces/ipConfigurations' | ||
properties: { | ||
privateIPAddress: '10.0.0.4' | ||
privateIPAllocationMethod: 'Dynamic' | ||
publicIPAddress: { | ||
id: publicIp.id | ||
properties: { | ||
deleteOption: 'Delete' | ||
} | ||
} | ||
subnet: { | ||
id: subnetId | ||
} | ||
primary: true | ||
privateIPAddressVersion: 'IPv4' | ||
} | ||
} | ||
] | ||
dnsSettings: { | ||
dnsServers: [] | ||
} | ||
enableAcceleratedNetworking: false | ||
enableIPForwarding: false | ||
disableTcpStateTracking: false | ||
nicType: 'Standard' | ||
auxiliaryMode: 'None' | ||
auxiliarySku: 'None' | ||
} | ||
} | ||
|
||
module virtualMachine '../../modules/virtualMachine/main.bicep' = { | ||
name: name | ||
params: { | ||
name: name | ||
sshPublicKey: sshPublicKey | ||
location: location | ||
tags: tags | ||
hardwareProfile: { | ||
vmSize: 'Standard_B1s' | ||
} | ||
additionalCapabilities: { | ||
hibernationEnabled: false | ||
} | ||
storageProfile: { | ||
imageReference: { | ||
publisher: 'canonical' | ||
offer: '0001-com-ubuntu-server-focal' | ||
sku: '20_04-lts-gen2' | ||
version: 'latest' | ||
} | ||
osDisk: { | ||
osType: 'Linux' | ||
name: '${name}-osdisk' | ||
createOption: 'FromImage' | ||
caching: 'ReadWrite' | ||
managedDisk: { | ||
storageAccountType: 'Premium_LRS' | ||
} | ||
deleteOption: 'Delete' | ||
diskSizeGB: 30 | ||
} | ||
dataDisks: [] | ||
diskControllerType: 'SCSI' | ||
} | ||
securityProfile: { | ||
uefiSettings: { | ||
secureBootEnabled: true | ||
vTpmEnabled: true | ||
} | ||
securityType: 'TrustedLaunch' | ||
} | ||
networkProfile: { | ||
networkInterfaces: [ | ||
{ | ||
id: networkInterface.id | ||
properties: { | ||
deleteOption: 'Delete' | ||
} | ||
} | ||
] | ||
} | ||
diagnosticsProfile: { | ||
bootDiagnostics: { | ||
enabled: true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
param name string | ||
param location string | ||
param tags object | ||
|
||
type HardwareProfile = { | ||
vmSize: string | ||
} | ||
@description('Specifies the hardware profile for the virtual machine') | ||
param hardwareProfile HardwareProfile | ||
|
||
type AdditionalCapabilities = { | ||
hibernationEnabled: bool | ||
} | ||
@description('Specifies the additional capabilities for the virtual machine') | ||
param additionalCapabilities AdditionalCapabilities | ||
|
||
type SecurityProfile = { | ||
uefiSettings: { | ||
secureBootEnabled: bool | ||
vTpmEnabled: bool | ||
} | ||
securityType: string | ||
} | ||
@description('Specifies the security profile for the virtual machine') | ||
param securityProfile SecurityProfile | ||
|
||
type NetworkInterface = { | ||
id: string | ||
properties: { | ||
deleteOption: string | ||
} | ||
} | ||
type NetworkProfile = { | ||
networkInterfaces: NetworkInterface[] | ||
} | ||
@description('Specifies the network profile for the virtual machine') | ||
param networkProfile NetworkProfile | ||
|
||
type DiagnosticsProfile = { | ||
bootDiagnostics: { | ||
enabled: bool | ||
} | ||
} | ||
@description('Specifies the diagnostics profile for the virtual machine') | ||
param diagnosticsProfile DiagnosticsProfile | ||
|
||
type StorageProfile = { | ||
imageReference: { | ||
publisher: string | ||
offer: string | ||
sku: string | ||
version: string | ||
} | ||
osDisk: { | ||
osType: string | ||
name: string | ||
createOption: string | ||
caching: string | ||
managedDisk: { | ||
storageAccountType: string | ||
} | ||
deleteOption: string | ||
diskSizeGB: int | ||
} | ||
dataDisks: array | ||
diskControllerType: string | ||
} | ||
@description('Specifies the storage profile for the virtual machine') | ||
param storageProfile StorageProfile | ||
|
||
@description('Specifies the SSH public key for the virtual machine') | ||
@secure() | ||
param sshPublicKey string | ||
|
||
resource virtualMachine 'Microsoft.Compute/virtualMachines@2024-03-01' = { | ||
name: name | ||
location: location | ||
zones: [ | ||
'1' | ||
] | ||
properties: { | ||
hardwareProfile: hardwareProfile | ||
additionalCapabilities: additionalCapabilities | ||
storageProfile: storageProfile | ||
osProfile: { | ||
computerName: name | ||
adminUsername: name | ||
linuxConfiguration: { | ||
disablePasswordAuthentication: true | ||
ssh: { | ||
publicKeys: [ | ||
{ | ||
path: '/home/${name}/.ssh/authorized_keys' | ||
keyData: sshPublicKey | ||
} | ||
] | ||
} | ||
provisionVMAgent: true | ||
patchSettings: { | ||
patchMode: 'AutomaticByPlatform' | ||
automaticByPlatformSettings: { | ||
rebootSetting: 'IfRequired' | ||
bypassPlatformSafetyChecksOnUserSchedule: false | ||
} | ||
assessmentMode: 'ImageDefault' | ||
} | ||
} | ||
secrets: [] | ||
allowExtensionOperations: true | ||
} | ||
securityProfile: securityProfile | ||
networkProfile: networkProfile | ||
diagnosticsProfile: diagnosticsProfile | ||
} | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
tags: tags | ||
} | ||
|
||
resource aadLoginExtension 'Microsoft.Compute/virtualMachines/extensions@2023-03-01' = { | ||
parent: virtualMachine | ||
name: 'AADSSHLoginForLinux' | ||
location: location | ||
properties: { | ||
publisher: 'Microsoft.Azure.ActiveDirectory' | ||
type: 'AADSSHLoginForLinux' | ||
typeHandlerVersion: '1.0' | ||
autoUpgradeMinorVersion: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.