I’m writing a script to deploy Azure VMware Solution (AVS) and ran into a situation many of us likely have: Some parameters depend on other parameters.

I started with Parameter Sets where I did have several parameters participating in multiple Parameter Sets, but that didn’t work how I thought it would (or should).

Here’s what didn’t work:

My intention was to have additional mandatory parameters based on additional switches.  For instance, if you add “-createvNet”, the script needs four additional parameters.  Also, if you used “-EnableVMInternet” without “-createvNET”, the script will also need to recognize that wasn’t supplied and make the parameters with it mandatory.  Spoiler: that didn’t work.

Read More →