Skip to content

Microsoft Azure

Microsoft Azure

Microsoft Azure is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.

The documentation below explains how to configure Microsoft Azure cloud provider.

Azure Setup


Before trying to configure Microsoft Azure, make sure you have:

  • A Microsoft Azure Account with a valid subscription.

Resource Group

Microsoft Azure Resource Group

The resource group is a container that holds related Azure resources.

How to create a resource group

  • Go to Resource Groups,
  • Click on Add,
  • In Basics section, select the subscription and enter octoperf in Resource group name,
  • Select the region where the group should be located (Here in (Europe) France Central),
  • Click on Review + Create.

The resource group must be named octoperf (all lowercase characters).

Enterprise Application

The next step is to create Azure application credentials so OctoPerf can programmatically start and stop virtual machines on Microsoft Azure. Please see How to Use Azure to create an application that can access resources.

Basically, you need to:

  • Create an Azure Application Registration in App Registrations with the name you want (Example: OctoPerf), Application type Web app / API and no sign-on URL needed,
  • Assign the newly created application a Contributor or equivalent so the application can create, start and stop virtual machines (See How to create Service Principal)
  • Create an Application Client Secret later used to authenticate from OctoPerf.

Once done, please keep a-side:

  • (Client) Application Id,
  • Client Secret,
  • Tenant Id,
  • And subscription Id.

Those information are needed to allow OctoPerf to connect to your Microsoft Azure account.

Virtual Networks

Microsoft Azure Virtual Network

A virtual network for each Azure Location is required. Virtual machines spinned up by octoperf are configured with this virtual network.

Creating a virtual network

  • Go to Virtual Networks,
  • Click on + Add,
  • Name the virtual network with octoperf- prefix followed by the location id. Example: octoperf-francecentral in France Central,
  • Enter Address Space. Example:,
  • Select octoperf resource group,
  • Select the location where to create the virtual network. Example: France Central,
  • Enter the Address Range. Example:,
  • DDos Protection set at your convenience. Defaults to Basic,
  • Service Endpoints and Firewall can be left as Disabled.

Make sure the name of the virtual network starts with octoperf-. Create a virtual network per location, preferrably named octoperf-location (replace location by the actual location).

Microsoft Azure Shared Image Gallery

Our Azure integration uses Shared Image Galleries as virtual machine base image.

Create Shared Image Gallery

  • In Azure Portal, Open Shared Image Galleries,
  • Create a shared image gallery whose name starts with OctoPerf (case-insensitive).

The next step is to create a shared image definition.

Create Image Definition

  • Select the newly created image gallery (named OctoPerfGallery in our case),
  • Click on Add new image definition,
  • In name, prefix it with OctoPerf (cas-insensitive),
  • Enter all settings being asked such as Operating System, VM Generation (usually Gen 1), Publisher, SKU and more.

The next step is to create the first image version. The best tool to do this is Packer.

Create an Image using Packer

  • Here is an example packer script azure.pkr.hcl to build an image with Docker and octoperf images preinstalled:
