Has anyone figured out how to bulk upload IP Ranges into a Profile? I haven’t been able to find anything on this. Having a large amount of IP addresses to add to a profile is a pain, error prone when doing manually, and very time consuming for each profile.
Use the Metadata API Toolkit.
First, install the tool (see Setup > Develop > Tools).
Second, create a new directory to work from, build a build.xml file (see samples in the toolkit file).
You’ll need a retrieve.xml file (whatever you choose to name it) that looks like this:
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <members>*</members> <name>Profile</name> </types> <version>30.0</version> </Package>
Run sf:retrieve against this XML file, and you’ll end up with results like this:
src/package.xml src/profiles/Admin.profile src/profiles/Content Only User.profile src/profiles/ContractManager.profile (more profiles)
Next, edit each profile file, adding in loginIpRanges:
<loginIpRanges> <endAddress>x.x.x.x</endAddress> <startAddress>y.y.y.y</startAddress> </loginIpRanges>
You can copy and paste them between each profile, if need be.
Finally, run sf:deploy using deployRoot=”src” (if that is what the original retrieve used) to instantly upload all IP ranges to all profiles in one step.
You can do the same thing with the Force.com IDE if you don’t like command prompts.