如何在 Azure fluent API for SQL Server 中为现有 Azure SQL 数据库设置服务器级目标(定价层)?
我正在使用 Microsoft.Azure.Management.Sql.Fluent,版本 1.10.0,它是今天最新的。
Microsoft 提供的此示例代码创建一个 Azure SQL 数据库,然后设置其服务器级别
var azCreds = SdkContext.AzureCredentialsFactory.FromFile(filePath);
var azure = Azure.Configure()
.Authenticate(azCreds)
.WithSubscription("mysubscriptionid");
var sqlServer =
azure.SqlServers.Define("existingsqlserverid")
.WithRegion(Region.USEast)
.WithExistingResourceGroup("Default-SQL-EastUS")
.WithAdministratorLogin("mylogin")
.WithAdministratorPassword("mypassword")
.Create()
.Databases
.Define("NewDbName")
.Create()
.Update()
.WithEdition(DatabaseEditions.Standard)
.WithServiceObjective(ServiceObjectiveName.S1)
.Apply();
如何设置现有数据库的服务级别?
我似乎能得到的最接近的是
.WithAdministratorPassword("mypassword")
.DefineDatabase("OldDbName")
.WithEdition(DatabaseEditions.Standard)
.WithServiceObjective(ServiceObjectiveName.S2);
它不会抛出异常,但也不会做任何事情。数据库的服务级别不会改变。
感觉就像我需要在Apply()这里,但这不是一个选择。
Azure Fluent API for SQL Server 上的 Microsoft 文档非常稀少。

