I am defining an alertrule inside my template.json with custom eMails which shall be alerted in case of an error. So the JSON snippet looks like this:
"resources": [
{
"type": "microsoft.insights/alertrules",
"properties": {
"action": {
"customEmails": [
"[email protected]",
"[email protected]"
]
}
}
}
]
Now I'd like to store these emails as an array-variable, something like this:
"variables": {
"alertEmails": [
"[email protected]",
"[email protected]"
]
},
"resources": [
{
"type": "microsoft.insights/alertrules",
"properties": {
"action": {
"customEmails": "[variables('alertEmails')]"
}
}
}
]
This doesn't work, but I didn't found out what the correct syntax is. Can someone tell me?
I test it with your supplied code, it works correctly on my side. The following is my used template. Please have a try to test with the following demo code.
And I follow the azure document to use
customEmails": "[split(parameters('customEmailAddresses'), ',')]"
code, it also works correctly on my side.