function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ben HorleyBen Horley 

Using Ant to add IP addresses to a profile

Hello all

We have a requirement to add 70 or so IP addresses to a profile whitelist.

I was able to retrieve the profile using Ant retrieve and, looking at the metadata, you can see the IP's specified in the whitelist. I want to add IP's while keeping the existing ones intact instead of having to get the existing ones, merge them with the new ones then upload the lot.

I was not able to find this documented anywhere but it seemed logical that you could update a profile without having to upload the entire profile so I tried the following.

Package

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>Profile</name>
    </types>
    <version>47.0</version>
</Package>

Profile

<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
    <loginIpRanges>
        <description>Azure IP</description>
        <startAddress>185.194.40.60</startAddress>
        <endAddress>185.194.40.61</endAddress>
    </loginIpRanges>
</Profile>

This sucessfully added that IP to the profile whitelist but wiped out what was already there. Do you know how I can append to the list instead of replacing it?

Cheers, Ben 
Guillaume LoubierGuillaume Loubier
It's a little late, but to not wipe out what's already there, you'll need to 
1. Retrieve that package.xml from the destination org
2. Retrieve the same from the source org
3. Use a diff tool (I'm using DiffMerge from Sourcegear, but any diff tool would work
4. Compare the 2 package folders and merge all profiles to get the old and new login ip ranges
5. Deploy your merged package.

Note: I'm doing that for every dpeloyments. That way, you can merge whatever changes from other team to the package so that you don't remove new stuff that you may not have yet in the source org