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
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
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With