gpt4 book ai didi

arrays - ARM 模板数组参数

转载 作者:行者123 更新时间:2023-12-05 08:23:13 24 4
gpt4 key购买 nike

我有一个带有 Web 应用程序警报规则的 ARM 模板,我希望能够在其中配置哪些电子邮件收到警报。

电子邮件警报操作的片段如下:

"action": {
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleEmailAction",
"sendToServiceOwners": false,
"customEmails": [
"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="97f2faf6fefba6d7f2eff6fae7fbf2b9f4f8fa" rel="noreferrer noopener nofollow">[email protected]</a>",
"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9ffaf2fef6f3addffae7fef2eff3fab1fcf0f2" rel="noreferrer noopener nofollow">[email protected]</a>"
]
}

相同的模板用于设置生产、测试​​和开发环境。所以我想使用一个参数来进行电子邮件警报。

如何基于逗号分隔字符串或数组类型参数生成用作 "customEmails" 属性的数组?

我已经尝试过"customEmails": "[array(parameters('AlertEmailRecipients'))]",而且

"customEmails": [
[array(parameters('AlertEmailRecipients'))]
]

但都不起作用。我不知道如何告诉它“customEmails”属性值应该来自参数。

最佳答案

我使用了以下数组参数:

参数声明:

"customEmails": {
"type": "array",
"metadata": {
"description": "alert email addressess"
}
}

在参数文件中:

"customEmails": {
"value": [
"ema<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b42471a6b4f44464a424505484446" rel="noreferrer noopener nofollow">[email protected]</a>",
"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="23464e424a4f1163474c4e424a4d0d404c4e" rel="noreferrer noopener nofollow">[email protected]</a>"
]
}

用法:

"customEmails": "[parameters('customEmails')]"

关于arrays - ARM 模板数组参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47453036/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com