#Connect-AzAccount

$subscriptions = Get-AzSubscription

foreach ($subscription in $subscriptions) 
{
    Write-Host "----------------"

    Set-AzContext -SubscriptionId $subscription.Id

    $allResources = Get-AzStorageAccount | Where-Object minimumTlsVersion -ne TLS1_2

    foreach ($resource in $allResources) {
        Set-AzStorageAccount -ResourceGroupName $resource.ResourceGroupName -AccountName $resource.StorageAccountName -MinimumTlsVersion TLS1_2
    }
}

Write-Host "========================================================================================================================================================================"
Write-Host "Done."
