Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

Assign ASM policy to VS via iControl/REST

Hello everyone,

I batch create virtual servers using the iControl/REST interface. Only thing missing now is assigning a pre-existing ASM policy.

My version is 11.5.1, will upgrade to 11.5.3 later. Does someone know how to do this? Thank you.

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hello, you can drastically simplify that by just specifying the VS array list in the ASM policy property virtualServers. This will automatically create the ltm policy attaching the ASM policy to the virtual server.

So as an example, if i want to attach an existing policy to an existing vs called vs_http i would just have to do :

PATCH /mgmt/tm/asm/policies/TUFO8Y208Zm1hvmqnCuuqw/

{"virtualServers" : ["/Common/vs_http"]}

2
Comments on this Answer
Comment made 24-May-2016 by NiHo 396
This is actually a much easier method, thank you Arnaud!
0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hello,

I think that before v12.0.0, it's not easy to attach an existing ASM profile to a VS. But you can try using the following icontrol urls :

First create an ltm policy with a POST to /mgmt/tm/ltm/policy

Then you will need to add conditions and actions in your policy. Here the url to add an action which will tell the policy to use an existing asm profile : /mgmt/tm/ltm/policy/my_policy_name/rules/default/actions

And finally, you need to assign the ltm policy to your VS by using the following url /mgmt/tm/ltm/virtual/vs-auction/policies

I don't find any other easier way to achieve your need

2