ClaudeGitHub CopilotCursorDeepSeekWindsurfClineRoo CodeOpenCodeAiderContinueCloud Management

azure-resource-manager-sql-dotnet

Azure Resource Manager SDK for Azure SQL in .NET.

31,392 stars
Complexity: easy

About this skill

This skill leverages the Azure.ResourceManager.Sql .NET SDK, enabling AI agents to provision, configure, and manage Azure SQL resources through code generation and execution. It provides programmatic access to the Azure Resource Manager (ARM) plane for Azure SQL, allowing for the creation, modification, and deletion of SQL servers, databases, elastic pools, firewall rules, and failover groups. This skill focuses on infrastructure management tasks and is distinct from data plane operations such as executing queries within a database.

Best use case

Automated provisioning of new Azure SQL servers and databases; dynamic scaling or modification of existing Azure SQL resources; configuration of network access (firewall rules); setting up high availability (failover groups) for Azure SQL deployments; integrating Azure SQL management into CI/CD pipelines through agent-driven scripts.

Azure Resource Manager SDK for Azure SQL in .NET.

Successful creation, modification, or deletion of specified Azure SQL resources (e.g., a new SQL server provisioned, a database scaled, a firewall rule updated) in the Azure subscription, with corresponding resource IDs or status confirmations.

Practical example

Example input

Create an Azure SQL Server named 'my-production-sql' in the 'East US' region, within the 'AntigravityResourceGroup'. Set the admin username to 'sqladmin' and generate a strong password. Then, create a database named 'orders-db' on this server with a 'Standard S0' service objective.

Example output

```csharp
// Example of generated .NET code (simplified for illustration)
// using Azure.Identity; using Azure.ResourceManager; using Azure.ResourceManager.Sql;
// var credential = new DefaultAzureCredential();
// var client = new ArmClient(credential, "<your-subscription-id>");
// var resourceGroup = client.GetResourceGroupResource(ResourceGroupResource.CreateResourceIdentifier("<your-subscription-id>", "AntigravityResourceGroup"));
// var sqlServerData = new SqlServerData(AzureLocation.EastUS) { AdministratorLogin = "sqladmin", AdministratorLoginPassword = "<generated-secure-password>" };
// var sqlServer = await resourceGroup.GetSqlServers().CreateOrUpdateAsync(WaitUntil.Completed, "my-production-sql", sqlServerData);
// var sqlDatabaseData = new SqlDatabaseData(AzureLocation.EastUS) { Sku = new SqlSku("Standard", "S0") };
// var sqlDatabase = await sqlServer.Value.GetSqlDatabases().CreateOrUpdateAsync(WaitUntil.Completed, "orders-db", sqlDatabaseData);
```
Successfully provisioned Azure SQL Server 'my-production-sql' and database 'orders-db'.
Server ID: /subscriptions/{subscriptionId}/resourceGroups/AntigravityResourceGroup/providers/Microsoft.Sql/servers/my-production-sql
Database ID: /subscriptions/{subscriptionId}/resourceGroups/AntigravityResourceGroup/providers/Microsoft.Sql/servers/my-production-sql/databases/orders-db

When to use this skill

  • When an AI agent needs to interact with Azure to create, update, or delete Azure SQL infrastructure components; when automating cloud resource management tasks for Azure SQL; for agents capable of generating and executing .NET code to manage cloud infrastructure.

When not to use this skill

  • When the task involves querying data within an Azure SQL database or performing data manipulation (use data plane SDKs like Microsoft.Data.SqlClient instead); when .NET is not available or preferred as the execution environment; for agents that cannot generate or execute code.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/azure-resource-manager-sql-dotnet/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/azure-resource-manager-sql-dotnet/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/azure-resource-manager-sql-dotnet/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How azure-resource-manager-sql-dotnet Compares

Feature / Agentazure-resource-manager-sql-dotnetStandard Approach
Platform SupportClaude, GitHub Copilot, Cursor, DeepSeek, Windsurf, Cline, Roo Code, OpenCode, Aider, ContinueLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Azure Resource Manager SDK for Azure SQL in .NET.

Which AI agents support this skill?

