如何使用 Microsoft.Azure.Management.Fluent 在 Azure 存储帐户上设置最小 TLS;

How to set minimum TLS on Azure Storage Account using Microsoft.Azure.Management.Fluent;

我正在创建使用 Microsoft.Azure.Management.Fluent C# 库配置 azure 资源的模板。

IAzure azure = Azure.Authenticate("./authfile.txt").WithDefaultSubscription();
var sa = await azure.StorageAccounts.Define(StorageAccount)
    .WithRegion(Region.USCentral)
    .WithExistingResourceGroup(ResourceGroup)
    .WithBlobEncryption()
    .WithGeneralPurposeAccountKindV2()
    .WithFileEncryption()
    .WithOnlyHttpsTraffic()
    .WithSku(StorageAccountSkuType.Standard_LRS)
    .WithHnsEnabled(true)
    .CreateAsync();

我希望我的存储帐户至少具有 TLS1.2,尽管我无法在此处找到设置所需 TLS 版本的方法。

如何在此处创建 TLS1.2 要求?

这是 Fluent API 中的一个已知问题,请参考 this issue

可以考虑使用不流畅的sdk:Microsoft.Azure.Management.Storage.

例如:

        var storageManagementClient = new StorageManagementClient(azureCredentials)
        {
          SubscriptionId = subscriptionId
        };


        var storageAccountCreateParameters = new StorageAccountCreateParameters
        {
            //set the tls here.
            MinimumTlsVersion = "TLS1_2"

            //other settings.
        };

        await storageManagementClient.StorageAccounts.CreateAsync(resourceGroupName, accountName, storageAccountCreateParameters);