How to deploy Elasticsearch on an Azure Virtual Machine

Learn how to deploy Elasticsearch on Azure VM with Kibana for full control over your Elasticsearch setup configuration.

New to Elasticsearch? Join our getting started with Elasticsearch webinar. You can also start a free cloud trial or try Elastic on your machine now.

This article is part of a series where we will learn how to use Elasticsearch with Azure. In this part of the series, you’ll learn how to set up an Azure virtual machine instance and install both Elasticsearch and Kibana on it. In the next article, you’ll learn how to deploy Elasticsearch using Azure Marketplace.

Installing Elasticsearch on an Azure virtual machine is a good starting point for its simplicity and resource transparency over other solutions like Elastic Cloud Kubernetes (ECK), which provides tools to scale with ease but also a steeper learning curve.

What is an Azure Virtual Machine?

Azure Virtual Machine provides on-demand, scalable compute resources with pre-configured or custom OS images, enabling rapid infrastructure deployment while Azure manages the underlying hardware.

When to use Azure Virtual Machine?

This option is best for organizations requiring full control over their Elasticsearch configuration, custom plugins, and specific version requirements. It’s also ideal to integrate with existing VM-based infrastructure while needing granular performance tuning and cost optimization through reserved instances.

Setting up a Virtual machine

1. Log in to the Azure portal

2. In the search bar at the top, type "Virtual machines" as shown in the image below. Azure will display search suggestions, then click on "Virtual machines" from the Services section

3. You'll see the Virtual machines page (Image 2) showing "No virtual machines to display". Click on the Create button, then select Azure virtual machine from the dropdown menu options

4. Complete the following fields in the "Create a virtual machine" form:

a. Select subscription and resource group

b. Input a Virtual machine name

c. Select Region

d. Availability options

e. Zone options. In this case, leave the Self-selected zone by default

f. For Availability Zone, select Zone 1 by default. You can include up to 3 zones

g. For Security type, select default Trusted launch virtual machines

h. The image we’re using is Ubuntu server 24.04 LTS - x64 Gen2

i. Select VM architecture x64

j. Size: For this example we use Standard_B2als_v2- 2vcpus, 4 GB memory

5. Disks: Default configuration

6. Networking: Default configuration

7. Management: Default configuration

8. Monitoring: Default configuration

9. Advanced: Default configuration

10. Tags: Default configuration

11. Click on review then create. Review the Terms, costs, and configurations, and then click on the Create button

12. Ensure "Validation passed" appears (green checkmark), review terms, costs, and configurations,

13. Click on the Create button

14. Download a newly generated key pair

15. Click on Go to resource

16. Here you can connect to the instance by SSH to the public IP address or directly from the Azure UI

Configure internet access to Kibana

In order to connect to Kibana from the internet, we need to open the port in the recently created instance

1. In the instance detail page, click on Networking> Network settings

2. In the network settings page, we’re going to create an inbound port rule. Click Create port rule, then click on Inbound port rule

3. The new inbound rule to open Kibana to the internet

a. Source: Any

b. Source port ranges: *

c. Destination: Any

d. Service: Custom

e. Destination port ranges: 5601

f. Protocol: TCP

g. Priority: 310 (default)

h. Name: AllowKibana

Then click the Add button

Connect to Virtual Machine

17. To connect to the instance, click the Connect menu, then Connect

18. For this example, we’re going to use SSH using Azure CLI. Click Select under SSH using Azure CLI

19. A slide menu will show. Check consent and click the Configure + connect button

20. After the prerequisite configuration. Click Connect

21. A terminal to the instance will show up at the bottom of the page

Installing Elasticsearch

1. Download the latest Elasticsearch version and verify integrity

Verifying file integrity is a crucial security step. Always check the downloaded files to match the official checksums.

Note: If the shasum command is not found, install it:

Install perl-Digest

2. Extract files

3. Run Elasticsearch

The first time you run Elasticsearch, it generates security certificates and credentials. Make sure to save these for future use.

4. Copy the generated password, fingerprint, and enrollment token 

5. In a separate terminal from where Elasticsearch is running, navigate to the directory where you installed Elasticsearch and run the elasticsearch-create-enrollment-token tool to generate an enrollment token for your new nodes

In case you want to add new nodes, follow this guide.

6. Let’s verify that Elasticsearch is running

Replace $ELASTIC_PASSWORD with the generated password from step 3

Installing Kibana

1. Download and extract Kibana:

For production environments, consider installing Kibana on a separate instance. Here we're installing it on the same instance for simplicity.

2. In order to access Kibana from the internet, we’re going to configure a kibana.yaml file

Look for the server.host setting and set it to:

Exit and save

3. Run Kibana

4. Access from a browser to a virtual machine using a public IP address with this format:. Public IP Address can be found on step 14 of Setting up a Virtual machine

Now, access the Virtual machine's Public IP Address and add the code shown

5. Paste the Kibana enrollment token from step 3 when prompted

6. Enter the Elasticsearch username and password

Kibana installation is complete!

After completing these steps, you'll have a working Elasticsearch deployment with Kibana running on an Azure virtual machine. This setup gives you full control over your environment while leveraging the Azure infrastructure.

For production environments, you can consider configuring systemd services for automatic startup, implementing a multi-node cluster for high availability, or creating snapshot repositories as a backup.

Next Steps

Access the Azure Portal, select Elasticsearch VM images from Azure, choose VM size and storage, then deploy. Start with pay-as-you-go pricing or use free Azure credits for immediate access to a fully customizable Elasticsearch environment.

Related Content

Ready to build state of the art search experiences?

Sufficiently advanced search isn’t achieved with the efforts of one. Elasticsearch is powered by data scientists, ML ops, engineers, and many more who are just as passionate about search as you are. Let’s connect and work together to build the magical search experience that will get you the results you want.

Try it yourself