I have migrated our test environment to the sql db and I can see the table dbo.Variable but it’s empty can’t I save variables in the db?
Also, how can I make an other host to understand what Token it should use? The tokens are synced between the hostas also the identitets but in the dashboard how can I extract the Token from the sql to use it in a function?
Variables are stored in the variables.ps1 file and not the database. In 3.6, you will be able to store secret variables in the database but we will still need a record in the variables.ps1 for each secret. The value of the secret will be in the database.
App Tokens are stored in the database. You can use Get-PSUAppToken to get tokens out of the database. You shouldn’t have to query the database directly.
The thing with secret variables is a pita when you have multiple nodes.
But how do you secure them in the sql?
It would also be perfect to store triggers and other stuff in the SQL.
They are AES encrypted with a configurable key. I still think a password vault, like Azure Key Vault, is a more secure solution but this is much easier to use.
As for storing configuration in the database, we are also including this in version 3.6. We will provide a way to store the git repository in the database rather than a git remote. This removes the need to separately configure a git hosting provider like GitHub or Gitlab.
It still won’t allow you to query configurations through SQL but will also be much easier to configure and use.
Can you provide an example for the Get-PSUAppToken? For example if I want the app token for the identity “user1”
You should just be able to use the -Identity parameter.
Get-PSUAppToken -Identity $UserName
If you are trying to grant an app token, you could use Grant-PSUAppToken.
Grant-PSUAppToken -IdentityName $UserName -Role 'Operator'