SQL DB超大规模ServiceObjectiveName /核心

时间:2019-12-11 00:05:35

标签: azure azure-sql-database azure-sdk

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

如果DatabaseEdition是Hyperscale,则ServiceObjectiveName的可用选项是什么?

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

我找到了ServiceObjectiveNames列表,但是似乎没有一个与Hyperscale值相关。 https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.management.sql.models.serviceobjectivename?view=azure-dotnet

  • 基本DS100 DS1000 DS1200 DS1500 DS200 DS2000 DS300 DS400 DS500 DS600 DW100 DW1000 DW10000c DW1000c DW1200 DW1500 DW15000c DW1500c DW200 DW2000 DW2000c DW2500c DW300 DW3000 DW30000c DW3000c DW400 DW500 DW5000c DW600 DW6000 DW6000c DW7500c ElasticPool免费P1 P11 P15 P2 P3 P4 P6 PRS1 PRS2 PRS4 PRS6 S0 S1 S12 S2 S3 S4 S6 S7 S9系统 System0 System1 System2 System2L System3 System3L System4 System4L

1 个答案:

答案 0 :(得分:1)

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

例如

如果我们使用ServiceObjectiveName.Parse("HS_Gen5_2"),则意味着该数据库是Hyperscale:Gen5,2个vCore。

详细的ste骨如下:

  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);

enter image description here enter image description here