This skill is designed for Claude, GitHub Copilot, Cursor, DeepSeek, Windsurf, Cline, Roo Code, OpenCode, Aider, Continue.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Azure.ResourceManager.Sql (.NET)

Management plane SDK for provisioning and managing Azure SQL resources via Azure Resource Manager.

> **⚠️ Management vs Data Plane**
> - **This SDK (Azure.ResourceManager.Sql)**: Create servers, databases, elastic pools, configure firewall rules, manage failover groups
> - **Data Plane SDK (Microsoft.Data.SqlClient)**: Execute queries, stored procedures, manage connections

## Installation

```bash
dotnet add package Azure.ResourceManager.Sql
dotnet add package Azure.Identity
```

**Current Versions**: Stable v1.3.0, Preview v1.4.0-beta.3

## Environment Variables

```bash
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
# For service principal auth (optional)
AZURE_TENANT_ID=<tenant-id>
AZURE_CLIENT_ID=<client-id>
AZURE_CLIENT_SECRET=<client-secret>
```

## Authentication

```csharp
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Sql;

// Always use DefaultAzureCredential
var credential = new DefaultAzureCredential();
var armClient = new ArmClient(credential);

// Get subscription
var subscriptionId = Environment.GetEnvironmentVariable("AZURE_SUBSCRIPTION_ID");
var subscription = armClient.GetSubscriptionResource(
    new ResourceIdentifier($"/subscriptions/{subscriptionId}"));
```

## Resource Hierarchy

```
ArmClient
└── SubscriptionResource
    └── ResourceGroupResource
        └── SqlServerResource
            ├── SqlDatabaseResource
            ├── ElasticPoolResource
            │   └── ElasticPoolDatabaseResource
            ├── SqlFirewallRuleResource
            ├── FailoverGroupResource
            ├── ServerBlobAuditingPolicyResource
            ├── EncryptionProtectorResource
            └── VirtualNetworkRuleResource
```

## Core Workflow

### 1. Create SQL Server

```csharp
using Azure.ResourceManager.Sql;
using Azure.ResourceManager.Sql.Models;

// Get resource group
var resourceGroup = await subscription
    .GetResourceGroupAsync("my-resource-group");

// Define server
var serverData = new SqlServerData(AzureLocation.EastUS)
{
    AdministratorLogin = "sqladmin",
    AdministratorLoginPassword = "YourSecurePassword123!",
    Version = "12.0",
    MinimalTlsVersion = SqlMinimalTlsVersion.Tls1_2,
    PublicNetworkAccess = ServerNetworkAccessFlag.Enabled
};

// Create server (long-running operation)
var serverCollection = resourceGroup.Value.GetSqlServers();
var operation = await serverCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "my-sql-server",
    serverData);

SqlServerResource server = operation.Value;
```

### 2. Create SQL Database

```csharp
var databaseData = new SqlDatabaseData(AzureLocation.EastUS)
{
    Sku = new SqlSku("S0") { Tier = "Standard" },
    MaxSizeBytes = 2L * 1024 * 1024 * 1024, // 2 GB
    Collation = "SQL_Latin1_General_CP1_CI_AS",
    RequestedBackupStorageRedundancy = SqlBackupStorageRedundancy.Local
};

var databaseCollection = server.GetSqlDatabases();
var dbOperation = await databaseCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "my-database",
    databaseData);

SqlDatabaseResource database = dbOperation.Value;
```

### 3. Create Elastic Pool

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

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

ElasticPoolResource pool = poolOperation.Value;
```

### 4. Add Database to Elastic Pool

```csharp
var databaseData = new SqlDatabaseData(AzureLocation.EastUS)
{
    ElasticPoolId = pool.Id
};

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

### 5. Configure Firewall Rules

```csharp
// Allow Azure services
var azureServicesRule = new SqlFirewallRuleData
{
    StartIPAddress = "0.0.0.0",
    EndIPAddress = "0.0.0.0"
};

var firewallCollection = server.GetSqlFirewallRules();
await firewallCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "AllowAzureServices",
    azureServicesRule);

// Allow specific IP range
var clientRule = new SqlFirewallRuleData
{
    StartIPAddress = "203.0.113.0",
    EndIPAddress = "203.0.113.255"
};

await firewallCollection.CreateOrUpdateAsync(
    WaitUntil.Completed,
    "AllowClientIPs",
    clientRule);
```

