数据库的Azure ARM故障转移组条件关联

编程入门 行业动态 更新时间:2024-10-19 13:23:57
本文介绍了数据库的Azure ARM故障转移组条件关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在研究一个ARM模板,在该模板中,我可以有条件地控制故障转移组中数据库之一的关联.这是我的示例资源模板

I am working on an ARM template where I can conditionally control the association of one of the databases in the fail-over group. Here is my sample resource template

{ "condition": "[variables('Resources').IsFailover]", "name": "[variables('SqlServer').FailoverGroup.Name]", "type": "failoverGroups", "apiVersion": "2015-05-01-preview", "location": "[variables('SqlServer').Servers.Primary.ResourceLocation]", "tags": { "displayName": "Failover Group" }, "properties": { "partnerServers": [ { ... } ], "readWriteEndpoint": { .... }, "readOnlyEndpoint": { "failoverPolicy": "Disabled" }, "databases": [ "[variables('SqlServer').Databases.DBOne.ResourceId]", "[variables('SqlServer').Databases.DBTwo.ResourceId]", "[variables('SqlServer').Databases.DBThree.ResourceId]" ] }, "dependsOn": [ "[variables('SqlServer').Servers.Primary.ResourceId]", "[variables('SqlServer').Servers.Secondary.ResourceId]", "[variables('SqlServer').Databases.DBOne.ResourceId]", "[variables('SqlServer').Databases.DBTwo.ResourceId]", "[variables('SqlServer').Databases.DBThree.ResourceId]" ] }

我想实现仅当标志(输入参数)为true时才将DBTwo(数据库)与故障转移组相关联,而如果标志为false则不希望将同一组中的所有故障关联起来.

I want to achieve something like associating the DBTwo(database) with the fail-over group only if a flag(input parameter) is true and not associating if the flag is false all from the same group.

有没有办法从ARM做到这一点?

Is there a way to do this from ARM ?

预先感谢您的任何意见和建议.

Thanks in advance for any advice and suggestions.

推荐答案

是的,手臂模板支持条件句(咳嗽,咳嗽).您可以使用if()函数和其他几个函数(and,not,or等)来创建条件.

Yes, arm template has support for conditionals (cough, cough). you can use if() function and several others (and, not, or, etc) to create conditions.

docs.microsoft/zh-CN/azure/azure-resource-manager/resource-group-template-functions-logical

那么简单的例子:

if(equals(parameter('x'), 'FAILOVER'), true, false)

更多推荐

数据库的Azure ARM故障转移组条件关联

本文发布于:2023-10-23 05:42:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519961.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:故障   条件   数据库   ARM   Azure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!