Azure Search Service

This page shows how to write Terraform and Azure Resource Manager for Search Service and write them securely.

azurerm_search_service (Terraform)

The Service in Search can be configured in Terraform with the resource name azurerm_search_service. The following sections describe 8 examples of how to use the resource and its parameters.

Example Usage from GitHub

search_service_test.tf#L11
resource "azurerm_search_service" "basic" {
  name                = "example-search-service"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku                 = "basic"
  partition_count     = 2
search_service_test.tf#L11
resource "azurerm_search_service" "basic" {
  name                = "example-search-service"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku                 = "basic"
  partition_count     = 2
cognitive-search.tf#L1
resource "azurerm_search_service" "properties" {
  name                = format("%s-search-ukso", local.name_prefix)
  resource_group_name = azurerm_resource_group.properties.name
  location            = azurerm_resource_group.properties.location
  sku                 = "basic"
search.tf#L1
resource "azurerm_search_service" "search" {
    name = var.name
    resource_group_name = var.rg_name
    location = var.location
    sku = "free"
positive2.tf#L1
resource "azurerm_search_service" "positive2" {
  name                = "example-search-service"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku                 = "standard"
}
positive1.tf#L1
resource "azurerm_search_service" "positive1" {
  name                = "example-search-service"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku                 = "standard"
  public_network_access_enabled = true
negative.tf#L1
resource "azurerm_search_service" "example" {
  name                = "example-search-service"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku                 = "standard"
  public_network_access_enabled = false
search.tf#L14
resource "azurerm_search_service" "search" {
  name                = "customername"
  resource_group_name = azurerm_resource_group.paas_rsg.name
  location            = azurerm_resource_group.paas_rsg.location
  sku                 = "free"

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Search Service.

Microsoft.Search/searchServices (Azure Resource Manager)

The searchServices in Microsoft.Search can be configured in Azure Resource Manager with the resource name Microsoft.Search/searchServices. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

Microsoft.Search.tests.json#L34
        "type": "Microsoft.Search/searchServices",
        "apiVersion": "2015-08-19",
        "location": "West Us",
        "sku": { "name": "free" },
        "properties": { }
      }
SearchListServicesBySubscription.json#L14
                        "type": "Microsoft.Search/searchServices",
                        "tags": {
                            "app-name": "My e-commerce app"
                        },
                        "sku": {
                            "name": "standard"
SearchListServicesByResourceGroup.json#L15
                        "type": "Microsoft.Search/searchServices",
                        "tags": {
                            "app-name": "My e-commerce app"
                        },
                        "sku": {
                            "name": "standard"
SearchCreateOrUpdateService.json#L28
                "type": "Microsoft.Search/searchServices",
                "tags": {
                    "app-name": "My e-commerce app"
                },
                "sku": {
                    "name": "standard"
SearchListServicesByResourceGroup.json#L15
                        "type": "Microsoft.Search/searchServices",
                        "tags": {
                            "app-name": "My e-commerce app"
                        },
                        "sku": {
                            "name": "standard"
SearchListServicesByResourceGroup.json#L15
                        "type": "Microsoft.Search/searchServices",
                        "tags": {
                            "app-name": "My e-commerce app"
                        },
                        "sku": {
                            "name": "standard"
SearchCreateOrUpdateServiceWithIdentity.json#L31
                "type": "Microsoft.Search/searchServices",
                "tags": {
                    "app-name": "My e-commerce app"
                },
                "sku": {
                    "name": "standard"
SearchListServicesByResourceGroup.json#L15
                        "type": "Microsoft.Search/searchServices",
                        "tags": {
                            "app-name": "My e-commerce app"
                        },
                        "sku": {
                            "name": "standard"
SearchCreateOrUpdateService.json#L28
                "type": "Microsoft.Search/searchServices",
                "tags": {
                    "app-name": "My e-commerce app"
                },
                "sku": {
                    "name": "standard"
SearchCreateOrUpdateService.json#L28
                "type": "Microsoft.Search/searchServices",
                "tags": {
                    "app-name": "My e-commerce app"
                },
                "sku": {
                    "name": "standard"

Parameters

  • apiVersion required - string
  • identity optional
      • type required - string

        The identity type.

  • location required - string

    The geo-location where the resource lives

  • name required - string

    The name of the Azure Cognitive Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created.

  • properties required
      • hostingMode optional - string

        Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'.

      • networkRuleSet optional
          • ipRules optional array
              • value optional - string

                Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR format (eg., 123.1.2.3/24) to be allowed.

      • partitionCount optional - integer

        The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3.

      • publicNetworkAccess optional - string

        This value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private endpoint connections would be the exclusive access method.

      • replicaCount optional - integer

        The number of replicas in the search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU.

  • sku optional
      • name optional - string

        The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'.

  • tags optional - string

    Resource tags.

  • type required - string

Frequently asked questions

What is Azure Search Service?

Azure Search Service is a resource for Search of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Search Service?

For Terraform, the gilyas/infracost, infracost/infracost and DoesDotNet/propt-properties source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the chironconsulting/ARM-Schema-Templates, assing/alerts-extension and assing/alerts-extension source code examples are useful. See the Azure Resource Manager Example section for further details.