### 6. List Resources

```csharp
// List all servers in subscription
await foreach (var srv in subscription.GetSqlServersAsync())
{
    Console.WriteLine($"Server: {srv.Data.Name} in {srv.Data.Location}");
}

// List databases in a server
await foreach (var db in server.GetSqlDatabases())
{
    Console.WriteLine($"Database: {db.Data.Name}, SKU: {db.Data.Sku?.Name}");
}

// List elastic pools
await foreach (var ep in server.GetElasticPools())
{
    Console.WriteLine($"Pool: {ep.Data.Name}, DTU: {ep.Data.Sku?.Capacity}");
}
```

### 7. Get Connection String

```csharp
// Build connection string (server FQDN is predictable)
var serverFqdn = $"{server.Data.Name}.database.windows.net";
var connectionString = $"Server=tcp:{serverFqdn},1433;" +
    $"Initial Catalog={database.Data.Name};" +
    "Persist Security Info=False;" +
    $"User ID={server.Data.AdministratorLogin};" +
    "Password=<your-password>;" +
    "MultipleActiveResultSets=False;" +
    "Encrypt=True;" +
    "TrustServerCertificate=False;" +
    "Connection Timeout=30;";
```

## Key Types Reference

| Type | Purpose |
|------|---------|
| `ArmClient` | Entry point for all ARM operations |
| `SqlServerResource` | Represents an Azure SQL server |
| `SqlServerCollection` | Collection for server CRUD |
| `SqlDatabaseResource` | Represents a SQL database |
| `SqlDatabaseCollection` | Collection for database CRUD |
| `ElasticPoolResource` | Represents an elastic pool |
| `ElasticPoolCollection` | Collection for elastic pool CRUD |
| `SqlFirewallRuleResource` | Represents a firewall rule |
| `SqlFirewallRuleCollection` | Collection for firewall rule CRUD |
| `SqlServerData` | Server creation/update payload |
| `SqlDatabaseData` | Database creation/update payload |
| `ElasticPoolData` | Elastic pool creation/update payload |
| `SqlFirewallRuleData` | Firewall rule creation/update payload |
| `SqlSku` | SKU configuration (tier, capacity) |

## Common SKUs

### Database SKUs

| SKU Name | Tier | Description |
|----------|------|-------------|
| `Basic` | Basic | 5 DTUs, 2 GB max |
| `S0`-`S12` | Standard | 10-3000 DTUs |
| `P1`-`P15` | Premium | 125-4000 DTUs |
| `GP_Gen5_2` | GeneralPurpose | vCore-based, 2 vCores |
| `BC_Gen5_2` | BusinessCritical | vCore-based, 2 vCores |
| `HS_Gen5_2` | Hyperscale | vCore-based, 2 vCores |

### Elastic Pool SKUs

| SKU Name | Tier | Description |
|----------|------|-------------|
| `BasicPool` | Basic | 50-1600 eDTUs |
| `StandardPool` | Standard | 50-3000 eDTUs |
| `PremiumPool` | Premium | 125-4000 eDTUs |
| `GP_Gen5_2` | GeneralPurpose | vCore-based |
| `BC_Gen5_2` | BusinessCritical | vCore-based |

## Best Practices

1. **Use `WaitUntil.Completed`** for operations that must finish before proceeding
2. **Use `WaitUntil.Started`** when you want to poll manually or run operations in parallel
3. **Always use `DefaultAzureCredential`** — never hardcode passwords in production
4. **Handle `RequestFailedException`** for ARM API errors
5. **Use `CreateOrUpdateAsync`** for idempotent operations
6. **Navigate hierarchy** via `Get*` methods (e.g., `server.GetSqlDatabases()`)
7. **Use elastic pools** for cost optimization when managing multiple databases
8. **Configure firewall rules** before attempting connections

## Error Handling

