SQL 数据库超大规模 ServiceObjectiveName/Cores

SQL DB Hyperscale ServiceObjectiveName/Cores

我正在使用 .net SDK 的 azure 库,运行 遇到一个问题。

如果 DatabaseEdition 是超大规模,ServiceObjectiveName 有哪些可用选项?

当我创建超大规模数据库时,我认为 ServiceObjectiveName 默认是 Gen4。有没有办法指定 Gen5 和内核数量?

我找到了 ServiceObjectiveNames 列表,但其中 none 似乎与超大规模值相关。 https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.management.sql.models.serviceobjectivename?view=azure-dotnet

根据我的测试,如果我们使用Azure Management Libraries for .NET创建Hyperscale Gen5数据库,我们可以使用方法ServiceObjectiveName.Parse("")来指定Gen5和内核数量。

例如

如果我们使用 ServiceObjectiveName.Parse("HS_Gen5_2"),这意味着数据库是超大规模的:Gen5,2 vCores。

详细步骤如下:

  1. 创建服务主体并将角色分配给 sp
az ad sp create-for-rbac --name ServicePrincipalName --role contributor
  1. 代码:
var tenantId = "<your tenant id>";
            var clientId = "<your sp app id>";
            var clientSecret = <your sp password>;

            var SubscriptionId = "<your subscription id>";

            var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(
                                    clientId,
                                    clientSecret,
                                    tenantId,
                                    AzureEnvironment.AzureGlobalCloud);
            var azure = Microsoft.Azure.Management.Fluent.Azure.Configure()
                        .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
                        .Authenticate(credentials)
                        .WithSubscription(SubscriptionId);

            var sqlServer = azure.SqlServers.GetByResourceGroup("test", "testsql07");
            Console.WriteLine(sqlServer.Name);

            var database = await sqlServer.Databases.Define("test1")
                                                   .WithEdition(DatabaseEdition.Hyperscale)
                                                   .WithServiceObjective(ServiceObjectiveName.Parse("HS_Gen5_2"))
                                                   .CreateAsync();
            Console.WriteLine(database.Edition.Value);
            Console.WriteLine(database.RequestedServiceObjectiveName.Value);