Getting started with the ARM templateedit

The best way to work with Elastic’s ARM template is using one of the official Azure command line interface (CLI) tools:

Azure CLI 2.0
A Python-based cross platform CLI, typically used on MacOS and Linux
Azure PowerShell
An Azure PowerShell module providing a rich object oriented API, typically used on Windows

Log in to CLIedit

Once a CLI is installed, log into an Azure account to use with the CLI

Azure CLI 2.0.

az login

Azure PowerShell.

Login-AzureRmAccount

and follow the instructions provided.

Deploy Elasticsearch and Kibanaedit

Now that the CLI is logged in with an account, a deployment can be started. First, choose a subscription in which to create a resource group and resources

Azure CLI 2.0.

az account set --subscription "<subscription id>"

Azure PowerShell.

Select-AzureRmSubscription -SubscriptionId "<subscription id>"

Now that a subscription is selected, create a resource group into which the resources will be deployed

Azure CLI 2.0.

az group create --name "<name>" --location "<location>"

Azure PowerShell.

New-AzureRmResourceGroup -Name "<name>" -Location "<location>"

where

<name>
is a meaningful name to provide the resource group in order to identify it for future reference
<location>
is a valid Azure location for the subscription

A resource group is a container that holds related resources. As such, those resources share the same lifecycle, permissions and policies. A resource group is tied to a specific location, which internally, is where the Azure infrastructure will persist data related to the resource group, such as deployments. The resources deployed within a resource group however, do not need to be deployed to the same location as the resource group; resources within a resource group can be deployed to any location.

Now that a resource group has been created, start a deployment of the ARM template

Azure CLI 2.0.

template_base_uri=https://raw.githubusercontent.com/elastic/azure-marketplace
template_version=7.11.1

az group deployment create \
  --resource-group "<name>" \
  --template-uri $template_base_uri/$template_version/src/mainTemplate.json \
  --parameters _artifactsLocation=$template_base_uri/$template_version/src/ \
               esVersion=7.11.1 esClusterName=elasticsearch \
               vmDataDiskCount=1 dataNodesAreMasterEligible=Yes \
               adminUsername=russ adminPassword=Password1234 \
               securityBootstrapPassword=bootstrapPassword123 \
               securityAdminPassword=adminPassword123 \
               securityKibanaPassword=kibanaPassword123 \
               securityLogstashPassword=logstashPassword123 \
               securityBeatsPassword=beatsPassword123 \
               securityApmPassword=apmPassword123 \
               securityRemoteMonitoringPassword=remoteMonitoringPassword123

Azure PowerShell.

$templateBaseUri = "https://raw.githubusercontent.com/elastic/azure-marketplace"
$templateVersion = "7.11.1"

$parameters = @{
  "_artifactsLocation" = "$templateBaseUri/$templateVersion/src/"
  "esVersion" = "7.11.1"
  "esClusterName" = "elasticsearch"
  "vmDataDiskCount" = 1
  "dataNodesAreMasterEligible" = "Yes"
  "adminUsername" = "russ"
  "adminPassword" = "Password1234"
  "securityBootstrapPassword" = "bootstrapPassword123"
  "securityAdminPassword" = "adminPassword123"
  "securityKibanaPassword" = "kibanaPassword123"
  "securityLogstashPassword" = "logstashPassword123"
  "securityBeatsPassword" = "beatsPassword123"
  "securityApmPassword" = "apmPassword123"
  "securityRemoteMonitoringPassword" = "remoteMonitoringPassword123"
}

$deployment = New-AzureRmResourceGroupDeployment -ResourceGroupName "<name>" `
  -TemplateUri "$templateBaseUri/$templateVersion/src/mainTemplate.json" `
  -TemplateParameterObject $parameters

This example will deploy

  • an Elasticsearch cluster named elasticsearch running version 7.11.1
  • Kibana 7.11.1.
  • The cluster has three master-eligible data nodes, each with a single 1024GB attached managed disk.
  • The cluster will have a trial license applied, providing access to Elastic Stack Platinum features for 30 days
  • Security feature is enabled, and the built-in users elastic, kibana[_system], logstash_system, apm_system and remote_monitoring_user are configured.

The ARM template accepts many parameters, many of which are optional. When a value is not supplied for a parameter, a default value defined within the ARM template will be used. In the example above, the number of data nodes deployed uses the default value of 3.

Deployment outputsedit

When an ARM template deployment completes successfully, the template outputs

jumpboxssh
The public SSH key used when connecting to the jumpbox VM via SSH, where the authenticationType parameter value passed is sshPublicKey
kibana
The domain name and port for the public IP address for Kibana, when kibana parameter value passed is Yes
loadbalancer
The domain name and port for the public IP address for the external load balancer, when loadBalancerType parameter value passed is external

When an output value is not applicable, "N/A" is returned.

The values can be retrieved with Azure CLI 2.0 and using, for example, jq to extract the values from JSON

Azure CLI 2.0.

outputs=$(az group deployment show --name mainTemplate \
  --resource-group "<name>" \
  --query properties.outputs)

# jq needs to be installed
jumpboxssh=$(jq -r .jumpboxssh.value <<< $outputs)
kibana=$(jq -r .kibana.value <<< $outputs)
loadbalancer=$(jq -r .loadbalancer.value <<< $outputs)

Using Azure PowerShell, the outputs can be retrieved from the $deployment variable assigned as part of the deployment command

Azure PowerShell.

$jumpboxssh = $deployment.Outputs.jumpboxssh.Value
$kibana = $deployment.Outputs.kibana.Value
$loadbalancer = $deployment.Outputs.loadbalancer.Value

Delete resource groupedit

When finished with a deployment and no longer wish to keep the resources or data around, the easiest way to delete all resources is to delete the resource group containing the resources, assuming the resource group only contains resources from the ARM template deployment

Azure CLI 2.0.

az group delete --resource-group "<name>"

Azure PowerShell.

Remove-AzureRmResourceGroup -Name "<name>"

That’s it for getting started with the ARM template. Read on to learn more about different parameter and deployment options.