如何获取 SQL 服务器中所有弹性池的名称?

How do i get the name of all the elastic pools i have in SQL Server?

我正在尝试获取我在 Azure 上的 SQL 服务器中拥有的弹性池的名称。我目前面临的问题是,我可以获取 SQL 服务器中所有弹性池名称的唯一方法是编写

var elasticPool = azure.SqlServers.ElasticPools.GetBySqlServer(sqlServer, elasticPoolName);
elasticPool.Name;

这里我只得到一个弹性池,要得到它,我需要指定我试图得到的弹性池的名称,这有点次优。

所以我的问题是,是否可以获取我的 SQL 服务器中所有弹性池的名称?

So my question is, is it possible to get the name of all the Elastic Pools in my SQL Server?

你应该可以得到它。

我自己还没有尝试过,但是 ISqlServer interface exposes a property called ElasticPools and that has a List 操作应该会为您提供 SQL 服务器中的弹性池列表。

我在这里找到了一些相关代码,您可能会觉得有用:https://github.com/Azure-Samples/sql-database-dotnet-manage-sql-dbs-in-elastic-pool/blob/master/Program.cs