.github/plugins/azure-sdk-dotnet/skills/azure-resource-manager-mysql-dotnet/SKILL.md
Azure MySQL Flexible Server SDK for .NET. Database management for MySQL Flexible Server deployments. Use for creating servers, databases, firewall rules, configurations, backups, and high availability. Triggers: "MySQL", "MySqlFlexibleServer", "MySQL Flexible Server", "Azure Database for MySQL", "MySQL database management", "MySQL firewall", "MySQL backup".
npx skillsauth add microsoft/skills azure-resource-manager-mysql-dotnetInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Azure Resource Manager SDK for managing MySQL Flexible Server deployments.
dotnet add package Azure.ResourceManager.MySql
dotnet add package Azure.Identity
Current Version: v1.2.0 (GA)
API Version: 2023-12-30
Note: This skill focuses on MySQL Flexible Server. Single Server is deprecated and scheduled for retirement.
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
AZURE_RESOURCE_GROUP=<your-resource-group>
AZURE_MYSQL_SERVER_NAME=<your-mysql-server>
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.MySql;
using Azure.ResourceManager.MySql.FlexibleServers;
ArmClient client = new ArmClient(new DefaultAzureCredential());
Subscription
└── ResourceGroup
└── MySqlFlexibleServer # MySQL Flexible Server instance
├── MySqlFlexibleServerDatabase # Database within the server
├── MySqlFlexibleServerFirewallRule # IP firewall rules
├── MySqlFlexibleServerConfiguration # Server parameters
├── MySqlFlexibleServerBackup # Backup information
├── MySqlFlexibleServerMaintenanceWindow # Maintenance schedule
└── MySqlFlexibleServerAadAdministrator # Entra ID admin
using Azure.ResourceManager.MySql.FlexibleServers;
using Azure.ResourceManager.MySql.FlexibleServers.Models;
ResourceGroupResource resourceGroup = await client
.GetDefaultSubscriptionAsync()
.Result
.GetResourceGroupAsync("my-resource-group");
MySqlFlexibleServerCollection servers = resourceGroup.GetMySqlFlexibleServers();
MySqlFlexibleServerData data = new MySqlFlexibleServerData(AzureLocation.EastUS)
{
Sku = new MySqlFlexibleServerSku("Standard_D2ds_v4", MySqlFlexibleServerSkuTier.GeneralPurpose),
AdministratorLogin = "mysqladmin",
AdministratorLoginPassword = "YourSecurePassword123!",
Version = MySqlFlexibleServerVersion.Ver8_0_21,
Storage = new MySqlFlexibleServerStorage
{
StorageSizeInGB = 128,
AutoGrow = MySqlFlexibleServerEnableStatusEnum.Enabled,
Iops = 3000
},
Backup = new MySqlFlexibleServerBackupProperties
{
BackupRetentionDays = 7,
GeoRedundantBackup = MySqlFlexibleServerEnableStatusEnum.Disabled
},
HighAvailability = new MySqlFlexibleServerHighAvailability
{
Mode = MySqlFlexibleServerHighAvailabilityMode.ZoneRedundant,
StandbyAvailabilityZone = "2"
},
AvailabilityZone = "1"
};
ArmOperation<MySqlFlexibleServerResource> operation = await servers
.CreateOrUpdateAsync(WaitUntil.Completed, "my-mysql-server", data);
MySqlFlexibleServerResource server = operation.Value;
Console.WriteLine($"Server created: {server.Data.FullyQualifiedDomainName}");
MySqlFlexibleServerResource server = await resourceGroup
.GetMySqlFlexibleServerAsync("my-mysql-server");
MySqlFlexibleServerDatabaseCollection databases = server.GetMySqlFlexibleServerDatabases();
MySqlFlexibleServerDatabaseData dbData = new MySqlFlexibleServerDatabaseData
{
Charset = "utf8mb4",
Collation = "utf8mb4_unicode_ci"
};
ArmOperation<MySqlFlexibleServerDatabaseResource> operation = await databases
.CreateOrUpdateAsync(WaitUntil.Completed, "myappdb", dbData);
MySqlFlexibleServerDatabaseResource database = operation.Value;
Console.WriteLine($"Database created: {database.Data.Name}");
MySqlFlexibleServerFirewallRuleCollection firewallRules = server.GetMySqlFlexibleServerFirewallRules();
// Allow specific IP range
MySqlFlexibleServerFirewallRuleData ruleData = new MySqlFlexibleServerFirewallRuleData
{
StartIPAddress = System.Net.IPAddress.Parse("10.0.0.1"),
EndIPAddress = System.Net.IPAddress.Parse("10.0.0.255")
};
ArmOperation<MySqlFlexibleServerFirewallRuleResource> operation = await firewallRules
.CreateOrUpdateAsync(WaitUntil.Completed, "allow-internal", ruleData);
// Allow Azure services
MySqlFlexibleServerFirewallRuleData azureServicesRule = new MySqlFlexibleServerFirewallRuleData
{
StartIPAddress = System.Net.IPAddress.Parse("0.0.0.0"),
EndIPAddress = System.Net.IPAddress.Parse("0.0.0.0")
};
await firewallRules.CreateOrUpdateAsync(WaitUntil.Completed, "AllowAllAzureServicesAndResourcesWithinAzureIps", azureServicesRule);
MySqlFlexibleServerConfigurationCollection configurations = server.GetMySqlFlexibleServerConfigurations();
// Get current configuration
MySqlFlexibleServerConfigurationResource config = await configurations
.GetAsync("max_connections");
// Update configuration
MySqlFlexibleServerConfigurationData configData = new MySqlFlexibleServerConfigurationData
{
Value = "500",
Source = MySqlFlexibleServerConfigurationSource.UserOverride
};
ArmOperation<MySqlFlexibleServerConfigurationResource> operation = await configurations
.CreateOrUpdateAsync(WaitUntil.Completed, "max_connections", configData);
// Common configurations to tune
string[] commonParams = { "max_connections", "innodb_buffer_pool_size", "slow_query_log", "long_query_time" };
MySqlFlexibleServerAadAdministratorCollection admins = server.GetMySqlFlexibleServerAadAdministrators();
MySqlFlexibleServerAadAdministratorData adminData = new MySqlFlexibleServerAadAdministratorData
{
AdministratorType = MySqlFlexibleServerAdministratorType.ActiveDirectory,
Login = "[email protected]",
Sid = Guid.Parse("<entra-object-id>"),
TenantId = Guid.Parse("<tenant-id>"),
IdentityResourceId = new ResourceIdentifier("/subscriptions/.../userAssignedIdentities/mysql-identity")
};
ArmOperation<MySqlFlexibleServerAadAdministratorResource> operation = await admins
.CreateOrUpdateAsync(WaitUntil.Completed, "ActiveDirectory", adminData);
// List servers in resource group
await foreach (MySqlFlexibleServerResource server in resourceGroup.GetMySqlFlexibleServers())
{
Console.WriteLine($"Server: {server.Data.Name}");
Console.WriteLine($" FQDN: {server.Data.FullyQualifiedDomainName}");
Console.WriteLine($" Version: {server.Data.Version}");
Console.WriteLine($" State: {server.Data.State}");
Console.WriteLine($" SKU: {server.Data.Sku.Name} ({server.Data.Sku.Tier})");
}
// List databases in server
await foreach (MySqlFlexibleServerDatabaseResource db in server.GetMySqlFlexibleServerDatabases())
{
Console.WriteLine($"Database: {db.Data.Name}");
}
// List available backups
await foreach (MySqlFlexibleServerBackupResource backup in server.GetMySqlFlexibleServerBackups())
{
Console.WriteLine($"Backup: {backup.Data.Name}");
Console.WriteLine($" Type: {backup.Data.BackupType}");
Console.WriteLine($" Completed: {backup.Data.CompletedOn}");
}
// Point-in-time restore
MySqlFlexibleServerData restoreData = new MySqlFlexibleServerData(AzureLocation.EastUS)
{
CreateMode = MySqlFlexibleServerCreateMode.PointInTimeRestore,
SourceServerResourceId = server.Id,
RestorePointInTime = DateTimeOffset.UtcNow.AddHours(-2)
};
ArmOperation<MySqlFlexibleServerResource> operation = await servers
.CreateOrUpdateAsync(WaitUntil.Completed, "my-mysql-restored", restoreData);
MySqlFlexibleServerResource server = await resourceGroup
.GetMySqlFlexibleServerAsync("my-mysql-server");
// Stop server (saves costs when not in use)
await server.StopAsync(WaitUntil.Completed);
// Start server
await server.StartAsync(WaitUntil.Completed);
// Restart server
await server.RestartAsync(WaitUntil.Completed, new MySqlFlexibleServerRestartParameter
{
RestartWithFailover = MySqlFlexibleServerEnableStatusEnum.Enabled,
MaxFailoverSeconds = 60
});
MySqlFlexibleServerResource server = await resourceGroup
.GetMySqlFlexibleServerAsync("my-mysql-server");
MySqlFlexibleServerPatch patch = new MySqlFlexibleServerPatch
{
Sku = new MySqlFlexibleServerSku("Standard_D4ds_v4", MySqlFlexibleServerSkuTier.GeneralPurpose),
Storage = new MySqlFlexibleServerStorage
{
StorageSizeInGB = 256,
Iops = 6000
}
};
ArmOperation<MySqlFlexibleServerResource> operation = await server
.UpdateAsync(WaitUntil.Completed, patch);
MySqlFlexibleServerResource server = await resourceGroup
.GetMySqlFlexibleServerAsync("my-mysql-server");
await server.DeleteAsync(WaitUntil.Completed);
| Type | Purpose |
|------|---------|
| MySqlFlexibleServerResource | Flexible Server instance |
| MySqlFlexibleServerData | Server configuration data |
| MySqlFlexibleServerCollection | Collection of servers |
| MySqlFlexibleServerDatabaseResource | Database within server |
| MySqlFlexibleServerFirewallRuleResource | IP firewall rule |
| MySqlFlexibleServerConfigurationResource | Server parameter |
| MySqlFlexibleServerBackupResource | Backup metadata |
| MySqlFlexibleServerAadAdministratorResource | Entra ID admin |
| MySqlFlexibleServerSku | SKU (compute tier + size) |
| MySqlFlexibleServerStorage | Storage configuration |
| MySqlFlexibleServerHighAvailability | HA configuration |
| MySqlFlexibleServerBackupProperties | Backup settings |
| Tier | Use Case | SKU Examples |
|------|----------|--------------|
| Burstable | Dev/test, light workloads | Standard_B1ms, Standard_B2s |
| GeneralPurpose | Production workloads | Standard_D2ds_v4, Standard_D4ds_v4 |
| MemoryOptimized | High memory requirements | Standard_E2ds_v4, Standard_E4ds_v4 |
| Mode | Description |
|------|-------------|
| Disabled | No HA (single server) |
| SameZone | HA within same availability zone |
| ZoneRedundant | HA across availability zones |
using Azure;
try
{
ArmOperation<MySqlFlexibleServerResource> operation = await servers
.CreateOrUpdateAsync(WaitUntil.Completed, "my-mysql", data);
}
catch (RequestFailedException ex) when (ex.Status == 409)
{
Console.WriteLine("Server already exists");
}
catch (RequestFailedException ex) when (ex.Status == 400)
{
Console.WriteLine($"Invalid configuration: {ex.Message}");
}
catch (RequestFailedException ex)
{
Console.WriteLine($"Azure error: {ex.Status} - {ex.Message}");
}
After creating the server, connect using:
// ADO.NET connection string
string connectionString = $"Server={server.Data.FullyQualifiedDomainName};" +
"Database=myappdb;" +
"User Id=mysqladmin;" +
"Password=YourSecurePassword123!;" +
"SslMode=Required;";
// With Entra ID token (recommended)
var credential = new DefaultAzureCredential();
var token = await credential.GetTokenAsync(
new TokenRequestContext(new[] { "https://ossrdbms-aad.database.windows.net/.default" }));
string connectionString = $"Server={server.Data.FullyQualifiedDomainName};" +
"Database=myappdb;" +
$"User [email protected];" +
$"Password={token.Token};" +
"SslMode=Required;";
| SDK | Purpose | Install |
|-----|---------|---------|
| Azure.ResourceManager.MySql | MySQL management (this SDK) | dotnet add package Azure.ResourceManager.MySql |
| Azure.ResourceManager.PostgreSql | PostgreSQL management | dotnet add package Azure.ResourceManager.PostgreSql |
| MySqlConnector | MySQL data access | dotnet add package MySqlConnector |
| Resource | URL | |----------|-----| | NuGet Package | https://www.nuget.org/packages/Azure.ResourceManager.MySql | | API Reference | https://learn.microsoft.com/dotnet/api/azure.resourcemanager.mysql | | Product Documentation | https://learn.microsoft.com/azure/mysql/flexible-server/ | | GitHub Source | https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/mysql/Azure.ResourceManager.MySql |
tools
KQL language expertise for writing correct, efficient Kusto Query Language queries. Covers syntax gotchas, join patterns, dynamic types, datetime pitfalls, regex patterns, serialization, memory management, result-size discipline, and advanced functions (geo, vector, graph). USE THIS SKILL whenever writing, debugging, or reviewing KQL queries — even simple ones — because the gotchas section prevents the most common errors that waste tool calls and cause expensive retry cascades. Trigger on: KQL, Kusto, ADX, Azure Data Explorer, Fabric Real-Time Intelligence, EventHouse, Log Analytics, log analysis, data exploration, time series, anomaly detection, summarize, where clause, join, extend, project, let statement, parse operator, extract function, any mention of pipe-forward query syntax.
development
Deploy, evaluate, and manage Foundry agents end-to-end: Docker build, ACR push, hosted/prompt agent create, container start, batch eval, prompt optimization, prompt optimizer workflows, agent.yaml, dataset curation from traces. USE FOR: deploy agent to Foundry, hosted agent, create agent, invoke agent, evaluate agent, run batch eval, optimize prompt, improve prompt, prompt optimization, prompt optimizer, improve agent instructions, optimize agent instructions, optimize system prompt, deploy model, Foundry project, RBAC, role assignment, permissions, quota, capacity, region, troubleshoot agent, deployment failure, create dataset from traces, dataset versioning, eval trending, create AI Services, Cognitive Services, create Foundry resource, provision resource, knowledge index, agent monitoring, customize deployment, onboard, availability. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure-prepare).
testing
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.
testing
Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription".