Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
add ip of build agent on azure network security group
$resourceGroupName = 'my-rg'
$nsgName = 'my-nsg'
$ruleName = 'AllowBuildServerInBound-temp'
$ports = '*'
$agentIp = Invoke-RestMethod http://ipinfo.io/json | Select -exp ip
az network nsg rule create --resource-group $resourceGroupName --nsg-name $nsgName --name $ruleName --priority 500 --access Allow --direction Inbound --source-address-prefix $agentIp --source-port-ranges '*' --destination-address-prefixes '*' --destination-port-ranges $ports
$resourceGroupName = 'my-rg'
$nsgName = 'my-nsg'
$ruleName = 'AllowBuildServerInBound-temp'
az network nsg rule delete --resource-group $resourceGroupName --nsg-name $nsgName --name $ruleName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.