Skip to content

Autoscale IOPS for multiple Azure MySQL Flexible Server

This automation uses Python 3.7 or later.

Table of Content (Click to expand)

Note

Use the Azure REST API to automate Autoscale IOPS. Azure CLI and PowerShell do not currently support this setting.

Warning

Autoscale IOPS is available only for the General Purpose and Business Critical tiers. Burstable B-series servers such as B1ms do not support it.

Pre-requisites

  • Install azure-identity with: py -m pip install azure-identity requests

    image

  • Install Azure CLI.

    image

By Resource Group

Overall process:

  • Automatically retrieves your Azure subscription ID using the Azure CLI.
  • List all Resource Groups in current subscription ID.
  • Prompts you only for the resource group name.
  • Lists all MySQL Flexible Servers in that resource group. Few conditions were added to review which servers are available for update.
  • Sends a PATCH request to enable autoIoScaling for each server using the Azure REST API

Review the resource-group automation script, then download it to your local machine.

Example: enabling Autoscale IOPS on two different servers, each hosted in same resource group and same subscription.

Across a Subscription

You can also enable autoscale IOPS across an entire subscription, overall process:

  • Listing all MySQL Flexible Servers in the subscription.
  • For each server, retrieving its resource group.
  • Applying the update if the server is in a supported tier (General Purpose or Business Critical).

Review the subscription automation script, then download it to your local machine.

Example: enabling Autoscale IOPS on different servers, each hosted in different resource group and same subscription.

Run the automation scripts

  1. Download the automation scripts to your local machine or Cloud Shell environment.
  2. Make sure you're logged in: az login
  3. Run the script: python {script-name}.py