Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created January 21, 2022 10:40
Show Gist options
  • Save PatrickKalkman/e3b62469abfab97a8f9e8f6f486d0e1e to your computer and use it in GitHub Desktop.
Save PatrickKalkman/e3b62469abfab97a8f9e8f6f486d0e1e to your computer and use it in GitHub Desktop.
function Add-AccessRestrictionsToAppServices([string] $ResourceGroupName,
[string] $JsonFilename,
[bool] $RemoveExistingRules,
[string[]] $AppServicesToExclude)
{
Write-Information "Retrieving all app services in $ResourceGroupName"
$allAppServices = Get-AzWebApp -ResourceGroupName $ResourceGroupName
$confirmAppServicesToExclude = Confirm-AppServicesToExclude -AllAppServices $allAppServices -AppServicesToExclude $AppServicesToExclude
if (!$confirmAppServicesToExclude)
{
$errorMessage = "Did not find one or more of the app services in the exclude list, make sure that the names are spelled correctly"
Write-Output $errorMessage
throw $errorMessage
}
Write-Information "Reading the json file with ip rules"
$ipRules = ReadJsonFile($JsonFilename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment