Reputation: 2243
I have a PowerShell script that uses Az PowerShell modules to retrieve properties of all webapps within a resource group. Now, I also need to fetch the MinTlsVersion
property as in below. Can I do it using one of Az modules?
When a call to Get-AzWebApp
command is made in the script, a request is sent to /subscriptions/<s>/resourceGroups/<rg>/providers/Microsoft.Web/sites
endpoint. The response object has property siteConfig
set to null
. Is there a way to call Get-AzWebApp
such that the property is not null
so I can use the minTlsVersion
sub-property under the siteConfig
object?
If there's no way to above:
I see that the client receives minTlsVersion
by sending a GET request to /subscriptions/<s>/resourceGroups/<rg>/providers/Microsoft.Web/sites/<st>/config/web
endpoint. Can we hit the same endpoint by using one of the Az PowerShell modules? Though, I would prefer a request that can return minTlsVersion
of all webapps in a resource group in a single call.
Upvotes: 1
Views: 2976
Reputation: 42043
You need to iterate through each app, try the command as below, it works on my side.
$grouname = "<resource-group-name>"
$apps = Get-AzWebApp -ResourceGroupName $grouname
$names = $apps.Name
foreach($name in $names){
$tls = (Get-AzWebApp -ResourceGroupName $grouname -Name $name).SiteConfig.MinTlsVersion
Write-Host "minTlsVersion of web app" $name "is" $tls
}
Upvotes: 4