I pass an array from my param file. This parameter is called “avds”. This normally contains objects
This can be either empty: param avds = []
Or this can be an array of AVD objects. For example:
param avds = [
{
fslogixShares : [
]
avdSubnetName : 'avd'
workspaceFriendlyName : 'Workstations'
maxSessionLimit : 1
avdIndexNumber : '001'
hostPoolType : 'Personal'
desktopAssignmentType : 'Direct'
startVmOnConnect : true
loadBalancerType : 'DepthFirst'
preferredAppGroupType: 'Desktop'
avdScalingPlanSchedules : [
]
remoteAppApplicationGroups : [
{
name: 'Desktop'
}
]
vdi : {
amount: 10
function: 'vdi'
virtualMachineType: 'workstation'
fromMarketplace: false
domainEntraJoin: false
availabilitySet: {
name: 'none'
}
indexNumber: '01'
description: 'VDI'
vmSize: 'Standard_NV6ads_A10_v5'
serviceLevel: '1'
backupRetention: 'backup-week'
disks: {
osDisk: {
imageOffer: 'windows-11'
imagePublisher: 'MicrosoftWindowsDesktop'
imageSku: 'win11-23h2-pro'
osDiskSizeGb: 256
osDiskSku: 'Premium_LRS'
osType: 'Windows'
skuVersion: 'latest'
}
dataDisks: [
]
}
nics: [
{
indexNumber: '01'
vnet: 'shared'
subnet: 'avd'
enableIPForwarding: false
ipConfigurations: [
{
privateIpAllocationMethod: 'Dynamic'
privateIpAddress: ''
publicIp: false
}
]
}
]
}
}
]
What i want to do is:
- Filter the array. It can not contain the avd.vdi property.
- If it contains the value pass it towards an array or a bool.
I tried to do it via this way:
var avdsWithVdi = [for avd in avds: (!empty(avd.vdi)) ? true : false]
var anyAvdHasVdi = contains(avdsWithVdi, true)
I run of the array. If its empty return false also return false when the value vdi is not present.
I also tried to use outputs but that doesnt get me any results.