- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用 ARM 模板以编程方式将数据库分配到故障转移组,但我不断收到错误“InvalidResourceIdSegment”。我在论坛中发现了一些接近的东西here ,但是这仅适用于单个数据库,因此它不能完全解决我的问题。我基本上尝试使用一个变量,该变量是我需要添加到此故障转移组的数据库的resourceIds 数组列表。
"databases": {
"critical": {
"names": [
"DB1",
"DB2",
"DB3",
"DB4"
],
"ids": [
"[resourceId('Microsoft.Sql/servers/databases', variables('serverNameWest'), 'DB1')]",
"[resourceId('Microsoft.Sql/servers/databases', variables('serverNameWest'), 'DB2')]",
"[resourceId('Microsoft.Sql/servers/databases', variables('serverNameWest'), 'DB3')]",
"[resourceId('Microsoft.Sql/servers/databases', variables('serverNameWest'), 'DB4')]"
]
}
}
这是故障转移组资源的片段
{
"type": "Microsoft.Sql/servers/failoverGroups",
"name": "[concat(variables('serverNameWest'), '/', variables('failovergroups').critical)]",
"apiVersion": "2015-05-01-preview",
"condition": "[parameters('setRedundancy')]",
"tags": {
"Environment": "[parameters('Environment')]"
},
"properties": {
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 15
},
"readOnlyEndpoint": {
"failoverPolicy": "Enabled"
},
"partnerServers": [
{
"id": "[resourceID('Microsoft.Sql/servers', variables('serverNameEast'))]"
}
],
"databases": [
"[variables('databases').critical.ids]"
]
},
"dependsOn": [
"[resourceID('Microsoft.Sql/servers', variables('serverNameEast'))]",
"[resourceID('Microsoft.Sql/servers', variables('serverNameWest'))]",
"[concat(resourceID('Microsoft.Sql/servers', variables('serverNameWest')), '/elasticpools/', variables('elasticpools').critwest)]",
"[concat(resourceID('Microsoft.Sql/servers', variables('serverNameEast')), '/elasticpools/', variables('elasticpools').criteast)]",
"BusinessCriticalWest",
"BusinessCriticalEast"
]
}
将变量 [variables('databases').ritical.ids]
传递到数据库属性总是会出现此错误:
"code": "InvalidResourceIdSegment",
"message": "url 中的 'parameters.properties.databases[0]' 段无效。"
但是,如果我单独添加它们,如下所示,一切都会正常。
"[variables('databases').critical.ids[0]]"
我尝试在属性中使用复制函数(这似乎不起作用,因为复制函数需要输入名称值对)和复制函数作为变量(它也返回有关 invalidResourceIdSegment 的相同错误) 。我很困惑,因此我们将不胜感激任何帮助。
最佳答案
@nicklaws 我刚刚在寻找其他东西时遇到了这个。
乍一看,我想知道这是否是一个问题:
variables('serverNameEast')
由于我看不到你的变量设置,所以我无法判断,但是我的变量通常如下所示:
variables('serverNameEast').name
例如。
其次,这是一个完整的 ARM 模板,我已经使用过很多次并且它有效:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"businessOwner": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "Responsible for billing of the resource"
}
},
"technicalOwner": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "Responsible for the technology decisions of the resource"
}
},
"environment": {
"type": "string",
"metadata": {
"description": "Provides information on the environment that the resource belongs to"
},
"allowedValues": [
"prod",
"nprd",
"sand"
]
},
"costCode": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "Provides a charge code or cost center to attribute the bill for the resources too. This could be a project code or cost Centre"
}
},
"projectName": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "Provides information on the project that the resource group and resources belong to."
}
},
"primaryAdministratorLogin": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "Administrator username for the server. Once created it cannot be changed."
}
},
"primaryAdministratorLoginPassword": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "The administrator login password (required for server creation)."
}
},
"sqlServerSecondaryRegion": {
"type": "string",
"metadata": {
"description": "The location of the secondary SQL Server."
}
},
"sqlServerSecondaryAdminUsername": {
"type": "string",
"metadata": {
"description": "The administrator username of the secondary SQL Server."
}
},
"sqlServerSecondaryAdminPassword": {
"type": "string",
"metadata": {
"description": "The administrator password of the secondary SQL Server."
}
},
"requestedServiceObjectiveName": {
"type": "string",
"metadata": {
"description": "The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property."
}
},
"sampleName": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "Indicates the name of the sample schema to apply when creating this database. If createMode is not Default, this value is ignored. Not supported for DataWarehouse edition. - AdventureWorksLT"
}
},
"maxSizeBytes": {
"type": "string",
"defaultValue": "107374182400",
"metadata": {
"description": "The max size of the database expressed in bytes. If createMode is not Default, this value is ignored."
}
},
"collation": {
"type": "string",
"defaultValue": "SQL_Latin1_General_CP1_CI_AS",
"metadata": {
"description": "The collation of the database. If createMode is not Default, this value is ignored."
}
},
"createMode": {
"type": "string",
"defaultValue": "Default",
"metadata": {
"description": "Specifies the mode of database creation."
}
},
"readScale": {
"type": "string",
"defaultValue": "Disabled",
"metadata": {
"description": "Specifies the mode of database creation."
}
},
"edition": {
"type": "string",
"defaultValue": "Standard",
"metadata": {
"description": "The edition of the database."
}
},
"zoneRedundant": {
"type": "bool",
"defaultValue": false,
"metadata": {
"description": "Whether or not this database is zone redundant, which means the replicas of this database will be spread across multiple availability zones."
}
},
"firewallDigitalNetworkFrom": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "firewall rule"
}
},
"firewallDigitalNetworkTo": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "firewall rule"
}
},
"firewallMelbourneOfficeFrom": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "firewall rule"
}
},
"firewallMelbourneOfficeTo": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "firewall rule"
}
},
"firewallSydneyOfficeFrom": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "firewall rule"
}
},
"firewallSydneyOfficeTo": {
"type": "string",
"defaultValue": "NOT_SET",
"metadata": {
"description": "firewall rule"
}
},
"failoverEnabled": {
"type": "string",
"defaultValue": "true",
"metadata": {
"description": "Whether we allow a secondary SQL server with failover. This could be used to save money"
}
}
},
"variables": {
"sqlServerPrimary": {
"name": "[toLower(concat(parameters('projectName'), '-',parameters('environment'), '-', 'sqlsvr-primary'))]",
"requestedServiceObjectiveName": "[parameters('requestedServiceObjectiveName')]"
},
"sqlServerSecondary": {
"name": "[toLower(concat(parameters('projectName'), '-',parameters('environment'), '-', 'sqlsvr-secondary'))]"
},
"sqlFailoverGroupName": {
"name": "[toLower(concat(parameters('projectName'), '-',parameters('environment'), '-', 'failover-group'))]"
}
},
"resources": [
{
"name": "[variables('sqlServerPrimary').name]",
"type": "Microsoft.Sql/servers",
"apiVersion": "2015-05-01-preview",
"location": "[resourceGroup().location]",
"tags": {
"BusinessOwner": "[parameters('businessOwner')]",
"TechnicalOwner": "[parameters('technicalOwner')]",
"Environment": "[parameters('environment')]",
"CostCode": "[parameters('costCode')]",
"Project": "[parameters('projectName')]"
},
"properties": {
"administratorLogin": "[parameters('primaryAdministratorLogin')]",
"administratorLoginPassword": "[parameters('primaryAdministratorLoginPassword')]",
"version": "12.0"
},
"resources": [
{
"apiVersion": "2015-05-01-preview",
"condition": "[equals(parameters('failoverEnabled'),'true')]",
"type": "failoverGroups",
"name": "[variables('sqlFailoverGroupName').name]",
"tags": {
"BusinessOwner": "[parameters('businessOwner')]",
"TechnicalOwner": "[parameters('technicalOwner')]",
"Environment": "[parameters('environment')]",
"CostCode": "[parameters('costCode')]",
"Project": "[parameters('projectName')]"
},
"properties": {
"serverName": "[variables('sqlServerPrimary').name]",
"partnerServers": [
{
"id": "[resourceId('Microsoft.Sql/servers/', variables('sqlServerSecondary').name)]"
}
],
"readWriteEndpoint": {
"failoverPolicy": "Automatic",
"failoverWithDataLossGracePeriodMinutes": 60
},
"readOnlyEndpoint": {
"failoverPolicy": "Disabled"
},
"databases": [
]
},
"dependsOn": [
"[variables('sqlServerPrimary').name]",
"[resourceId('Microsoft.Sql/servers', variables('sqlServerSecondary').name)]"
]
},
{
"name": "AllowAllWindowsAzureIps",
"type": "firewallRules",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlServerPrimary').name)]"
]
},
{
"name": "digitalNetwork",
"type": "firewallRules",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "[parameters('firewallDigitalNetworkFrom')]",
"endIpAddress": "[parameters('firewallDigitalNetworkTo')]"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlServerPrimary').name)]"
]
},
{
"name": "MelbourneOffice",
"type": "firewallRules",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "[parameters('firewallMelbourneOfficeFrom')]",
"endIpAddress": "[parameters('firewallMelbourneOfficeTo')]"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlServerPrimary').name)]"
]
},
{
"name": "SydneyOffice",
"type": "firewallRules",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "[parameters('firewallSydneyOfficeFrom')]",
"endIpAddress": "[parameters('firewallSydneyOfficeTo')]"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlServerPrimary').name)]"
]
}
]
},
{
"type": "Microsoft.Sql/servers",
"kind": "v12.0",
"condition": "[equals(parameters('failoverEnabled'),'true')]",
"name": "[variables('sqlServerSecondary').name]",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('sqlServerSecondaryRegion')]",
"tags": {
"BusinessOwner": "[parameters('businessOwner')]",
"TechnicalOwner": "[parameters('technicalOwner')]",
"Environment": "[parameters('environment')]",
"CostCode": "[parameters('costCode')]",
"Project": "[parameters('projectName')]"
},
"properties": {
"administratorLogin": "[parameters('sqlServerSecondaryAdminUsername')]",
"administratorLoginPassword": "[parameters('sqlServerSecondaryAdminPassword')]",
"version": "12.0"
},
"resources": [
{
"name": "AllowAllWindowsAzureIps",
"type": "firewallRules",
"condition": "[equals(parameters('failoverEnabled'),'true')]",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlServerSecondary').name)]"
]
},
{
"name": "digitalNetwork",
"type": "firewallRules",
"condition": "[equals(parameters('failoverEnabled'),'true')]",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "[parameters('firewallDigitalNetworkFrom')]",
"endIpAddress": "[parameters('firewallDigitalNetworkTo')]"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlServerSecondary').name)]"
]
},
{
"name": "MelbourneOffice",
"type": "firewallRules",
"condition": "[equals(parameters('failoverEnabled'),'true')]",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "[parameters('firewallMelbourneOfficeFrom')]",
"endIpAddress": "[parameters('firewallMelbourneOfficeTo')]"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlServerSecondary').name)]"
]
},
{
"name": "SydneyOffice",
"type": "firewallRules",
"condition": "[equals(parameters('failoverEnabled'),'true')]",
"apiVersion": "2015-05-01-preview",
"properties": {
"startIpAddress": "[parameters('firewallSydneyOfficeFrom')]",
"endIpAddress": "[parameters('firewallSydneyOfficeTo')]"
},
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlServerSecondary').name)]"
]
}
]
}
]
}
希望对大家有帮助。
关于Azure ARM 故障转移组数据库属性不接受变量数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52545989/
有人可以解释一下为什么这个脚本不起作用吗? function destroy(ID) { if (confirm("Deleting is a very bad thing! Sure?")
我正在尝试使 WCF Silverlight 故障按此方式工作: MSDN aricle 将 SL 故障添加到我的 Web.config 文件后,我收到以下警告: The element 'behav
这是我要删除的 Haskell 函数 2::Int和 5::Int从列表中: remPrimesFactors25 :: [Int] -> [Int] remPrimesFactors25 [] =
当我想用 ffmpeg 连接和录制两个 mp4 视频时,我遇到了这个问题。我得到的输出是: [concat @ 0x2566e80] DTS 4079 #0:0 (h264 (native) ->
我想在delphi中编写一个程序来模拟以特定速度移动的鼠标指针(类似于AutoIT MouseMove函数)。要么是我的代码错误,要么是 SetCursorPos 在被调用太多次后出现故障。这是我的功
我将“wa、or 和 id”(来自这些州的访问者)设置为重定向到 website1.com - 当我访问该网站时,它会将我重定向到 website1.com(因此它知道我在 WA) 。但如果我将 wa
我们目前正在争论通过 WCF channel 抛出错误与传递指示状态或服务响应的消息是否更好。 故障带有 WCF 的内置支持,您可以使用内置的错误处理程序并做出相应的 react 。然而,这会带来开销
不确定我在这里做错了什么,如果有任何帮助,我们将不胜感激。 尝试创建一个名为“control”的新变量,并在行变量等于这些数字时将其编码为 1,否则编码为 0。 data$control= ifels
我想在应用洞察中记录成功调用的百分比。我看到这篇文章https://learn.microsoft.com/en-us/azure/azure-monitor/app/sampling我认为固定速率采
我正在尝试使用 SVD 和特征分解来使用动态模式分解进行一些数据分析。我遇到了一个简单的问题,即从 Matlab 和 Python 获得不同的结果。我很困惑,不知道为什么 Python 给我错误的结果
This question already has an answer here: mysqli_fetch_assoc() expects parameter / Call to a member
我刚刚开始我的一个实验室,在那里我计算类(class)的 GPA,其信息存储在结构的链接列表中。截至目前,我正在尝试打印所有类(class)信息,以确保它们已正确初始化并添加到链接列表中。 我遇到了一
我正在尝试学习如何使用 visual studio 为 C++ 制作 GUI。但是我在使用 GetWindowText() 函数时遇到了一些问题。它不会将 LPTSTR 标题更改为文本框中的文本,并且
我有一个奇怪的问题。它似乎只出现在测试者的 iPhone 5s 上。它可以在运行最新 iOS (8.3) 的 iPhone 5、6 和 6 plus 上正常运行。 这是代码 -(NSString *)
我正在尝试更新 Core Data 中的一些记录。我正在采取以下步骤来完成它 带谓词的获取函数从核心数据中检索记录 将结果集存储在对象数组中 遍历数组并更新每条记录 调用保存上下文 我遇到了两个问题
我通过 Storyboard设计了 tableView,在一个单元格中我有一个按钮和一个标签。按钮在 Storyboard上有标签 1 和标签在 Storyboard上有标签 2。在 cellForR
我实现了这个方法,当在文本字段中输入了未经授权的字符或已使用的用户名时,向用户发送多个警报 View : func textFieldShouldEndEditing(textField: UITex
伙计们,我在运行程序时遇到了这个非常奇怪的错误。这是重要的代码: 变量(编辑): const short int maxX = 100; const short int maxZ = 100; con
我有这个修改过的 Matrix Javascript 代码,我想摆脱第一次运行的所有与自身重叠的字符串。有人知道我该如何管理吗?另外,我想在我的网页上多次使用此代码,我需要声明新变量,不是吗?但是当我
有谁知道是否有网站(甚至非 Microsoft)有关于 COMExceptions/HRESULTS 的详细信息。 当我尝试在使用 Copy() 函数后保存我的 Excel 工作簿时,我收到此错误:
我是一名优秀的程序员,十分优秀!