简体   繁体   English

如何在 Azure SQL 服务器使用 Azure ARM 模板中一次添加多个客户端 IP 地址?

[英]How to add multiple client IP addresses at time in Azure SQL Server using Azure ARM Templates?

Currently I am working on to deploy the Azure SQL Database by adding multiple IP addresses under Firewall rules using Azure ARM templates.目前我正在努力通过使用 Azure ARM 模板在防火墙规则下添加多个 IP 地址来部署 Azure SQL 数据库。

This is the code for adding one IP address under Firewall settings of Azure SQL Server.这是在 Azure SQL 服务器的防火墙设置下添加一个 IP 地址的代码。

{
      "name": "AllowAllMicrosoftAzureIps",
      "type": "firewallrules",
      "apiVersion": "2014-04-01",
      "location": "[resourceGroup().location]",
      "properties": {
        "startIpAddress": "[parameters('startIpAddress')]",
        "endIpAddress": "[parameters('endIpAddress')]"
      },
      "dependsOn": [
        "[variables('sqlServerName')]"
      ]
    },

But I want to add the multiple IP addresses at a time under Firewall settings of Azure SQL Database using Azure ARM templates.但我想在 Azure SQL 数据库使用 Azure ARM 模板的防火墙设置下一次添加多个 IP 地址。

I haven't tested it, but I believe it would look something like this.我还没有测试过,但我相信它看起来像这样。 Use the copy iterator and supply an array of start and end IP addresses.使用copy迭代器并提供一组开始和结束 IP 地址。

"parameters": { 
    "firewallIpAddresses": { 
        "type": "object", 
        "defaultValue": [ 
            { "start": "1.1.1.0", "end": "1.1.1.10","clientName": "Client1" },
            { "start": "1.2.3.4", "end": "1.2.3.16","clientName": "Client2" },
            { "start": "1.2.0.1", "end": "1.2.0.20","clientName": "Client3" }
        ] 
    }
},
"resources": [
{
     "name": "[concat(variables('sqlServerName'), '/', parameters('firewallIpAddresses')[copyIndex()].clientName)]",
     "type": "Microsoft.Sql/servers/firewallrules",
     "apiVersion": "2014-04-01",
     "location": "[resourceGroup().location]",
     "properties": {
        "startIpAddress": "[parameters('firewallIpAddresses')[copyIndex('firewallrulecopy')].start]",
        "endIpAddress": "[parameters('firewallIpAddresses')[copyIndex('firewallrulecopy')].end]"
     },
     "dependsOn": [
        "[variables('sqlServerName')]"
    ],
    "copy": {
        "name": "firewallrulecopy",
        "count": "[length(parameters('firewallIpAddresses'))]"
    }
}
]
  "name": "nba-instance-one",
    "type": "Microsoft.Sql/servers",
    "apiVersion": "2014-04-01",
    "location": "[resourceGroup().location]",
    "tags": {
        "displayName": "sql-server-instance"
    },
    "properties": {
        "administratorLogin": "admin",
        "administratorLoginPassword": "password"
    },
    "resources": [ 
        {
            "type": "firewallRules",
            "apiVersion": "2014-04-01",
            "location": "[resourceGroup().location]",
            "name": "LaptopIp",
            "properties": {
                "startIpAddress": "39.188.172.29",
                "endIpAddress": "39.188.172.29"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Sql/servers', 'sql-server-instance')]"
            ]
        },
        {
            "type": "firewallRules",
            "apiVersion": "2014-04-01",
            "location": "[resourceGroup().location]",
            "name": "OtherIP",
            "properties": {
                "startIpAddress": "38.171.192.48",
                "endIpAddress": "38.171.192.48"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Sql/servers', 'sql-server-instance')]"
            ]
        }

If it's only a few IP addresses you could add more fire wall rules for each IP address.如果只有几个 IP 地址,您可以为每个 IP 地址添加更多防火墙规则。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Whitelist the outbound IP address of an Azure Web App in the Azure SQL server firewall settings using ARM templates - Whitelist the outbound IP address of an Azure Web App in the Azure SQL server firewall settings using ARM templates 有没有办法使用 Bicep 在 Azure SQL 服务器防火墙中配置多个不相关的 IP 地址? - Is there a way to get multiple non-related IP addresses configured in an Azure SQL Server Firewall using Bicep? 如何使用ARM模板将诊断设置添加到现有的Azure Kubernetes? - How to add Diagnostic Setting to existing Azure Kubernetes using ARM Templates? 如何使用ARM模板添加Azure Traffic Manager端点? - How to add an Azure Traffic Manager endpoint using ARM templates? 使用Azure ARM模板中的条件 - Using conditions in Azure ARM templates 添加自定义 DNS 服务器 IP 到 Azure 使用 Z47F45E65244C17EC6FA8771AEZD6 模板的 VM NIC - Add custom DNS Server IP to an Azure VM NIC using ARM Template 如何在Azure模板中多次复制子节? - How to copy subsections multiple time in Azure Templates? 具有共享 azure arm 模板的多个项目 - Multiple projects with shared azure arm templates 如何使用 ARM 模板创建 Azure DigitalTwin 模型、关系和双胞胎? - How to create Azure DigitalTwin models,relationships and twins using ARM templates? 如何使用Azure ARM模板将现有虚拟网络添加到Azure SQL数据库? - How to add the existing virtual network into Azure SQL database using Azure ARM Template?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM