Create Azure Search Index, Load Data And Query From .NET SDK

Welcome to the third part of the Azure Search article series. In this article, we will cover how to create an Azure search index, load data into it, and query the search results using the .NET SDK. If you prefer watching a video on the same topic, you can find it here. This article is a continuation from the previous articles, which you can find at this link.

Before we dive into the tutorial, let’s first understand what Azure Search is. According to the official Azure Search documentation:

“Azure Search is a search-as-a-service cloud solution that gives developers APIs and tools for adding a rich search experience over private, heterogeneous content in web, mobile, and enterprise applications. Your custom code invokes data ingestion (indexing) to create and load an index. On the other side, your application code issues query requests and handles responses. The search experience is defined in your client using functionality from Azure Search, with query execution over a persisted index that you create, own, and store on Azure Search.”

Now, let’s go through a use case and the prerequisites for this tutorial:

Use Case:

  • Your source applications hold data in XML format.
  • Create a console application utility that runs at scheduled times.
  • The utility reads XML data and loads it into the Azure Search Index.
  • It also creates an Index (which can also be done from the Azure portal UI).
  • Deletes the Index if it already exists (for demonstration purposes only).
  • Uses sample queries to get search results.


  • An active Azure Search Service (Follow this link to create one).
  • An Azure Search Service admin key (Refer to this link on how to get one).
  • Visual Studio with an internet connection to download NuGet packages.

Let’s now go through the step-by-step tutorial:

Step 1:

Create a console application (using C#).

Step 2 – Install NuGet packages:

Go to Tools -> NuGet Package Manager -> Package Manager Console and run the following command:

Install-Package Microsoft.Azure.Search

If you encounter any issues while installing this package, please follow the troubleshooting steps mentioned in the article.

Step 3:

Add the required DLL references to the project.

Step 4:

Create a sample source XML file and save it in a physical folder.

Step 5:

Create an entity class called “Person” to hold the XML data.

Step 6:

Replace the main method in the program.cs file with the provided code.

Step 7:

Add the necessary supporting methods called in the main method.

Step 8:

Run the console application and observe the output.

That’s it! Now you have successfully created an Azure Search Index, loaded data into it, and queried the search results using the .NET SDK.

If you want to learn more about Azure Search and the services Skrots offers, visit our website at You can also check out all the services we provide at Thank you for reading!

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button