Provisioning an AI Search Service

Preview

Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in

Provisioning an AI Search Service

This guide shows you how to provision an AI Search Service against Locally. As with the other guides we're going to use the Azure CLI, but the same resources can be provisioned with HashiCorp Terraform, Pulumi or Bicep too.

At this time Locally doesn't have a data plane emulator for AI Search (but we plan to support this in the future), so this guide covers provisioning the service, but not the indexes, documents or queries within it.

Before you start

Plugin required

This requires the Microsoft.Search plugin, which you can install with:

$ locally plugin install --name Microsoft.Search

1. Start Locally

Firstly, we need to launch Locally which we can do from a terminal by running:

$ locally build

Once Locally has started, the Locally Dashboard will open automatically:

Screenshot of the Locally Dashboard

2. Create a Resource Group

Next we can create the Resource Group:

$ locally run az group create -n sample-resources -l berlin

There's two things to note here:

  1. The Azure CLI supports Automatic Configuration, meaning that it can automatically be configured to work against Locally just by prefixing commands with locally run.
  2. Locally intentionally uses a different set of locations to Azure as a safety precaution, so that you can be confident you're deploying against Locally rather than regular Azure. You can also configure Locally to use the Azure locations too, but you'll want to be extra sure that you're prefixing commands with locally run when you do.

3. Create the search service

With the Resource Group in place, we can create the search service:

$ locally run az search service create -g sample-resources -n samplesearch1 -l berlin --sku basic
{
  "name": "samplesearch1",
  "partitions": 1,
  "replicas": 1,
  "sku": "basic",
  "status": "running"
}

Note

Search service names are globally unique in Azure and must be lowercase, and Locally keeps the same rules. Azure also allows only one free SKU service per subscription - Locally enforces that limit too, so basic is the easier choice when you're experimenting.

replicas and partitions are what you'd scale to change query throughput and index size respectively; both default to 1.

4. Read the admin key and list services

We can read the service's admin key, as you would in Azure:

$ locally run az search admin-key show -g sample-resources --service-name samplesearch1 --query primaryKey -o tsv

Note

Locally doesn't emulate the search data plane yet. The service's endpoint doesn't resolve, so the Azure AI Search SDKs can't create indexes or run queries against it.

We can list the services in the Resource Group:

$ locally run az search service list -g sample-resources --query "[].{Name:name, Sku:sku.name, Status:status}" -o table

We can see the Search Service in the Locally Dashboard too:

Screenshot of the Search Service in the Locally Dashboard

5. Tidy up

Finally, we can tidy up. To remove the Resource Group and everything within it:

$ locally run az group delete -n sample-resources --yes

There's nothing billable to clean up, since everything ran on your machine, but it's still worth checking your teardown scripts work here before you run them against Azure.

Doing this with other tooling

Whilst this guide used the Azure CLI, AI Search works the same way through any of the tooling that Locally supports - a Microsoft.Search/searchServices resource in HashiCorp Terraform or OpenTofu, Pulumi, Bicep or an ARM Template all provision against Locally in the same way, with only the location changed.

Next steps

To check the search service and the rest of a template before you deploy it, see the ARM Deployments walkthrough. To run these commands on every push, see Using Locally in CI.

Should you encounter any issues, please take a look at the troubleshooting section.

Preview

Sign in during Public Preview to get the Team plan free, plus an early-adopter discount when we launch. Sign in

A local cloud for you and your AI agents.

Your Azure infrastructure, running on your machine. Deploy in seconds, break things freely, and ship to Azure when you're ready.