How to get the IP Address for Azure DevOps Hosted

2019-03-30 11:03发布

问题:

Is there a way to the IP address range for the hosted machine running?

This is related to the Release Pipeline -> Hosted agent.

Issue: Getting access denied on connection, as the connection is getting refused via Firewall. Need to whitelist the IP address range for this request coming from release pipeline on DevOps.

回答1:

I have a step in a release that gets the Hosted Agent IP address in powershell with:

Invoke-RestMethod http://ipinfo.io/json | Select -exp ip
Hope that helps.


回答2:

We need to white list the IP address used by the Azure Datacenters in the list mentioned below: https://www.microsoft.com/en-nz/download/details.aspx?id=41653

Note: This list gets updated every week, so please be mindful of this during the deployment planning



回答3:

Use a script step in the pipeline to get the current external ip and whitelist it. after pipeline finishes use another script step to clean up.

Thats the only way (for hosted agent), unfortunately.