Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created January 21, 2022 10:46
Show Gist options
  • Save PatrickKalkman/324f97a5254d1127617ad6cc9aff02c8 to your computer and use it in GitHub Desktop.
Save PatrickKalkman/324f97a5254d1127617ad6cc9aff02c8 to your computer and use it in GitHub Desktop.
: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