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

标签 c# azure azure-resource-manager

我正在创建一个模板,用于使用 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 .

可以考虑使用非Fluent 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);
        

关于c# - 如何使用 Microsoft.Azure.Management.Fluent 在 Azure 存储帐户上设置最低 TLS;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65674265/

相关文章:

powershell - 添加-AzureRmAccount : Sequence contains no elements

python - 如何检查以确保 blob_service.put_block_blob_from_path() 在 python 中成功?

Azure函数+ARM : merge app settings with current settings

json - 如何使用 Azure 资源管理器在 Azure Web 应用程序中设置应用程序日志

WCF/.NET 中的 C# UTC 日期时间查询

c# - 如果我在子类中实现 ISerializable,父类是否也必须如此?

c# - 使用 NJsonSchema 从 C# 中的示例 JSON 数据生成 JSON 架构

c# - 如何获取通过 USB 与 C#.net (VS2010/4.0+) 连接的 Android 设备的操作系统版本和设备名称?

azure - 如何在 Azure 上存储 pdf

azure - 将 Azure VPN 网关部署到现有 vnet,而不影响现有子网