如何在 ARM 模板中选择不同的 ClearDb MySQL 数据库类型?

How can I choose a different ClearDb MySQL database type within an ARM template?

我正在尝试将 ARM 模板中的 ClearDB MySQL 数据库资源手动编码为 'Dedicated' 类型和 'Jupiter' 层,但我似乎无法查找说明如何在模板中执行此操作的任何文档。

我知道 ARM 资源看起来像这样:

  {
      "apiVersion": "2014-01-01",
      "name": "[variables('databaseName')]",
      "type": "SuccessBricks.ClearDB/databases",
      "plan": {
        "name": "Jupiter",
        "product": "databases",
        "publisher": "cleardb"
      },
      "location": "[resourceGroup().location]",
      "tags": {}
   }

但是定义数据库是共享还是专用的 属性 在哪里?

我创建了具有不同数据库类型(共享和专用)的 ClearDB MySQL 数据库,并通过 自动化选项 检查和比较模板。

模板:

数据库类型:共享

{
    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "cdbName": {
            "type": "string"
        },
        "cdbLocation": {
            "type": "string"
        },
        "cdbSku": {
            "type": "string"
        }
    },
    "resources": [
        {
            "apiVersion": "2014-04-01",
            "name": "[parameters('cdbName')]",
            "location": "[parameters('cdbLocation')]",
            "tags": {
                "provision_source": "RMS"
            },
            "type": "SuccessBricks.ClearDB/databases",
            "plan": {
                "name": "[parameters('cdbSku')]",
                "product": "databases",
                "publisher": "cleardb"
            }
        }
    ]
}

数据库类型:专用

{
    "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "cdbName": {
            "type": "string"
        },
        "cdbLocation": {
            "type": "string"
        },
        "cdbSku": {
            "type": "string"
        },
        "clusterName": {
            "type": "string"
        }
    },
    "resources": [
        {
            "apiVersion": "2014-04-01",
            "name": "[parameters('clusterName')]",
            "location": "[parameters('cdbLocation')]",
            "tags": {
                "provision_source": "RMS"
            },
            "type": "SuccessBricks.ClearDB/clusters",
            "plan": {
                "name": "[parameters('cdbSku')]",
                "product": "cluster",
                "publisher": "cleardb_clusters"
            }
        },
        {
            "apiVersion": "2014-04-01",
            "name": "xxxcleardbtest",
            "location": "[parameters('cdbLocation')]",
            "tags": {
                "provision_source": "RMS"
            },
            "type": "SuccessBricks.ClearDB/databases",
            "plan": {
                "name": "Free"
            },
            "dependsOn": [
                "[concat('SuccessBricks.ClearDB/clusters/', parameters('clusterName'))]"
            ],
            "properties": {
                "cluster": "/subscriptions/[object Object]/resourcegroups/xxxxxxxx/providers/SuccessBricks.ClearDB/clusters/DefaultCluster"
            }
        }
    ]
}

在数据库类型:专用模板中,我们可以通过 dependsOn 元素找到资源 SuccessBricks.ClearDB/databases 被定义为依赖 (SuccessBricks.ClearDB/clusters)。根据您提供的模板,您的数据库类型是共享的。