ARM Template schema for Sql Connection using an On-Premises Data Gateway

587 Views Asked by At

I have an ARM (azure resource manager) template that defines an SQL Connection.The SQL Connection needs to use an On-Premises Data Gateway resource.

My Question: What is the resource schema for configuring a SQL Connection resource to use an On-Premises Data gateway resource?

Here is the current resource JSON:

{
   "type": "Microsoft.Web/connections",
   "apiVersion": "2016-06-01",
   "name": "sql",
   "location": "southcentralus",
   "kind": "V1",
   "properties": {
      "displayName": "OnPremSqlConn",
      "parameterValues": {
      "server": "XXXXXXXXXX",
      "database": "XXXXXXXXXX",
      "authType": "windows",
      "userName": "XXXXXXXXXX",
      "password": "XXXXXXXXXX"          
      },
      "customParameterValues": {},
      "api": {
         "id": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/providers/Microsoft.Web/locations/southcentralus/managedApis/sql"
      }
   }
}
1

There are 1 best solutions below

0
On BEST ANSWER

I searched for "arm template sql connection use gateway" and this was the first result.

{
   "type": "Microsoft.Web/connections",
   "apiVersion": "2018-07-01-preview",
   "name": "[parameters('sql_1_Connection_Name')]",
   "location": "[parameters('logicAppLocation')]",
   "properties": {
    "displayName": "[parameters('sql_1_Connection_DisplayName')]",
    "customParameterValues": {},
    "api": {
        "id": "[concat(subscription().id, '/providers/Microsoft.Web/locations/', parameters('logicAppLocation'), '/managedApis/', 'sql')]"
    },
    "parameterValues": {
     "server": "[parameters('sql_1_server')]",
     "database": "[parameters('sql_1_database')]",
     "username": "[parameters('sql_1_username')]",
     "password": "[parameters('sql_1_password')]",
     "authType": "basic",
     "gateway": {
      "id": "/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.Web/connectionGateways/{{On-Premise DatagatewayName}}"
     }
}

The pertinent part being:

"id": "/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.Web/connectionGateways/{{On-Premise DatagatewayName}}"

This ID will also be available in the URL bar if you navigate to the resource within the Azure portal, or you could setup the gateway against an existing Azure SQL DB and then use the export template functionality to get an ARM template from this resource.