简体   繁体   中英

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

I am in the process of creating a template for provisioning azure resources using the Microsoft.Azure.Management.Fluent C# library.

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

I would like my storage accounts to have a minimum of TLS1.2, although I'm having trouble finding method for setting the required TLS version here.

How do I go about creating the TLS1.2 requirement here?

This is a known issue in Fluent API, please refer to this issue .

You can consider using the non-fluent sdk: Microsoft.Azure.Management.Storage .

For example:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM