Unable to create Azure Search Service in Private network using ARM template API version 2023-11-01

Rajkumar Dasari 0 Reputation points
2025-03-12T07:37:15.4733333+00:00

We have tried deploying Azure AI Search resource using ARM templates with API version 2023-11-01, ARM configurations having private network enabled for Azure AI Search, but when deployed resource, it is getting deployed in the public network.

Screenshot after deployment.png

deployment info.png

ARM template

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "searchServiceName": {
      "metadata": {
        "description": "Enter name for the Search Service Name e.g. in-aks-dev-ss"
      },
      "type": "String"
    },
    "searchServiceRegion": {
      "metadata": {
        "description": "Enter region name for the Search Service Name e.g. eastus,westus. Note: this should be other than resource group region."
      },
      "type": "String"
    },
    "searchServiceSku": {
      "defaultValue": "standard",
      "allowedValues": [
        "basic",
        "standard"
      ],
      "metadata": {
        "description": "Select the search service SKU based on requirement, default value is standard"
      },
      "type": "String"
    },
    "searchServiceReplicaCount": {
      "metadata": {
        "description": "provide replica count, range for basic is 1 to 3, range for standard SKU is 1 to 12"
      },
      "type": "int",
      "defaultValue": 1
    },
    "searchServicePartitionCount": {
      "metadata": {
        "description": "Provide partition count, max value for basic SKU is 1, range for standard SKU is 1 to 12"
      },
      "type": "int",
      "defaultValue": 1
    },
    "storageAccountName": {
      "metadata": {
        "description": "Enter name for the Storage Account e.g. inaksenvdevsa"
      },
      "type": "String"
    },
    "vnetName": {
      "type": "string",
      "metadata": {
          "description": "Name of the virtual network"
      }
    },
    "vnetID": {
      "type": "string",
      "metadata": {
          "description": "Enter the virtual nertwork resource ID"
      }
    },
    "vnetSubnetID": {
      "type": "string",
      "defaultValue": ""
    },
    "resourceTags": {
      "type": "object",
      "defaultValue":  "",
      "metadata": {
        "description": "It is a optional parameter, if tags are required provide the value."
      }
    }
  },
  "variables": {
    "location": "[resourceGroup().location]",
    "privateEndpointSStoVnetName": "ss_vnet_pe",
    "SearchservicePENicName": "[concat(variables('privateEndpointSStoVnetName'),'_nic')]",
    "privateDnsZoneName": "[concat(parameters('searchServiceName'),'.privatelink.search.windows.net')]",
    "privateDnsZoneGroupName": "[format('{0}/dnsgroupname', variables('privateEndpointSStoVnetName'))]",
  },
  "resources": [
    {
      "condition": "[not(equals(parameters('searchServiceName'), ''))]",
      "type": "Microsoft.Search/searchServices",
      "apiVersion": "2023-11-01",
      "name": "[parameters('searchServiceName')]",
      "location": "[parameters('searchServiceRegion')]",
      "tags": "[parameters('resourceTags')]",
      "sku": {
        "name": "[parameters('searchServiceSku')]"
      },
      "identity": {
          "type": "None"
      },
      "properties": {
        "hostingMode": "Default",
        "publicNetworkAccess": "disabled",
        "partitionCount": "[parameters('searchServicePartitionCount')]",
        "replicaCount": "[parameters('searchServiceReplicaCount')]"
      }
    },
    {
      "condition": "[not(equals(parameters('searchServiceName'), ''))]",
      "type": "Microsoft.Search/searchServices/sharedPrivateLinkResources", // shared private acess from SS to SA
      "apiVersion": "2023-11-01",
      "name": "[concat(parameters('searchServiceName'), '/pe_ss_sa2')]",
      "dependsOn": [
          "[resourceId('Microsoft.Search/searchServices', parameters('searchServiceName'))]"
      ],
      "properties": {
          "privateLinkResourceId": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
          "groupId": "blob",
          "requestMessage": "request for private connection between SS and SA"
      }
    },
    {
      "condition": "[not(equals(parameters('searchServiceName'), ''))]",
      "type": "Microsoft.Network/privateDnsZones",
      "apiVersion": "2024-06-01",
      "name": "[variables('privateDnsZoneName')]",
      "tags": "[parameters('resourceTags')]",
      "location": "global",
      "properties": {}
    },
    {
      "condition": "[not(equals(parameters('searchServiceName'), ''))]",
      "type": "Microsoft.Network/privateEndpoints",
      "apiVersion": "2024-05-01",
      "name": "[variables('privateEndpointSStoVnetName')]",
      "tags": "[parameters('resourceTags')]",
      "location": "[variables('location')]",
      "dependsOn": [
          "[resourceId('Microsoft.Search/searchServices', parameters('searchServiceName'))]"
      ],
      "properties": {
          "subnet": {
              "id": "[parameters('vnetSubnetID')]"
          },
          "privateLinkServiceConnections": [
              {
                  "name": "[variables('privateEndpointSStoVnetName')]",
                  "properties": {
                      "privateLinkServiceId": "[resourceId('Microsoft.Search/searchServices', parameters('searchServiceName'))]",
                      "groupIds": [
                          "searchService"
                      ]
                  }
              }
          ]
      }
    },
    {
      "condition": "[not(equals(parameters('searchServiceName'), ''))]",
      "type": "Microsoft.Network/privateDnsZones/virtualNetworkLinks",
      "apiVersion": "2024-06-01",
      "name": "[format('{0}/{1}', variables('privateDnsZoneName'), format('{0}-link', parameters('vnetName')))]",
      "location": "global",
      "tags": "[parameters('resourceTags')]",
      "dependsOn": [
          "[resourceId('Microsoft.Network/privateDnsZones', variables('privateDnsZoneName'))]"
      ],
      "properties": {
          "registrationEnabled": false,
          "virtualNetwork": {
              "id": "[parameters('vnetID')]"
          }
      }
    },
    {
      "condition": "[not(equals(parameters('searchServiceName'), ''))]",
      "type": "Microsoft.Network/privateEndpoints/privateDnsZoneGroups",
      "apiVersion": "2024-05-01",
      "name": "[variables('privateDnsZoneGroupName')]",
      "dependsOn": [
          "[resourceId('Microsoft.Network/privateDnsZones', variables('privateDnsZoneName'))]",
          "[resourceId('Microsoft.Network/privateEndpoints', variables('privateEndpointSStoVnetName'))]"
      ],
      "properties": {
          "privateDnsZoneConfigs": [
              {
                  "name": "config1",
                  "properties": {
                      "privateDnsZoneId": "[resourceId('Microsoft.Network/privateDnsZones', variables('privateDnsZoneName'))]"
                  }
              }
          ]
      }
    }
  ],
  "outputs": {
  }
}

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,222 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.