Kent Rozenberg
Kent Rozenberg

Reputation: 55

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

Upvotes: 4

Views: 2729

Answers (3)

JohnW
JohnW

Reputation: 3032

If you want to use PowerShell:

 Set-AzWebApp -MinTlsVersion '1.2' -ResourceGroupName $ResourceGroupName -Name $webappName;

Upvotes: 2

Martin Schvartzman
Martin Schvartzman

Reputation: 111

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
}

Upvotes: 3

Oded Dvoskin
Oded Dvoskin

Reputation: 220

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.

Upvotes: 3

Related Questions