Azure powershell folder path variable

I am using the azure powershell step calling a script from within a package but the script needs to refer to another file within the package but i am unable to determine which variable would give me the package route.

I cannot hard code a path as the package is created in a folder named at the current time of the deployment as below
C:\OctopusServer\Work\20160722122721-71\tools\DeployApplication.ps1
I’ve checked the octopus system variables and cannot find one that would relate to the current package route location, could anyone point me in the right direction?

Also is there a way to pass parameters in with the script path/filename?
such as …\tools\DeployApplication.ps1 -something foo -somethingelse foo2

Cheers
Dave

Hi Dave,

Thanks for reaching out!

I am using the azure powershell step calling a script from within a package but the script needs to refer to another file within the package but i am unable to determine which variable would give me the package route.

$PSScriptRoot should do the trick

Also is there a way to pass parameters in with the script path/filename?
such as …\tools\DeployApplication.ps1 -something foo -somethingelse foo2

We added support for this in 3.3.21. You can read more about that here: https://octopus.com/blog/script-parameters

Cheers,
Dalmiro

Hi, thanks for the reply.

I was using $psscriptroot but wondered if there was an octopus variable for it too. From your response i guess not.
I’m not yet up to 3.3.21 so its now a good reason to upgrade and mkae life easier :-).

As a follow up (although unrelated to the above) I’ve just been looking at the proxy addition in 3.4 beta 2. Is there any plan to allow the proxy selection separately from the machines? The feature would be useful so it can be used as part of azure deployments/azure powershell script step etc.

Cheers
Dave

Hi Dave,

We haven’t added a specific variable for that path, but $PSScriptRoot should always bring you the path you are looking for. We might introduce a specific variable for this in the future.

Per your proxy question, I’ll ping the dev that worked on our proxy feature and get back to you on this one.

Thanks!
Dalmiro

Thank you

Hi Dave,

I’ve created a github issue to add a variable specifically for what you asked before: https://github.com/OctopusDeploy/Issues/issues/2612

RE your proxy question, all azure coms are executed from the Octopus server. So Octopus will use the existing server proxy configuration for that.

Best regards,
Dalmiro