Feature request : Find an object by key from an array / dictionary of objects #8654
Answered
by
SimonWahlin
pinakighatak
asked this question in
Q&A
-
Hello Team. If you have an array of objects (with Key / value pair), how do you retrieve an object, given the key? Here is an illustration: var partsUnlimitedUsers = [
{
userId: 'billp'
firstName: 'Bill'
lastName: 'Palmer'
email: 'billp@partsunlimited.com'
state: 'active'
notes: 'VP of IT Operations'
type: 'Basic' //Value is 'Azure' if user is in Azure AD
}
{
userId: 'dickl'
firstName: 'Dick'
lastName: 'Landry'
email: 'dickl@partsunlimited.com'
state: 'active'
notes: 'CFO'
type: 'Basic' //Value is 'Azure' if user is in Azure AD
}
]
//add set of users to existing API Management
resource apimUser 'Microsoft.ApiManagement/service/users@2021-01-01-preview' = [for usr in partsUnlimitedUsers: {
parent: apiManagement
name: usr.userId
properties: {
firstName: usr.firstName
lastName: usr.lastName
email: usr.email
state: usr.state
note: usr.notes
identities: [
{
id: usr.email
provider: usr.type
}
]
}
}]
//now somewhere down the line, I need the **userobject where userId = dickl** The bicep object functions have many methods, except the one I want. Any help? |
Beta Was this translation helpful? Give feedback.
Answered by
SimonWahlin
Oct 12, 2022
Replies: 1 comment 3 replies
-
This is where the new lambda expressions come in handy. Check out Johns blog: https://johnlokerse.dev/2022/09/26/azure-bicep-lambda-expressions/ |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
StefanIvemo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is where the new lambda expressions come in handy.
Check out Johns blog: https://johnlokerse.dev/2022/09/26/azure-bicep-lambda-expressions/