As subject indicates, I’m wanting to use VSCode to develop PSU scripts, but I don’t know how to access variables/secrets stored in PSU.
And a more general question is: beyond basic connectivity between VSCode and PSU (configuring token), are there other steps I need to do for full interoperability? And are there other limitations using VScode I’m not aware of? Is there a kb explaining?
PSU does not return secret values out of the platform. If you are attempting to run those scripts on your local machine, you won’t have access to any variables provided by PSU because it’s using the standard PS execution and not the PSU execution engine.
That’s correct. You’d have to use that work around.
The extension could be improved to make this more seamless. The local VS PowerShell extension doesn’t know about all the PSU configuration, so it just executes the script like any other local script.
What we should do is enhance the PSU VS Code extension to provide a way to make remote execution appear local, similar other remote debugging\editing extensions.
I opened an issue to track this because I think it would be extremely helpful. PSU’s editor and debugger are okay but will never be as functional as VS Code.
@adam After working with PSU for past week, I agree that better integration with VSCode would be highly beneficial. The built in debugging / intellisence, etc are just not close to VSCode. I’d upvote it if there is a way.
Yeah, there are a few things that make working on my scripts locally a little difficult, but I’ve just learned to adjust my workflow to work with it.
I’ve started having PSU pull secrets from our Password Manager as needed, that way I’m not manually managing as many passwords in PSU. I still use some local variables, such as my secrets to access my secrets.
You might just have to load those secrets locally, or develop part of your script locally. Our current workflow is to develop and commit code to Github. We have a dev server and a production server. We have a dev branch in github that will push the code up through Github Actions to our dev server, and the main branch will push the code to our production server.
I mostly wanted the dev server for testing when I was making more apps/dashboards, because issues in my code there would sometimes lock up the whole PSU instance, so I wanted to have a separate instance for testing/building Apps/Dashboards. Otherwise, a lot of the time I’ll just push the code up to production.
But at the end of the day, through this method, I can fairly quickly work locally, commit to github, have the updated code running on either server, and executing it there.
I agree it would be awesome to be able to run those remotely on your local VSCode instance.