Blog Post

Azure Database for MySQL Blog
6 MIN READ

Unlocking Regional Insights with the Location Based Capabilities REST API

ramkumarchan's avatar
ramkumarchan
Icon for Microsoft rankMicrosoft
Aug 21, 2025

Managing MySQL Flexible Server deployments across Azure regions often means navigating differences in available features, SKUs, storage options, backup retention periods, or high availability configurations. These variations can directly impact performance, cost, and resilience, making it critical to choose the right region for each workload. That’s where the Location-Based Capability Set – List API comes in, providing a programmatic way to retrieve up-to-date, region-specific capabilities. With this API, architects and developers can quickly compare offerings across multiple regions, understand which configurations are supported, and align deployment strategies with organizational needs. Instead of relying on static documentation, teams can integrate these insights into automation pipelines, ensuring deployments are optimized for the latest regional capabilities. This enables informed decision-making, reduces the risk of misconfiguration, and accelerates the design-to-deployment cycle for MySQL Flexible Server workloads in Azure. 

What Is This API? 

This endpoint allows you to query the capabilities available for Azure Database for MySQL in a specific subscription and location. It's accessed with: 

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.DBforMySQL/locations/{locationName}/capabilitySets?api-version=2023-12-30 

You can find the subscription ID from Subscriptions 

You can find the list of regions supported by Azure Database for MySQL Flexible Server from Azure regions 

The API returns comprehensive details such as supported high-availability modes (e.g. zone redundancy), server editions (like Burstable), storage configurations, zone placement, and geo-backup support. 

A typical response from this API includes: 

  • value: An array of Capability objects for each region.
  • Inside each Capability:
    • id, name, and type: Azure Resource Manager metadata identifiers. 
    • properties.supportedFlexibleServerEditions: Lists available editions with attributes: 
      • name (e.g. “GeneralPurpose”), defaultSku, defaultStorageSize
      • supportedStorageEditions: Details like name, minStorageSize, maxStorageSize, minBackupRetentionDays, maxBackupRetentionDays, minBackupIntervalHours, maxBackupIntervalHours
      • supportedSkus: Details like vCores, supportedZones, supportedHAMode, etc.
    • properties.supportedServerVersions: Array of supported MySQL server versions (name field only).  
    • properties.supportedGeoBackupRegions: Regions eligible for geo-backup. 
    • systemData: Metadata with creation and last-modified timestamps and user/identity info.  
  • nextLink: For paging through multiple capability sets 

Interpreting Empty or Missing Values 

If fields like supportedServerVersions or supportedFlexibleServerEditions appear empty (such as empty arrays), it means your subscription currently lacks access to create servers with those configurations in the selected region. This limitation is not an error; it reflects access or availability restrictions. 

Resolution: File a support request with Azure to enable access for your subscription in the chosen region. 

Why This API Matters 

  1. Deployment Validation: Before creating a server, you can verify if your subscription supports specific configurations, such as editions, zones, or server versions in the chosen region to avoid deployment errors. For example, absence of SKUs in a region can result in failures like "No available SKUs in this location". 
  2. Automation & Infrastructure as Code: Embedding regional capability checks in automated deployment pipelines ensures that infrastructure templates only target supported configurations, making scripts resilient and reducing manual intervention.
  3. Enhanced Resilience Planning: You can programmatically detect if your region supports features like zone-redundant high availability, enabling better design for fault-tolerance across availability zones.
  4. Improved Developer Experience: Developers gain clarity on feature availability per region. Instead of guessing or trial and error, they can accurately query supported server versions or editions before launching servers.
  5. Pre-Emptive Error Handling: Rather than encountering obscure deployment errors, teams can pre-check and interpret empty or unavailable values, knowing that empty lists mean a lack of access, and that a support request may be needed to enable provisioning in that region. 

Scripts for pre-deployment validation 

Using this API in deployment automation enables region-aware, resilient, and standards-compliant deployment. The following scripts (Bash and PowerShell) can be used to programmatically query a region’s Azure Database for MySQL capabilities, extract key configuration details such as supported server versions and high-availability modes, and alert when your subscription lacks access in that region (prompting a support request). These scripts enable easier integration into automated workflows or deployment pipelines. 

Bash Script 

GetLocationCapabilities.sh 

#!/usr/bin/env bash
set -euo pipefail

# Usage message function
usage() {
  echo "Usage: $0 --subscriptionId <subscriptionId> --location <location>"
  exit 1
}

# Parse named parameters using GNU getopt
ARGS=$(getopt -o '' --long subscriptionId:,location: -n "$0" -- "$@") || usage
eval set -- "$ARGS"

while true; do
  case "$1" in
    --subscriptionId)
      subscriptionId="$2"
      shift 2
      ;;
    --location)
      location="$2"
      shift 2
      ;;
    --)
      shift
      break
      ;;
    *)
      usage
      ;;
  esac
done

# Validate required arguments
if [[ -z "${subscriptionId-}" || -z "${location-}" ]]; then
  echo "Error: Missing required parameters."
  usage
fi

