azure - 如何有条件地在 ARM 模板中包含 dependentOn

标签 azure azure-rm-template

我有一个场景,我需要有条件地在 ARM 模板中的资源上包含 dependentOn 属性。我尝试了下面的代码

"dependsOn": "[if(contains(parameters('abc'),'dependsOn'),parameters('abc').dependsOn, variables('defaultDependsOn'))]",

但是模板验证错误并显示以下消息

The request content was invalid and could not be deserialized: 'Error converting value "[if(contains(parameters('abc'),'dependsOn'),parameters('abc').dependsOn, variables('defaultDependsOn'))]" to type 'System.String[]'. Path 'properties.template.resources[0].dependsOn', line 1, position 2429.'.

最佳答案

该属性所依赖的含义是Define the order for deploying resources in Azure Resource Manager Templates ,您可以从此文档中获取更多详细信息。

如果指令错误也会导致循环依赖。所以你应该仔细设置dependsOn属性。

对于您发布的错误,我认为您应该按照文档所述使用真实资源设置dependsOn属性的值。

关于azure - 如何有条件地在 ARM 模板中包含 dependentOn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52673745/

相关文章:

azure - 使用 Azure AD 对本地 Sharepoint 2013 进行身份验证

c# - Azure C# 函数 : How to read from Table Storage

azure - 除了使用 ARM 模板之外,还有其他方法可以部署 Azure 数据工厂吗?

azure - 无法在 ARM 模板中为自动扩展属性添加多个配置文件

azure - 适用于 azure ubuntu 虚拟机的 Ignition Provider

Azure Synapse 分析 - Synapse 链接身份验证

javascript - 无法读取用户信息 - Adal 错误无法登录

azure - 如何在 Azure VM 上同时运行 2 个 VM 自定义脚本扩展

azure - 将访问策略添加到位于另一个资源组中的 Key Vault

Azure 资源管理器 (ARM) 模板参数未定义