New key vault and web app settings

This commit is contained in:
Jurjen Ladenius
2024-03-12 17:32:15 +01:00
parent ceeee5a420
commit c1f54bf0f8
9 changed files with 305 additions and 30 deletions

View File

@@ -1,41 +1,21 @@
#Connect-AzAccount
class ResourceCheck {
[string] $ResourceId = ""
[string] $Kind = ""
[string] $Location = ""
[string] $ResourceName = ""
[string] $ResourceGroup = ""
[string] $ResourceType = ""
[string] $State = ""
[string] $SubscriptionId = ""
[string] $SubscriptionName = ""
[string] $Tag_Team = ""
[string] $Tag_Product = ""
[string] $Tag_Environment = ""
[string] $Tag_Data = ""
[string] $Tag_CreatedOnDate = ""
[string] $Prop_HttpsOnly = ""
[string] $Prop_PhpVersion = ""
[string] $Prop_NetFrameworkVersion = ""
[string] $Prop_WindowsFxVersion = ""
[string] $Prop_RemoteDebuggingEnabled = ""
[string] $Prop_MinTlsVersion = ""
[string] $Prop_FtpsState = ""
}
# Set alias for az exe
Set-Alias -Name az -Value "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd"
Write-Host "======================================================================================================================================================================"
Write-Host "Creating webapp resource overview."
Write-Host "Updating webapp resource settings."
Write-Host "======================================================================================================================================================================"
$subscriptions = Get-AzSubscription | Where-Object State -eq "Enabled"
$subscriptions = Get-AzSubscription | Where-Object State -eq "Enabled" | Where Name -NotLike "Visual Studio*" | Where Name -NotLike "*test*"
foreach ($subscription in $subscriptions)
{
Write-Host "----------------------------------------------------------------------------------------------------------------------------------------------------------------------"
Set-AzContext -SubscriptionId $subscription.Id
az account set --subscription $subscription.Id
Write-Host "----------------------------------------------------------------------------------------------------------------------------------------------------------------------"
@@ -57,6 +37,10 @@ foreach ($subscription in $subscriptions)
Write-Host "Disable PHP $($webApp.Name)"
$x = Set-AzWebApp -Name $webApp.Name -ResourceGroupName $group.ResourceGroupName -PhpVersion "off"
}
if ($webApp.SiteConfig.Http20Enabled -ne "TRUE") {
Write-Host "Enable HTTP/2 $($webApp.Name)"
az webapp config set -g $group.ResourceGroupName -n $webApp.Name --http20-enabled true | out-null
}
$allSlots = Get-AzWebAppSlot -Name $webApp.Name -ResourceGroupName $webApp.ResourceGroup
@@ -73,6 +57,10 @@ foreach ($subscription in $subscriptions)
Write-Host "Disable PHP $($webApp.Name) - $($slotName)"
$y = Set-AzWebAppSlot -Name $webApp.Name -Slot $slotName -ResourceGroupName $group.ResourceGroupName -PhpVersion "off"
}
if ($slot.SiteConfig.Http20Enabled -ne "TRUE") {
Write-Host "Enable HTTP/2 $($webApp.Name)"
az webapp config set -g $group.ResourceGroupName -n $webApp.Name --slot $slotName --http20-enabled true | out-null
}
}
}
}