sql - 如何使用 ARM 模板将数据网关添加到 SQL 连接器

标签 sql azure azure-logic-apps azure-rm-template

我正在尝试使用 ARM 模板通过数据网关(SQL Server 连接器)连接到数据库。但我不确定我是否错过了什么,因为我收到网关连接错误。

这是我迄今为止在 api 连接中的内容:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "connections_sql_name": {
            "defaultValue": "sql",
            "type": "String"
        },
        "connections_sql_displayName": {
            "defaultValue": "displaynameDB",
            "type": "String"
        },
        "server": {
            "defaultValue": "SERV01",
            "type": "String"
        },
        "database": {
            "defaultValue": "DB01",
            "type": "String"
        },
        "authType": {
            "defaultValue": "windows",
            "type": "String"
        },
        "username": {
            "defaultValue": "USER01",
            "type": "String"
        },
        "password": {
            "defaultValue": "PASS123",
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Web/connections",
            "apiVersion": "2016-06-01",
            "name": "[parameters('connections_sql_name')]",
            "location": "northeurope",
            "properties": {
                "displayName": "[parameters('connections_sql_displayName')]",
                "customParameterValues": {},
                "parameterValues": {
                    "server": "[parameters('server')]",
                    "database": "[parameters('database')]",
                    "authType": "[parameters('authType')]",
                    "username": "[parameters('username')]",
                    "password": "[parameters('password')]"
                },
                "api": {

                    "id": "[concat('/subscriptions/{sub-id}/providers/Microsoft.Web/locations/northeurope/managedApis/', parameters('connections_sql_name'))]"
                }
            }
        }
    ]
}

这是我的逻辑应用程序输入下的一部分:

"gateway": {
                                "gatewaySettings": {
                                    "connectionDetails": [
                                        "[parameters('gatewayServer')]",
                                        "[parameters('gatewayDatabase')]"
                                    ],
                                    "credentialType": "Windows",
                                    "dataSourceType": "sql"
                                },
                                "type": "gatewaySetting"
                            },

感谢任何帮助! :)

最佳答案

尝试从逻辑应用定义中删除网关 block 并将连接定义更改为:

{
    "type": "Microsoft.Web/connections",
    "apiVersion": "2016-06-01",
    "name": "[parameters('connections_sql_name')]",
    "location": "northeurope",
    "properties": {
        "displayName": "[parameters('connections_sql_displayName')]",
        "customParameterValues": {
            
        },
        "parameterValues": {
            "server": "[parameters('server')]",
            "database": "[parameters('database')]",
            "authType": "[parameters('authType')]",
            "username": "[parameters('username')]",
            "password": "[parameters('password')]",
            "gateway": {
                "id": "/subscriptions/{sub-id}/resourceGroups/{gateway-resource-group-name}/providers/Microsoft.Web/connectionGateways/{gateway-name}"
            }
        },
        "api": {
            "id": "[concat('/subscriptions/{sub-id}/providers/Microsoft.Web/locations/northeurope/managedApis/', parameters('connections_sql_name'))]"
        }
    }
}

该文档对于连接资源中的网关属性不是很有帮助。

关于sql - 如何使用 ARM 模板将数据网关添加到 SQL 连接器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59193120/

相关文章:

sql - 我试图对两个表求和,然后从另一个表中减去一个表。 H

python - MySQL 查询参数的数量与传递给执行的参数匹配,但 Python 引发 "not all arguments converted"

azure - 当我在 azure 上创建函数应用程序时,我收到 microsoft.web/serverFarms 的 429 状态代码

c# - Azure Function 引用混合模式程序集

azure - 如何在azure上设计微服务系统并使用工作流程按顺序调用它们

azure - 这是一种以语法方式或使用 HTTP 调用取消已运行的 azure 逻辑应用程序的方法

sql - 无需加入即可获取员工及其经理的详细信息

sql - 在 JOIN 中使用 CONCAT 的方法

azure - 将输出从 terraform 传递到 Azure Devops Pipeline,并在 azure 后端存储中使用状态文件

azure - 如何监视 Azure 存储容器/子文件夹中 Blob 的创建并触发逻辑应用发送电子邮件