We have our infrastructure on AWS and our NET Projects are starting to use Visual Studio Team Service (VSTS) to provide CI/CD and manage all the build/release process from there. We are using the Hosted Build Servers but the deploy is going to be on AWS IIS Server (EC2 Windows 8 R2 IIS Server).
I was trying to find what is the IP Range for VSTS in order to create the right Security Groups (SG) and added to our EC2 instances but I am unable to know what is the range and they provide the list by region by I need something more specific like 10.73.0.0 - 10.73.255.255 and then I will be able to do something like 10.73.0.0/16.
Is there anyway to know what is that IP Range because right now in my POC are you using a too open SG but I need to restrict this.
Visual Studio Team Service (VSTS) appears to be hosted in Azure. As a result you won't be able to get a more specific IP range list than the entire list of IPs for Azure, which are subject to change.
Azure publish a list here every Wednesday: https://www.microsoft.com/en-us/download/confirmation.aspx?id=41653:
And you will need to permit all the IP ranges for the region your account has been set up in.
My personal opinion is that this would be too difficult to maintain and you should look for other options to secure access, or consider a self-hosted equivalent of VSTS.
You can get the IP address of current build agent dynamically and create a security group dynamically (by using AWS SDK for .NET)
Arguments: -RestAddress https://starain.vsdtl.visualstudio.com/DefaultCollection/_apis/vslabs/ipaddress -Token $(System.AccessToken)
).PS:
An article about creating security group: Creating a Security Group in Amazon EC2
So since you know when IP address xml changes thanks to Mark, you could write and schedule a lambda function to change the security group.
Here is an AWS example of doing just that but with the Cloudfront distribution IP address ranges.
https://github.com/awslabs/aws-cloudfront-samples