apiVersion="2023-12-30"
uri="/subscriptions/${subscriptionId}/providers/Microsoft.DBforMySQL/locations/${location}/capabilitySets?api-version=${apiVersion}"

echo "INFO: Calling API - GET $uri"

# Execute API call with logging
if response=$(az rest --method GET --uri "$uri" --output json --only-show-errors); then
  echo "INFO: API call succeeded"
else
  echo "ERROR: API call failed"
  exit 1
fi

data=$(echo "$response" | jq .)

# Check for 'value' array
if [[ "$(echo "$data" | jq '.value | length')" -lt 1 ]]; then
  echo "WARN: No capabilitySets returned — your subscription may lack access in region '$location'. Consider filing a support request."
  exit 0
fi

echo -e "\nSupported MySQL server versions in region '$location':"
supported_versions=$(echo "$response" | jq -r '.value[0].properties.supportedServerVersions // [] | .[]? | .name // empty')
if [[ -n "$supported_versions" ]]; then
  echo "$supported_versions" | sed 's/^/- /'
else
  echo "  [Warning] No supported server versions found; your subscription may lack access in this region. Consider filing a support request."
fi

echo -e "\nAvailable Flexible Server editions and HA modes:"
editions=$(echo "$response" | jq -c '.value[0].properties.supportedFlexibleServerEditions // [] | .[]?')
if [[ -n "$editions" ]]; then
  while IFS= read -r edition; do
    name=$(jq -r '.name' <<< "$edition")
    echo "Edition: $name"
    jq -c '.supportedSkus[]?' <<< "$edition" | while IFS= read -r sku; do
      sku_name=$(jq -r '.name' <<< "$sku" )
      hamodes=$(jq -r '.supportedHAMode | join(", ")' <<< "$sku")
      echo "  SKU Name: $sku_name; HA Modes: $hamodes"
    done
  done <<< "$editions"
else
  echo "  [Warning] No server editions found; your subscription may lack access in this region. Consider filing a support request."
fi

 

Usage Example

./GetLocationCapabilities.sh --subscriptionId 01234567-89ab-cdef-0123-456789abcdef --location eastus
PowerShell Script

GetLocationCapabilities.ps1

param(
  [Parameter(Mandatory = $true)][string]$SubscriptionId,
  [Parameter(Mandatory = $true)][string]$Location
)

Connect-AzAccount -Subscription $SubscriptionId | Out-Null

$apiVersion = "2023-12-30"
$uri = "/subscriptions/$SubscriptionId/providers/Microsoft.DBforMySQL/locations/$Location/capabilitySets?api-version=$apiVersion"

# Log request details
Write-Host "INFO: Calling API - GET $uri" -ForegroundColor Cyan

try {
    $response = Invoke-AzRestMethod -Method GET -Path $uri -ErrorAction Stop
    Write-Host "INFO: API call succeeded" -ForegroundColor Green
}
catch {
    Write-Host " ** REST API call failed **" -ForegroundColor Red
    Write-Host "Error Message: $($_.Exception.Message)"
    if ($_.Exception.Response) {
        # Attempt to extract HTTP status if available
        $status = $_.Exception.Response.StatusCode.value__ 2>$null
        if ($status) { Write-Host "Status Code: $status" }
    }
    return
}

$data = $response.Content | ConvertFrom-Json
# Check if 'value' exists and has at least one item
if (-not $data.value -or $data.value.Count -eq 0) {
    Write-Warning "No capabilitySets returned in the response. You may not have access in region '$Location'. Consider filing a support request."
    return
}

$capability = $data.value[0]

# Supported server versions
$supportedVersions = $capability.properties.supportedServerVersions | Select-Object -ExpandProperty name
Write-Host "`nSupported MySQL server versions in '$Location':"
if ($supportedVersions) {
    $supportedVersions | ForEach-Object { Write-Host "- $_" }
} else {
    Write-Warning "No supported server versions available; your subscription may lack access in this region. Consider filing a support request."
}

# Flexible Server editions & HA modes
Write-Host "`nAvailable Flexible Server editions and HA modes:"
$editions = $capability.properties.supportedFlexibleServerEditions
if ($editions) {
    foreach ($edition in $editions) {
        Write-Host "`nEdition: $($edition.name)"
        foreach ($sku in $edition.supportedSkus) {
            $haModes = $sku.supportedHAMode -join ", "
            Write-Host "  SKU Name: $($sku.name); HA Modes: $haModes"
        }
    }
} else {
    Write-Warning "No server editions available; your subscription may lack access in this region. Consider filing a support request."
}

 

Usage Example

.\GetLocationCapabilities.ps1 -SubscriptionId "01234567-89ab-cdef-0123-456789abcdef" -Location "eastus" 

 

These PowerShell and Bash scripts help you quickly check Azure Database for MySQL capabilities in a region to prevent deployment issues and ensure reliable provisioning workflows. You can modify these scripts to extract the required information from the API response. 

Feel free to comment below or write to us with your feedback and queries at AskAzureDBforMySQL@service.microsoft.com 

Updated Aug 21, 2025
Version 2.0
No CommentsBe the first to comment