How to add variables in read only?

Product: PowerShell Universal
Version: 5.6.4

Hey there,

I am currently trying to get our first couple scripts into production but i am a bit lost in how to import new variables into the PSU instance that is in read only.

Does someone have an efficient way?

Not sure I understand what you want.
Do you want to add variables to the
GUI/Admin/Platform/Variables?

Then just edit the .universal/variables.ps1 file.

I can not change the value of the var because it is in read only tho

Are you using Git sync manual mode?

Or maybe you have the admin console set to VS code editing mode? The new versions have introduced this recently.

well we are using git with the environment but in a different way and those config files are excluded. i managed to add and change variables using Rest API calls so we have managed to find some solution of editing variables

These are the code blocks

Invoke-RestMethod -Method Put -Uri ā€œ$PSUServer/api/v1/variable/$idā€ -UseDefaultCredentials -ContentType ā€œapplication/jsonā€ -Body ($body | ConvertTo-Json -Depth 10)

Invoke-RestMethod -Method Post -Uri ā€œ$PSUServer/api/v1/variableā€ -UseDefaultCredentials -ContentType ā€œapplication/jsonā€ -Body ($body | ConvertTo-Json -Depth 10 -Compress)

2 Likes