packer {
  required_plugins {
    azure = {
      version = ">= 2.0.1"
      source  = ""

variable "agent_version" {
  type = string
  default = "latest"

variable "jmeter_version" {
  type = string
  default = "latest"

variable "azure_client_id" {
  type = string
  sensitive = true

variable "azure_client_secret" {
  type = string
  sensitive = true

variable "azure_subscription_id" {
  type = string
  sensitive = true

variable "azure_tenant_id" {
  type = string
  sensitive = true

locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }

source "azure-arm" "azure" {
  client_id                         = "${var.azure_client_id}"
  client_secret                     = "${var.azure_client_secret}"
  image_offer                       = "0001-com-ubuntu-server-jammy-daily"
  image_publisher                   = "Canonical"
  image_sku                         = "22_04-daily-lts"
  location                          = "westeurope"
  managed_image_name                = "octoperf-${local.timestamp}"
  managed_image_resource_group_name = "octoperf"
  managed_image_zone_resilient      = true
  os_type                           = "Linux"
  shared_image_gallery_destination {
    gallery_name        = "OctoPerfGallery"
    image_name          = "OctoPerfImage"
    image_version       = "${var.jmeter_version}"
    replication_regions = [
    resource_group      = "octoperf"
  ssh_username    = "ubuntu"
  subscription_id = "${var.azure_subscription_id}"

build {
  sources = [""]

  provisioner "shell" {
    inline = [
      "sudo rm -rvf /var/lib/apt/lists/*",
      "sudo apt-get clean",
      "curl -fsSL -o",
      "sudo sh",
      "sudo usermod -aG docker ubuntu",
      "sudo docker pull octoperf/docker-agent:${var.agent_version}",
      "sudo docker pull octoperf/jmeter-standard:${var.jmeter_version}",
      "sudo docker pull octoperf/jmeter-webdriver:${var.jmeter_version}",
      "sudo docker pull octoperf/jmeter-playwright:${var.jmeter_version}"

  provisioner "shell" {
    execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'"
    inline          = ["/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"]
    inline_shebang  = "/bin/sh -x"

  post-processor "manifest" {
    output     = "azure-manifest.json"
    strip_path = true

This is the variables file vars.json:

agent_version = "latest"
jmeter_version = "latest"

azure_client_id = "YOUR_AZURE_CLIENT_ID"
azure_client_secret = "YOUR_AZURE_CLIENT_SECRET"
azure_subscription_id = "YOUR_AZURE_SUBSCRIPTION_ID"
azure_tenant_id = "YOUR_AZURE_TENANT_ID"

Make sure to replace xx.x.x by the latest version in release notes.

To run the script:

packer init -upgrade azure.pkr.hcl
packer build -var-file=variables.pkrvars.hcl azure.pkr.hcl

Microsoft Azure Shared Image Gallery Version

Once the build is finished, it should have created an image with docker and OctoPerf docker images preinstalled. This image is not replicated by default. Fill replicated_regions to automatically replicate the image in all the specified regions.

Azure Provider

Azure Settings

Microsoft Azure Provider

The final step is to create the Microsoft Azure provider from OctoPerf UI:

  • Click on your account menu, then Private Hosts,
  • Click on + Add Provider button, then Microsoft Azure,
  • Enter the relevant information being asked.

Azure requires the following settings:

  • Application (client) ID: id of the application,
  • Client Secret: the secret password generated when creating the Azure enterprise application,
  • Directory (tenant) ID: tenant ID,
  • Subscription ID: id of the subscription to use,
  • Environment: Azure by default,
  • Resource Group: octoperf by default,
  • SSH: virtual machines created by OctoPerf can be sshed using the settings provided here,
  • SSH User: username to use to ssh into the virtual machine instance from outside,
  • SSH Password or Public Key: Either a password or an SSH public key.

Instance Types

The following Instances are available:

  • SMALL: cloud instance with about 2GB RAM, (STANDARD_B1MS used)
  • MEDIUM: cloud instance with about 4GB RAM, (STANDARD_B2S used)
  • LARGE: cloud instance with about 8GB RAM, (STANDARD_D2_V3 used)
  • XLARGE: cloud instance with about 16GB RAM. (STANDARD_D4_V3 used)

Select the instance which suits your needs. Smaller instances can simulate less concurrent users.

Shutdown Policy

The shutdown policy specifies the minimum amount of time a cloud instance should be running before being eligible for automatic shutdown.

Example: shutdown specified after 55min.


Only idle machines (not running load tests) are eligible for shutdown. OctoPerf waits until the test ends before shutting the instance down.

Memory Usage

Memory Usage

These settings are the same as for the self-hosted provider.


Microsoft Azure Provider Regions

OctoPerf automatically detected your Azure locations based on a naming convention. OctoPerf expects that you have in each location you want to use:

  • Name: name of the region,
  • Gallery: name of the shared image gallery,
  • Image: name of the image within the shared image gallery to use,
  • Version: version of the shared image to use. if none specified, the first image available is used,
  • Network name: a virtual network prefixed with octoperf- within the same region,
  • Network Subnet: a subnet with the name of your choice, usually default (must exist within the virtual network).

If no location is being pre-configured, make sure you followed all the steps in Azure Setup prior to trying to configure Azure in OctoPerf.

Static IPs

Microsoft Azure Provider Static IPs

Microsoft Azure Public IPs can be allocated through the UI. When a virtual machine is started, the public IP within the same region is automatically assigned to it.