Skip to content

Commit d995fa2

Browse files
authored
Merge pull request #109 from MicrosoftCloudEssentials-LearningHub/enablingAutoscaleIOPSmySQL_Script
code base
2 parents c0e3c86 + 173f5a6 commit d995fa2

2 files changed

Lines changed: 62 additions & 3 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Autoscale IOPS for multiple Azure MySQL Flexible Server
2+
3+
Costa Rica
4+
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6+
[brown9804](https://github.com/brown9804)
7+
8+
Last updated: 2025-05-13
9+
10+
----------
11+
12+
> Using [Python 3.7+](https://www.python.org/downloads/source/)
13+
14+
> [!NOTE]
15+
> Enable Autoscale IOPS via REST API, as now this is the only way to automate enabling Autoscale IOPS since, Azure CLI and PowerShell do not support this setting yet.
16+
17+
> [!IMPORTANT]
18+
> Autoscale IOPS is `only available` for the `General Purpose` and `Business Critical tiers`. `Burstable tier` (B-series) servers (e.g., B1ms) `do not support autoscale IOPS`.
19+
20+
## Pre-requisites
21+
22+
- Install azure-identity with: `py -m pip install azure-identity requests`
23+
24+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/fa74f47c-bef2-4ad3-8b0f-2ee50813c486" />
25+
26+
- [Install Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) to work with both Terraform and Azure commands.
27+
28+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/3f552ecc-8e07-453a-9655-8bb5a89e1791" />
29+
30+
## By Resource Group
31+
32+
> - Automatically retrieves your **Azure subscription ID** using the Azure CLI. <br/>
33+
> - Prompts you only for the **resource group name**. <br/>
34+
> - Lists all MySQL Flexible Servers in that resource group. <br/>
35+
> - Sends a `PATCH request`` to enable `autoIoScaling` for each server using the `Azure REST API`
36+
37+
Review [the script](./enable_autoscale_iops_byRG.py), and download it to your local machine.
38+
39+
## Across a Subscription
40+
41+
> You can also enable autoscale IOPS across an entire subscription, it requires: <br/>
42+
> - Listing all MySQL Flexible Servers in the subscription. <br/>
43+
> - For each server, retrieving its resource group. <br/>
44+
> - Applying the update if the server is in a supported tier (General Purpose or Business Critical). <br/>
45+
46+
Review [the script](./enable_autoscale_iops.py), and download it to your local machine.
47+
48+
## How to execute it Azure CLI Script to Enable Autoscale IOPS
49+
50+
1. Download [the script](./enable_autoscale_iops.py) to your local machine or a cloud shell environment.
51+
2. Make sure you're logged in: `az login`
52+
4. Run the script: `py enable_autoscale_iops.py`
53+
54+
> Example: enabling Autoscale IOPS on three different servers, each hosted in a separate resource group but under the same subscription.
55+
56+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/22aa763d-b358-441a-b5b9-aa0197ce680d" />
57+
58+
<div align="center">
59+
<h3 style="color: #4CAF50;">Total Visitors</h3>
60+
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
61+
</div>

0_Azure/1_AzureData/1_Databases/demos/11_enablingAutoscaleIOPSmySQL.md renamed to 0_Azure/1_AzureData/1_Databases/demos/11_enablingAutoscaleIOPSmySQL/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2025-05-09
8+
Last updated: 2025-05-13
99

1010
----------
1111

@@ -81,8 +81,6 @@ Last updated: 2025-05-09
8181
https://github.com/user-attachments/assets/19b96128-e37f-40b4-8e23-8a5384bc6686
8282

8383

84-
85-
8684
<div align="center">
8785
<h3 style="color: #4CAF50;">Total Visitors</h3>
8886
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>

0 commit comments

Comments
 (0)