Skip to content

Instantly share code, notes, and snippets.

@johnlokerse
Created July 26, 2022 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnlokerse/50f87d17ff7b9da8ff9fdbab75934ad1 to your computer and use it in GitHub Desktop.
Save johnlokerse/50f87d17ff7b9da8ff9fdbab75934ad1 to your computer and use it in GitHub Desktop.
Blog Generate Bicep parameters
@description('The name of the virtual machine.')
param parVmName string
@allowed([
'westeurope'
'northeurope'
])
param parLocation string
param parComputerName string
param parAdminUserName string
@secure()
param parAdminPassword string
param parDiskSizeInGb int
resource resWindowsVM 'Microsoft.Compute/virtualMachines@2020-12-01' = {
name: parVmName
location: parLocation
properties: {
hardwareProfile: {
vmSize: 'Standard_A2_v2'
}
osProfile: {
computerName: parComputerName
adminUsername: parAdminUserName
adminPassword: parAdminPassword
}
storageProfile: {
imageReference: {
publisher: 'MicrosoftWindowsServer'
offer: 'WindowsServer'
sku: '2012-R2-Datacenter'
version: 'latest'
}
osDisk: {
name: 'osdisk-${parVmName}'
caching: 'ReadWrite'
createOption: 'FromImage'
diskSizeGB: parDiskSizeInGb
}
}
networkProfile: {
networkInterfaces: [
{
id: resNic.id
}
]
}
diagnosticsProfile: {
bootDiagnostics: {
enabled: true
storageUri: 'storageUri'
}
}
}
}
resource resNic 'Microsoft.Network/networkInterfaces@2020-11-01' = {
name: '${parVmName}-nic'
location: parLocation
properties: {
ipConfigurations: [
{
name: '${parVmName}-ipconfig'
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: resSubnetRef.id
}
}
}
]
}
}
resource resSubnetRef 'Microsoft.Network/virtualNetworks/subnets@2022-01-01' = {
name: 'MyVnet/MySubnet'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment