Skip to main content
schedule · azure

MySQL Flexible Servers with zero active connections that should run on an off-hours schedule

resource types
1
rule IDs covered
1
severity
medium

What does ZopNight detect here?

ZopNight flags an Azure Database for MySQL Flexible Server whose `Active Connections` metric averages zero, with at least 7 days of data, and whose CPU averages under 2% over 30 days. It recommends a recurring stop and start schedule, because Azure restarts a stopped server after 30 days, and prices it from the idle hours it measured.

Signal and threshold

How ZopNight evaluates MySQL Flexible Servers with zero active connections that should run on an off-hours schedule.
Field Value
Rule IDsRC-243
Categoryschedule
Severitymedium
MetricActive Connections, Host CPU Percent
Thresholdaverage connections = 0, avg CPU < 2%
Evaluation window30d
SourceZopNight
Permissions usedMicrosoft.DBforMySQL/flexibleServers/read · Microsoft.Insights/Metrics/Read

Why stopping a Flexible Server once is not enough

A Flexible Server can be stopped to pause compute billing, but only for a while. Microsoft’s stop and start guide says a server that stays stopped for 30 days in a row is started automatically, billing resumes, and it is not permissible to keep a server stopped longer than that. A server with read replicas cannot be stopped until the replicas are dropped or promoted.

So a quiet server needs a repeating pattern, not a single action. A development database nobody connects to overnight or at weekends can be stopped every evening and started every morning, and the 30-day limit never comes into play.

Checking connections and CPU on a server

Terminal window
az mysql flexible-server list \
--query "[].{name:name, rg:resourceGroup, state:state, sku:sku.name}" -o table
az monitor metrics list \
--resource /subscriptions/<sub>/resourceGroups/my-rg/providers/Microsoft.DBforMySQL/flexibleServers/my-server \
--metric active_connections cpu_percent \
--aggregation Average Maximum --interval PT1H --offset 30d

A connection average of zero across the month, with CPU in the low single digits, is the pattern.

Idle evidence ZopNight requires

  1. Azure Monitor has an Active Connections series for the server covering at least 7 days, so a server restored a few hours ago is not judged on its first quiet stretch.
  2. The connection average is zero. Any connections at all in the data rule the server out.
  3. If CPU data exists, it averages below 2%.
  4. Neither check is limited to the latest 30 days: activity anywhere in the metric history ZopNight holds vetoes the idle verdict.
  5. ZopNight has measured idle hours for the server in its activity heatmap, and the server has a monthly cost.

Servers that are left running

A server that already follows a known recurring off-hours schedule is not flagged again. Without a connection series ZopNight does not assume the server is idle; the rule needs the metric, not a tag. No measured idle hours or no cost data also means no recommendation. For servers that are in use but over-provisioned, see Azure MySQL Flexible Server Burstable Tier Opportunity.

Schedule-based saving on compute only

Terminal window
monthly saving = server monthly cost x measured idle fraction

Storage and backup storage keep billing while the server is stopped, so the real reduction applies to compute hours.

Putting the server on a stop and start schedule

  1. Confirm no application, job or replica depends on the server during the idle window.
  2. Review the suggested schedule in the recommendation.
  3. Apply it, or script it with az mysql flexible-server stop --resource-group my-rg --name my-server in the evening and az mysql flexible-server start in the morning.
  4. If the server is not needed at all, export the data and delete it instead.

See it fire on your bill.

Connect an account read-only. The first findings land in minutes.

472 rule families across 353 resource types on 22 platforms. Every threshold, metric, and IAM action is documented on these pages before you grant anything.

472 rule families documented
353 resource types covered
read-only default access level
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·