ARM Template for Azure Sql Server Private End Point

Copper Contributor

Hi,

 

I am using the below Template and Parameter file to create Private End point connection for SQL servers. But i am getting the template error, PLease help me on that.

 

Template:

 

{

    "$schema": https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#,

    "contentVersion": "1.0.0.0",

    "parameters": {

      "privateEndpointName": {

        "type": "String"

      },

      "privateLinkResource": {

        "type": "String"

      },

      "subnet": {

        "type": "String"

      },

      "subnetAddressPrefix": {

        "type": "String"

      },

      "vNetSubnetName": {

        "type": "String"

      },

      "virtualNetworkResourceGroup": {

        "type": "String"

      },

      "subnetDeploymentName": {

        "defaultValue": "subnetDeploymentName",

        "type": "String"

      }

    },

    "variables": {},

    "resources": [

      {

        "type": "Microsoft.Network/privateEndpoints",

        "apiVersion": "2020-03-01",

        "name": "[parameters('privateEndpointName')]",

        "location": "NorwayEast",

        "dependsOn": ["[parameters('subnetDeploymentName')]"],

        "properties": {

          "subnet": {

            "id": "[parameters('subnet')]"

          },

          "privateLinkServiceConnections": [

            {

              "name": "[parameters('privateEndpointName')]",

              "properties": {

                "privateLinkServiceId": "[parameters('privateLinkResource')]",

                "groupIds": ["sqlServer"]

              }

            }

          ]

        }

      },

      {

        "type": "Microsoft.Resources/deployments",

        "apiVersion": "2017-05-10",

        "name": "[parameters('subnetDeploymentName')]",

        "properties": {

          "mode": "Incremental",

          "template": {

            "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",

            "contentVersion": "1.0.0.0",

            "resources": [

              {

                "name": "[parameters('vNetSubnetName')]",

                "id": "[parameters('subnet')]",

                "properties": {

                  "addressPrefix": "[parameters('subnetAddressPrefix')]",

                  "delegations": [],

                  "privateEndpointNetworkPolicies": "Disabled",

                  "privateLinkServiceNetworkPolicies": "Enabled"

                },

                "type": "Microsoft.Network/virtualNetworks/subnets",

                "apiVersion": "2020-05-01"

              }

            ]

          }

        },

        "resourceGroup": "[parameters('virtualNetworkResourceGroup')]"

      }

    ]

  }

 

Parameter File:

 

{

  "$schema": https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#,

  "contentVersion": "1.0.0.0",

  "parameters": {

    "privateEndpointName": {

      "value": "Name of the Private end point"

    },

    "privateLinkResource": {

      "value": "Resource id"

    },

    "subnet": {

      "value": "Resource ID"

    },

    "subnetAddressPrefix": {

      "value": "10.27.0.0/16"

    },

    "vNetSubnetName": {

      "value": "default"

    },

    "virtualNetworkResourceGroup": {

      "value": "RGNAME

    },

    "subnetDeploymentName": {

        "value": "subnetDeploymentName"

      }

  }

 

Error:

Deployment template validation failed: 'The template resource 'default' for type 'Microsoft.Network/virtualNetworks/subnets' at line '1' and column '799' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name. Please see https://aka.ms/arm-template/#resources for usage details.'. (Code: InvalidTemplate)

 

Regards,

Vignesh

0 Replies