Michael_Jenkins
Jan 20, 2015Cirrostratus
iControlREST - Update virtual access profile
I've got a bunch of virtuals set up that reference the same Access Profile. Instead of having to go through one by one and change the profile to a different one, I'd like to try to script it with iControlREST.
I'm working in powershell, and so far I've got this
$u = "https://example.com/mgmt/tm/ltm/virtual/MY_VIRTUAL";
$a = Invoke-RESTMethod -method GET -uri $u -credential $f5credentials;
Now I have the virtual configuration
$u = $a.profilesReference.link -replace @("localhost", "example.com");
$b = Invoke-RESTMethod -method GET -uri "$u" -credential $f5credentials
$i = ($b.items | ?{$_.name -eq "MY_APM_PROFILE"});
Now I have the profiles (all of them) and parsed out the one I'm trying to replace
$u = $i.selfLink -replace @("localhost", "example.com");
$c = Invoke-RESTMethod -method GET -uri $u -credential $f5credentials
This was the configuration for the profile (MY_APM_PROFILE)
This is where I'm stuck. I can't figure out the right command to either replace the profile with a different one (e.g. MY_OTHER_APM_PROFILE) or remove the old and add the new (since you get an error trying to remove an APM profile when you have other profiles there)
Anyone done this? Any ideas on how?