```csharp
using Azure;

try
{
    var operation = await serverCollection.CreateOrUpdateAsync(
        WaitUntil.Completed, serverName, serverData);
}
catch (RequestFailedException ex) when (ex.Status == 409)
{
    Console.WriteLine("Server already exists");
}
catch (RequestFailedException ex) when (ex.Status == 400)
{
    Console.WriteLine($"Invalid request: {ex.Message}");
}
catch (RequestFailedException ex)
{
    Console.WriteLine($"ARM Error: {ex.Status} - {ex.ErrorCode}: {ex.Message}");
}
```

## Reference Files

| File | When to Read |
|------|--------------|
| references/server-management.md | Server CRUD, admin credentials, Azure AD auth, networking |
| references/database-operations.md | Database CRUD, scaling, backup, restore, copy |
| references/elastic-pools.md | Pool management, adding/removing databases, scaling |

## Related SDKs

| SDK | Purpose | Install |
|-----|---------|---------|
| `Microsoft.Data.SqlClient` | Data plane (execute queries, stored procedures) | `dotnet add package Microsoft.Data.SqlClient` |
| `Azure.ResourceManager.Sql` | Management plane (this SDK) | `dotnet add package Azure.ResourceManager.Sql` |
| `Microsoft.EntityFrameworkCore.SqlServer` | ORM for SQL Server | `dotnet add package Microsoft.EntityFrameworkCore.SqlServer` |

## When to Use
This skill is applicable to execute the workflow or actions described in the overview.

Related Skills

azure-resource-manager-redis-dotnet

31392
from sickn33/antigravity-awesome-skills

Azure Resource Manager SDK for Redis in .NET.

Cloud ManagementClaude

azure-resource-manager-postgresql-dotnet

31392
from sickn33/antigravity-awesome-skills

Azure PostgreSQL Flexible Server SDK for .NET. Database management for PostgreSQL Flexible Server deployments.

Cloud ManagementClaude

azure-resource-manager-mysql-dotnet

31392
from sickn33/antigravity-awesome-skills

Azure MySQL Flexible Server SDK for .NET. Database management for MySQL Flexible Server deployments.

Cloud ManagementClaude

azure-resource-manager-cosmosdb-dotnet

31392
from sickn33/antigravity-awesome-skills

Azure Resource Manager SDK for Cosmos DB in .NET.

Cloud ManagementClaude

azure-monitor-query-py

31392
from sickn33/antigravity-awesome-skills

Azure Monitor Query SDK for Python. Use for querying Log Analytics workspaces and Azure Monitor metrics.

Cloud ManagementClaude

azure-mgmt-weightsandbiases-dotnet

31392
from sickn33/antigravity-awesome-skills

Azure Weights & Biases SDK for .NET. ML experiment tracking and model management via Azure Marketplace. Use for creating W&B instances, managing SSO, marketplace integration, and ML observability.

Cloud ManagementClaude

azure-mgmt-botservice-py

31392
from sickn33/antigravity-awesome-skills

Azure Bot Service Management SDK for Python. Use for creating, managing, and configuring Azure Bot Service resources.

Cloud ManagementClaudeChatGPTGemini

azure-mgmt-botservice-dotnet

31392
from sickn33/antigravity-awesome-skills

Azure Resource Manager SDK for Bot Service in .NET. Management plane operations for creating and managing Azure Bot resources, channels (Teams, DirectLine, Slack), and connection settings.

Cloud ManagementClaude

azure-mgmt-apicenter-py

31392
from sickn33/antigravity-awesome-skills

Azure API Center Management SDK for Python. Use for managing API inventory, metadata, and governance across your organization.

Cloud ManagementClaude

azure-containerregistry-py

31392
from sickn33/antigravity-awesome-skills

Azure Container Registry SDK for Python. Use for managing container images, artifacts, and repositories.

Cloud ManagementClaude

azure-keyvault-certificates-rust

31355
from sickn33/antigravity-awesome-skills

Azure Key Vault Certificates SDK for Rust. Use for creating, importing, and managing certificates.

Cloud ManagementClaude

cost-optimization

31392
from sickn33/antigravity-awesome-skills

Strategies and patterns for optimizing cloud costs across AWS, Azure, and GCP.

Cloud ManagementClaude