Powershell Update the Azure storage account to use the latest TLS version 1.2


Connect-AzAccount

$storageAccounts = Get-AzStorageAccount
foreach ($account in $storageAccounts) {
    $resourceDetails = Get-AzResource -ResourceId $account.Id
    if ($resourceDetails.Properties.minimumTlsVersion -ne "TLS1_2") {
        Write-Output "Updating TLS version for storage account: $($account.StorageAccountName)"

        # Update the storage account to use the latest TLS version
        # uncomment the following line to actually update the storage account
        #Set-AzStorageAccount -ResourceGroupName $account.ResourceGroupName -Name $account.StorageAccountName -MinimumTlsVersion "TLS1_2"
    }
}
Write-Output "All storage accounts have been updated to use a minimum TLS version of 1.2"
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...