Configure Newly Added to Pool in Drain Mode

Copper Contributor

Hi, 

I need a way to ensure that new hosts being added to a pool are in Drain Mode when they get added. The pool has automatic assignment enabled and we are finding that when new Session Hosts are provisioned users are being assigned before the host gets configuration/apps. 

 

I know how to achieve this using PowerShell but cannot see a way to configure it using ARM template configuration or some configuration on the Host Pool its self. 

 

Is anyone aware of a way to achieve this without scripting? Seems such a basic requirement but no simple way to do it? 

 

Mike. 

2 Replies
Unfortunately not, a script is the only solution here. Even discussed this with several Microsoft engineers.

What I've done in multiple environments is outputting all the host names from the ARM/Bicep deployment and using that output to set all the hosts to drain mode (you might need to do some things with the output parameters to get the correct parameter value, something along the lines of'<host pool name>/<hostname><.ADDomainName (if applicable)>').

Another plus for using a deployment script is that you can generate a host pool registration key on the fly, so you can automate the deployment even better.
Hi Mike
Could you please share how to achive this by PowerShell script?