Created
January 21, 2022 10:46
-
-
Save PatrickKalkman/324f97a5254d1127617ad6cc9aff02c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:nextAppService Foreach ($appService in $allAppServices) | |
{ | |
$appServiceName = $appService.Name | |
Foreach ($appServiceToExclude in $AppServicesToExclude) | |
{ | |
if($appServiceToExclude.ToLower().Contains($appServiceName.ToLower())) | |
{ | |
Write-Output "Skipped app service $appServiceName as it is in the exclude list" | |
continue nextAppService | |
} | |
} | |
if ($RemoveExistingRules) | |
{ | |
Remove-AccessRestrictionsFromAppService -ResourceGroupName $ResourceGroupName -Name $appServiceName | |
} | |
Foreach ($ipRule in $ipRules) | |
{ | |
# Construct ip address filter for access restriction /32 = single ip address | |
$ipAddress = -join($ipRule.ipaddress, "/32"); | |
Add-AccessRestrictionToAppService -ResourceGroupName $ResourceGroupName -Name $appServiceName -IpFilterRuleName $ipRule.rulename -IpAddress $ipAddress -Priority $ipRule.priority | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment