Hi Looking at the final line. Is this an acceptable way of outputting the array ? Or is there a better way ?
@description('This is the location which needs to be provided, this is the Azure region')
param location string = resourceGroup().location
var storageAccountSku = 'standard_LRS'
resource storageAccounts 'Microsoft.Storage/storageAccounts@2022-09-01' = [for i in range(0, 4): {
name: '${i}mystorage1234'
location: location
sku: {
name: storageAccountSku
}
kind: 'StorageV2'
}]
output storageNames array = [for i in range(0,4) : storageAccounts[i].name]
Thank you in advance,
Jason
PS : I tried to look for the answer on Microsoft pages but didn’t see
2
Answers
Yes it’s fine, although here’s how I’d tweak it.
Yes, it is possible to extract the name property of each object in the storageAccounts array and generate a new array with those values in the way you export the array in the last line.
I tried with the same bicep code with adding id properties and got excepted results:
test.bicep
Deployed using below command:
Output:
Portal: