最近,Azure 在 UI 中添加了一项功能,可在门户中为每个 WebApp 设置最低 TLS 版本。我想知道是否有人找到了通过 REST API 或 powershell 设置它的方法。我在每个订阅中有大约 50 个 WebApp,手动执行此操作是不可行的。

我已经包含了设置的屏幕截图
enter image description here

最佳答案

这可以通过 PowerShell 使用相关参数调用 Set-AzureRMResource cmdlet 来完成。对于您的情况:

# Iterate all sites and set the Minimum TLS version to 1.2 (SSL Settings)
Get-AzureRmResource -ResourceType Microsoft.Web/sites | ForEach-Object {
    $params = @{
        ApiVersion        = '2018-02-01'
        ResourceName      = '{0}/web' -f $_.Name
        ResourceGroupName = $_.ResourceGroupName
        PropertyObject    = @{ minTlsVersion = 1.2 }
        ResourceType      = 'Microsoft.Web/sites/config'
    }
    Set-AzureRmResource @params -Force
}

关于powershell - Azure Web 应用程序 - 设置 TLS 的最低版本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50623776/

10-13 07:46
查看更多