Created
September 7, 2022 10:55
-
-
Save danielmackay/78347e7a0adac028380a6df9611a270f to your computer and use it in GitHub Desktop.
Powershell script that whitelists all bit bucket ip addresses so that pipelines can deploy to a locked down SCM website
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
param | |
( | |
[Parameter(Position = 0, Mandatory)] | |
[ValidateNotNullOrEmpty()] | |
[string]$WebApp, | |
[Parameter(Position = 1, Mandatory)] | |
[ValidateNotNullOrEmpty()] | |
[string]$ResourceGroup | |
) | |
Write-Host "➡️ Whitelisting Bit Bucket IP Addresses in web app" | |
# https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/ | |
New-Object -TypeName System.Collections.ArrayList | |
$arrlist = [System.Collections.ArrayList]@( | |
"34.199.54.113/32", | |
"34.232.25.90/32", | |
"34.232.119.183/32", | |
"34.236.25.177/32", | |
"35.171.175.212/32", | |
"52.54.90.98/32", | |
"52.202.195.162/32", | |
"52.203.14.55/32", | |
"52.204.96.37/32", | |
"34.218.156.209/32", | |
"34.218.168.212/32", | |
"52.41.219.63/32", | |
"35.155.178.254/32", | |
"35.160.177.10/32", | |
"34.216.18.129/32", | |
"3.216.235.48/32", | |
"34.231.96.243/32", | |
"44.199.3.254/32", | |
"174.129.205.191/32", | |
"44.199.127.226/32", | |
"44.199.45.64/32", | |
"3.221.151.112/32", | |
"52.205.184.192/32", | |
"52.72.137.240/32" | |
) | |
ForEach($ip in $arrlist) | |
{ | |
Write-Host "White Listing IP " $ip | |
az webapp config access-restriction add --priority 300 --action Allow --ip-address $ip --name $WebApp --resource-group $ResourceGroup --rule-name BitBucket --scm-site true | |
} | |
Write-Host "✅ Finished " | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment