I have an Az Powershell script (let's just call it ```DeployApps.ps1```) which I run from the commandline, having initialised a couple of variables which get passed into the script as parameters. The script will basically deploy the named application to one or more environments which are subject to the initialisation of the environment variable.
The variable declaration can be depicted as follows:
$ApplicationName = 'HelloWorldApp'
$Environment = @('DEV','SIT','UAT','PROD')
I have to emphasise though that the $Environment variable can be initialised to one or more values and so even if set to say 'DEV' alone, this should still be perfectly fine and the script will run as expected.
The ApplicationName variable can also be initialised to one of a number of applications and not just the HelloWorldApp.
From the command line, the script execution itself can then be depicted as follows:
DeployApps.ps1 $ApplicationName $Environment
I now need to replicate all of the above into an Azure Pipeline (YAML). The Powershell script itself is versioned in my Azure Repo and so calling or referencing it from an Azure Powershell/Cli Task in my pipeline is fairly easy and straightforward, as depicted below.
My Task/Challenge
What I'd now like to do is replicate in the pipeline, exactly how I execute the script from the commandline. By this, I mean being able to set the two variables to the required random values, before or when the pipeline is run. In other words, I can set the two variables which then get passed into the script execuction.
Any ideas or advice on how to accomplish this?