Replies: 1 comment
-
|
I gathered my thoughts a bit more, so what I am having issues with is how to correctly reference loops of SSD V2 disks above, in the loop that is creating the virtual machines: # array with variables for vm01 and vm02
var vms = [
{
ip: network.vm01ip
name: 'vm01'
zone: '1'
ilb: 'vm'
vmsize: virtualmachines.vm1size
}
{
ip: network.vm02ip
name: 'vm02'
zone: '2'
ilb: 'vm'
vmsize: virtualmachines.vm2size
}
]
# creating the NIC from array
resource NICVM 'Microsoft.Network/networkInterfaces@2023-04-01' = [for (vm, index) in vms: { ....
# creating the VMs from array
resource VMS 'Microsoft.Compute/virtualMachines@2023-03-01' = [for (vm, index) in vms: {
name: '${general.envname}-${vm.name}'
location: general.location
zones: [
vm.zone
]
properties: {
hardwareProfile: {
vmSize: vm.vmsize
}
osProfile: {
computerName: '${general.envname}-${vm.name}'
adminUsername: localadminusername
adminPassword: adminpassword
windowsConfiguration: {
enableAutomaticUpdates: false
patchSettings: {
patchMode: 'Manual'
}
}
}
storageProfile: {
imageReference: {
publisher: 'MicrosoftWindowsServer'
offer: 'WindowsServer'
sku: '2022-datacenter-azure-edition'
version: 'latest'
}
osDisk: {
createOption: 'FromImage'
managedDisk: {
storageAccountType: 'Premium_LRS'
}
}
dataDisks: [] # WHAT TO DO HERE??
}
networkProfile: {
networkInterfaces: [
{
id: NICVM[index].id
}
]
}
}
}]
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys, I must admit I already lost days on trying to write a bicep that would somehow work but things just not add up. I tried searching for similar examples, tried with Chat GPT (not helping it gets lost too) but nothing works so far, I got close a few times but nothing like what I exactly i would like, so:
I am deploying inside same bicep from two to four virtual machines (depends), to which i want to attach Premium SSD V2 disks (creating them inside same bicep file), their configuration varies from machine to machine (IOPS, bandwidth, size, zone, etc). I understand I need to use arrays to build it but just did not find the right approach yet, let me provide what I have and please help me climb out of this hole:
Issue is Premium SSD V2 disk are not allowed to be deployed inline like regular data disks, so I guess you have to create them first and later somehow attach them in "data disk" section of VM.
Ok so this part works kind of (although i want to have a single array with all changing parameters which are specific to each virtual machine I am building (name, size, etc...)
Then i get lost how to properly attach this to each virtual machine i am building so correct disk example from DB02 goes to DB02 etc.
Help me first clarify is this this possible to attach to for example two virtual machines i am building from array to (just different array?) or this should all be part of same array...
Lets first clarify this and I can provide more info if initial is a bit confusing :)
Thanks
Beta Was this translation helpful? Give feedback.
All reactions