AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

azure-resource-manager-sql-dotnet

Azure Resource Manager SDK for Azure SQL in .NET. Use for MANAGEMENT PLANE operations: creating/managing SQL servers, databases, elastic pools, firewall rules, and failover groups via Azure Resource Manager. NOT for data plane operations (executing queries) - use Microsoft.Data.SqlClient for that. Triggers: "SQL server", "create SQL database", "manage SQL resources", "ARM SQL", "SqlServerResource", "provision Azure SQL", "elastic pool", "firewall rule".

Original source
microsoft
License
MIT
Pinned revision
3f5b461b2314e01c400564051e92469114c5b68f

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

Ask your assistant

Use Agentic Memory skills to read microsoft--azure-resource-manager-sql-dotnet at revision 3f5b461b2314e01c400564051e92469114c5b68f, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 4

references/elastic-pools.md

Elastic Pools

Elastic pool management for Azure SQL.

Create DTU-Based Elastic Pool

using Azure.ResourceManager.Sql;
using Azure.ResourceManager.Sql.Models;

var poolData = new ElasticPoolData(AzureLocation.EastUS)
{
    Sku = new SqlSku("StandardPool")
    {
        Tier = "Standard",
        Capacity = 100 // 100 eDTUs
    },
    PerDatabaseSettings = new ElasticPoolPerDatabaseSettings
    {
        MinCapacity = 0,   // Min eDTUs per database
        MaxCapacity = 100  // Max eDTUs per database
    }
};

var poolCollection = server.GetElasticPools();
var operation = await poolCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "my-standard-pool",
    poolData);

ElasticPoolResource pool = operation.Value;

Create vCore-Based Elastic Pool

var poolData = new ElasticPoolData(AzureLocation.EastUS)
{
    Sku = new SqlSku("GP_Gen5_2")
    {
        Tier = "GeneralPurpose",
        Family = "Gen5",
        Capacity = 2 // vCores
    },
    PerDatabaseSettings = new ElasticPoolPerDatabaseSettings
    {
        MinCapacity = 0,
        MaxCapacity = 2
    },
    ZoneRedundant = false,
    LicenseType = DatabaseLicenseType.LicenseIncluded // or BasePrice for Azure Hybrid Benefit
};

await poolCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "my-vcore-pool",
    poolData);

Create Premium Elastic Pool with Zone Redundancy

var poolData = new ElasticPoolData(AzureLocation.EastUS)
{
    Sku = new SqlSku("PremiumPool")
    {
        Tier = "Premium",
        Capacity = 125 // 125 eDTUs
    },
    PerDatabaseSettings = new ElasticPoolPerDatabaseSettings
    {
        MinCapacity = 0,
        MaxCapacity = 125
    },
    ZoneRedundant = true
};

await poolCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "my-premium-pool",
    poolData);

Add Database to Elastic Pool

// Create new database in pool
var databaseData = new SqlDatabaseData(AzureLocation.EastUS)
{
    ElasticPoolId = pool.Id
};

await databaseCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "pooled-database",
    databaseData);

Move Existing Database to Elastic Pool

// Get existing database
var database = await databaseCollection.GetAsync("standalone-database");

// Update to use elastic pool
var updateData = new SqlDatabaseData(database.Value.Data.Location)
{
    ElasticPoolId = pool.Id
};

await databaseCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "standalone-database",
    updateData);

Remove Database from Elastic Pool

// Move database out of pool by assigning a standalone SKU
var updateData = new SqlDatabaseData(database.Value.Data.Location)
{
    Sku = new SqlSku("S0") { Tier = "Standard" },
    ElasticPoolId = null
};

await databaseCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "pooled-database",
    updateData);

Scale Elastic Pool

var pool = await poolCollection.GetAsync("my-elastic-pool");

var updateData = new ElasticPoolData(pool.Value.Data.Location)
{
    Sku = new SqlSku("StandardPool")
    {
        Tier = "Standard",
        Capacity = 200 // Scale up to 200 eDTUs
    },
    PerDatabaseSettings = new ElasticPoolPerDatabaseSettings
    {
        MinCapacity = 10,
        MaxCapacity = 100
    }
};

await poolCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "my-elastic-pool",
    updateData);

List Databases in Elastic Pool

var pool = await poolCollection.GetAsync("my-elastic-pool");

// Get databases in this pool
var poolDatabases = pool.Value.GetElasticPoolDatabases();

await foreach (var db in poolDatabases)
{
    Console.WriteLine($"Database: {db.Data.Name}");
    Console.WriteLine($"  Current SKU: {db.Data.CurrentSku?.Name}");
    Console.WriteLine($"  Max Size: {db.Data.MaxSizeBytes / (1024 * 1024 * 1024)} GB");
}

Monitor Elastic Pool Metrics

// Get pool resource utilization
var pool = await poolCollection.GetAsync("my-elastic-pool");

// Pool metrics are available via Azure Monitor
// Use Azure.ResourceManager.Monitor for detailed metrics

Console.WriteLine($"Pool: {pool.Value.Data.Name}");
Console.WriteLine($"State: {pool.Value.Data.State}");
Console.WriteLine($"Max Size: {pool.Value.Data.MaxSizeBytes / (1024 * 1024 * 1024)} GB");
Console.WriteLine($"DTU Capacity: {pool.Value.Data.Sku?.Capacity}");

Delete Elastic Pool

// First, move all databases out of the pool or delete them
var pool = await poolCollection.GetAsync("my-elastic-pool");

// Check for databases
var poolDatabases = pool.Value.GetElasticPoolDatabases();
await foreach (var db in poolDatabases)
{
    // Either delete or move to standalone
    await db.DeleteAsync(WaitUntil.Completed);
}

// Now delete the pool
await pool.Value.DeleteAsync(WaitUntil.Completed);

Elastic Pool SKU Reference

DTU-Based Pools

| SKU Name | Tier | eDTU Range | Max DBs | |----------|------|------------|---------| | BasicPool | Basic | 50-1600 | 500 | | StandardPool | Standard | 50-3000 | 500 | | PremiumPool | Premium | 125-4000 | 100 |

vCore-Based Pools

| SKU Pattern | Tier | vCore Range | |-------------|------|-------------| | GP_Gen5_{n} | GeneralPurpose | 2-80 | | GP_Fsv2_{n} | GeneralPurpose | 8-72 | | GP_DC_{n} | GeneralPurpose | 2-8 | | BC_Gen5_{n} | BusinessCritical | 2-80 | | BC_DC_{n} | BusinessCritical | 2-8 |

Best Practices

  1. Right-size pools: Start with estimated total DTU/vCore needs, monitor, and adjust
  2. Set per-database limits: Prevent a single database from consuming all resources
  3. Use zone redundancy for production Premium/BusinessCritical pools
  4. Monitor utilization: Scale up when consistently above 80% utilization
  5. Consider Hyperscale: For databases > 4TB or needing rapid scale
  6. Use Azure Hybrid Benefit: Set LicenseType = BasePrice if you have SQL Server licenses