Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Web App - Set Minimum version of TLS

Recently Azure added a feature in the UI to set a minimum TLS version per WebApp in the portal. I was wondering if anyone has found a way to set it through REST API or powershell. I have about 50 WebApps in each subscription and doing this manually would not be feasible.

Ive included a screenshot of the setting enter image description here

like image 471
Kent Rozenberg Avatar asked Oct 18 '25 14:10

Kent Rozenberg


2 Answers

This can be accomplished with PowerShell by calling the Set-AzureRMResource cmdlet with the relevant parameters. For your case:

# 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
}
like image 191
Martin Schvartzman Avatar answered Oct 21 '25 05:10

Martin Schvartzman


CLI is actually available: https://learn.microsoft.com/en-us/cli/azure/webapp/config?view=azure-cli-latest#az-webapp-config-set

PowerShell will be coming soon after a needed SDK update is complete.

like image 21
Oded Dvoskin Avatar answered Oct 21 '25 04:10

Oded Dvoskin