Jump to content
Welcome to our new Citrix community!
  • 1

Unable to add multiple desktop assignment rules to delivery group


Sravya Dade A

Question

Issue : Unable to add multiple desktop assignment rules to Delivery group through API.

https://developer.cloud.com/citrixworkspace/virtual-apps-and-desktops/cvad-rest-apis/apis/DeliveryGroups-APIs/DeliveryGroups_PatchDeliveryGroup

With the above API , we are able to add one desktop assignment rule , but if we add one more rule after sometime then second rule is getting replaced with 1st one . In simple terms , we could not add desktop assignment rules instead I can only edit .

 

Please help with the API which will allow to add multiple desktop  assignment rules to single Delivery group

Citrix.PNG

Link to comment

11 answers to this question

Recommended Posts

  • 0

Whether only one desktop assignment rule is supported depends on the type of your Delivery Group. For example, only one assignment policy rule can be added to a Remote PC Delivery Group.  For other type of delivery group, multiple rules can be added. But with the patch API , if add one desktop assignment rule1 by calling PATCH DG  {Desktops:[rule1]} and then update to desktop assignment rule2 by calling PATCH DG  {Desktops:[rule2]}, then rule2 will overwrite rule1.

Link to comment
  • 0

Below is the code I am using

 

payload = json.dumps({ "Desktops": [ { "Enabled": True, "IncludedUserFilterEnabled": True, "IncludedUsers": ["ERICSSON\\{}".format(user)], "PublishedName": display_name, "MaxDesktops": 1 } ] })

 

 

response = requests.patch('{}/cvadapis/{}/DeliveryGroups/{}'.format(self.token_url, self.site_id, delivery_group), headers = self.headers, verify = False, data = payload)

 

I can add multiple desktop assignment rules manually but not through API . Attached the screenshot

 

 

Test.PNG

Link to comment
  • 0
14 hours ago, Zhen Zeng said:

Whether only one desktop assignment rule is supported depends on the type of your Delivery Group. For example, only one assignment policy rule can be added to a Remote PC Delivery Group.  For other type of delivery group, multiple rules can be added. But with the patch API , if add one desktop assignment rule1 by calling PATCH DG  {Desktops:[rule1]} and then update to desktop assignment rule2 by calling PATCH DG  {Desktops:[rule2]}, then rule2 will overwrite rule1.

 

Zhen: how would you add rule2 so that it does now overwrite rule1?

Link to comment
  • 0

@Zhen zeng  Agree , But It is really difficult to append previous rules while adding new rule , In my environment there are high chances that I need to apply rule to 700 machines , In that case i cannot really write 699 rules additionally just to fulfill rule 700 .

 

However,  I think this is not the case with PowerShell. Can you cross check and let me know the better way forward .

 

 

 

Link to comment
  • 0

@Sravya,  the New-BrokerEntitlementPolicyRule cmdlet does add a new desktop rule to the site's entitlement policy. But API is different from powershell, API PATCH DG updates the whole DG model but not adds to some parameters. If we do add in PATCH, then we won't be able to remove during PATCH.

For DG with a lot desktop rules, you can do a GET to get the rule list before PATCH, then you won't need to write 699 rules.

 

Link to comment
  • 0

@Zhen Zeng  

I made it working . But I would like to inform that after getting existing rule list response , response needs to be extracted, filtered and then posted. This is making code cumber some.

 

It is definitely recommended to have the API support for just adding single rule without disturbing the existing one . Please consider the same during enhancements 

 

Thanks for your support and this thread can be closed .

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...