-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using-loops-with-Bicep/ #4
Comments
I am still unable to get my code to work using loops. Is this because I am creating a loop of properties inside a loop of arrays. I have a loop of multiple arrays that have variable length arrays of properties within. In other words am I trying to create a loop that is still not supported?, or it should work but there is something wrong with my code or environment? Bicep version 4.63 and I get this error, BCP124 "Property value for-expression cannot be nested." Is there a work around?
|
Hello Stefan, thank you for this post, it was really usefull ! I'd like your opinion about using loops at the resource level. Let's say you deploy 10 vnets with a loop. Then, in another resource you want to reference a special vnet, you will need to know the index of the array output which is not convenient at all. Maybe I miss something. What do you think ? |
Something you don't seem to cover is a group of objects inside an object. The loop to create this:
is not documented anywhere that I can find. I can find examples to create an array of objects, but not an object filled with objects. |
I don't know this will help anyone, but I think I got around my problem as follows. I declared an array of arrays.
And I call those arrays like this
|
Thank you, these are very good examples and good information. param vnets vnetsType, then the param is defined in the .bicepparam file. |
Hi, I am stuck on the same issue which @edgreenberg mentioned. azureStorageAccounts: { Has anyone found a way to loop this yet? |
Hi, Hope that you are doing well. I am stuck on a similar issue. Trying to filter a specific value from Output. Here my config param groupUsage array = [ resource entraIdGroup 'Microsoft.Graph/[email protected]' = [for usage in groupUsage: { output aadGroupPro array = [for (usage, i) in groupUsage: { I'm trying to filter the output to get the group Id of the group containing the word "admins". I try this with no success first(filter(entraIdGroup.outputs.aadGroupPro, x => x.aadGroupUsage == 'admins')).id Can you help please. |
I'm sorry to say that I stopped using bicep about 9 months ago. Our IT
department took over and started doing everything in terraform. I retired
in January 2024 and I'm no longer working on azure at all. I wish you the
best.
…On Wed, Sep 4, 2024, 21:16 Tchango Marcelin ***@***.***> wrote:
Hi,
Hope that you are doing well.
I am stuck on a similar issue. Trying to filter a specific value from
Output.
Here my config
param groupUsage array = [
'admins'
'businessadmins'
]
resource entraIdGroup ***@***.***' = [for usage in
groupUsage: {
displayName: toUpper('appgrp_${pernodRegionCode}*${productName}*${usage}
*${env}') mailEnabled: false mailNickname: toUpper('appgrp*
${pernodRegionCode}*${productName}*${usage}
*${env}') securityEnabled: true uniqueName: toUpper('appgrp*
${pernodRegionCode}*${productName}*${usage}_${env}')
members: members
owners: GroupOwner
}]
output aadGroupPro array = [for (usage, i) in groupUsage: {
aadGroupUsage: usage
aadGroupName: entraIdGroup[i].uniqueName
aadGroupId: entraIdGroup[i].id
}]
I'm trying to filter the output to get the group Id of the group
containing the word "admins".
I try this with no success
first(filter(entraIdGroup.outputs.aadGroupPro, x => x.aadGroupUsage ==
'admins')).id
Can you help please.
—
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABE63YE45FC3LLQ2CZN7K3ZU6WHLAVCNFSM6AAAAABNVNLFSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZQGQYTENBTG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Using loops with Bicep! 💪 – Stefan Ivemo – A blog about Microsoft Azure, Microsoft 365 and other tech stuff.
With 💪Bicep v0.3 we finally got loop support and now we can start to do some really cool stuff using Bicep. I must say I really like the new loop syntax, it’s clean, easy to read and removes a lot of the complexity we did see in ARM template copy loops. This post is dedicated to copy loops where I will show some different examples on how you can use loops in Bicep. The Bicep Loops specification can be found here.
https://blog.ivemo.se/Using-loops-with-Bicep/
The text was updated successfully, but these errors were encountered: