Azure.ResourceManager.Sql (.NET)
使用 .NET SDK 佈建 Azure SQL 資源
手動透過入口網站管理 Azure SQL 基礎架構既耗時又容易出錯。此技能可使用 Azure.ResourceManager.Sql SDK 自動佈建及管理 SQL 伺服器、資料庫和彈性集區。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「Azure.ResourceManager.Sql (.NET)」。 Create a SQL server with a database
預期結果:
Server 'my-sql-server' created in EastUS with TLS 1.2 enforced. Database 'my-db' provisioned with S0 SKU (10 DTUs) and 2GB storage. Connection endpoint: my-sql-server.database.windows.net
正在使用「Azure.ResourceManager.Sql (.NET)」。 Add firewall rule for office IP range
預期結果:
Firewall rule 'OfficeIPs' created allowing 203.0.113.0 - 203.0.113.255. Rule is active immediately. Existing connections are not affected.
安全審計
安全This is a prompt-only documentation skill with no executable code. It provides instructions for using Azure.ResourceManager.Sql SDK for management plane operations. The skill teaches proper security practices including DefaultAzureCredential for authentication and TLS 1.2 minimum version. Static analysis scanned 0 files with risk score 0/100. No security concerns identified.
風險因素
🔑 環境變數 (1)
品質評分
你能建構什麼
DevOps 工程師自動化基礎架構
使用 .NET 應用程式將 SQL 伺服器和資料庫佈建自動化,做為 CI/CD 管線的一部分
開發人員建置管理工具
建立內部工具以進行自助資料庫佈建和資源管理
雲端架構師設計解決方案
使用適當的安全設定,針對 Azure SQL 資源實作基礎架構即程式碼模式
試試這些提示
在 East US 建立名為 'prod-sql-server' 的 Azure SQL 伺服器,並設定 TLS 1.2 最低版本及管理員登入。
在現有的彈性集區 'shared-pool' 中建立名為 'app-db' 的 SQL 資料庫,使用 Standard S0 SKU 和 2GB 最大大小。
新增防火牆規則以允許 Azure 服務和公司 IP 範圍 203.0.113.0/24 存取 SQL 伺服器。
佈建完整的 SQL 基礎架構:含 AAD 管理員的伺服器、100 eDTU 的彈性集區、集區中的三個資料庫、Azure 服務和特定 IP 的防火牆規則,以及啟用稽核記錄。
最佳實務
- 使用 DefaultAzureCredential 進行驗證 - 支援受控識別、CLI 和環境認證
- 對必須在相依動作之前完成的作業使用 WaitUntil.Completed
- 在嘗試資料庫連線之前先設定防火牆規則和網路設定
避免
- 不要將管理員密碼寫入程式碼 - 請使用 Azure Key Vault 或受控識別
- 不要使用此 SDK 執行查詢 - 請改用 Microsoft.Data.SqlClient
- 管理多個資料庫時避免建立不含彈性集區的資料庫 - 集區可降低成本