Search code examples
mysqlazureazure-resource-managerazure-rm-templatecleardb

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


I am trying to manually code a ClearDB MySQL database resource within an ARM template to be of the 'Dedicated' type and of the 'Jupiter' tier, but I can't seem to find any documentation that shows how to do so within a template.

I know the ARM resource would look something like this:

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

but where is the property that defines whether the database is shared or dedicated?


Solution

  • I create the ClearDB MySQL database with different Database Types (Shared and Dedicated), and I check and compare the templates via Automation options.

    enter image description here

    Templates:

    Database Type: Shared

    {
        "$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"
                }
            }
        ]
    }
    

    Database Type: Dedicated

    {
        "$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"
                }
            }
        ]
    }
    

    In Database Type: Dedicated template, we can find the resource SuccessBricks.ClearDB/databases is defined with a dependent (SuccessBricks.ClearDB/clusters) via dependsOn element. According to the template you provide, your database type is Shared.