Member-only story

How to Deploy Azure AI Search with a Private Endpoint using Terraform

--

In this story, we will learn how to deploy Azure AI Search service with Private Endpoint using Terraform in Azure.

The Azure AI Search Service (formerly known as “Azure Cognitive Search”) provides secure information retrieval at scale over user-owned content in traditional and generative AI search applications.

Information retrieval is foundational to any app that surfaces text and vectors. Common scenarios include catalog or document search, data exploration, and increasingly chat-style apps over proprietary grounding data.

1. Defining the Azure Provider

First, we will define Azure authentication variables.

We will use a Service Principal with a Client Secret. Check the link below for more info about Azure authentication for Terraform: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret

variable "azure_subscription_id" {
type = string
description = "Azure Subscription ID"
}

variable "azure_client_id" {
type = string
description = "Azure Client ID"
}

variable "azure_client_secret" {
type = string
description = "Azure Client Secret"
}

variable "azure_tenant_id" {
type = string
description = "Azure Tenant ID"
}

Then, we will configure Terraform and the Azure provider:

# Define Terraform provider
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
}
}
}

# Configure the Azure provider
provider "azurerm" {
features {}
environment = "public"
subscription_id = var.azure-subscription-id
client_id = var.azure-client-id
client_secret = var.azure-client-secret
tenant_id = var.azure-tenant-id
}

2. Creating a Resource Group for AI Search Resources

In this step, we will create an Azure Resource Group to store all the Azure resources created by our Terraform code.

We will start defining the location variable in the “variables.tf” file:

# Azure Region
variable "location" {
type = string
description = "The…

--

--

Guillermo Musumeci
Guillermo Musumeci

Written by Guillermo Musumeci

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | ex-AWS | Entrepreneur | Book Author | Husband & Dad of ✌

Responses (1)