Fizcko / Azure_DevOps_Vault_Interaction

Azure DevOps extension to interact with HashiCorp Vault.
MIT License
10 stars 11 forks source link

Variable loaded by the task « Vault - Read KV secrets » contains a base64 encoded value. how to decode it ? #17

Closed tushi0407 closed 1 year ago

tushi0407 commented 1 year ago

I am using task « Vault - Read KV secrets » in one of my azure pipeline. I am able to fetch my secret KV value. This showing as masked (***) in log window of pipeline. I try writing text file using this variable and then print it on output window , i try decode it using powershell task but everything giving me masked value. Please suggest how i can decode it to simple string so that i can use it in next task. I also try Tool task but it is use to create file , i try that as well but no success. image

Fizcko commented 1 year ago

Hi @tushi0407 In your next task you just have to use the variable $(APP1_DbUserId)

tushi0407 commented 1 year ago

Hi @tushi0407 In your next task you just have to use the variable $(APP1_DbUserId)

Thanks @Fizcko for quick reply. I already did that. What i did is , i create a txt file using poweshell task(using powershell commands)and then read that file again using powershell commands. But still it is showing as masking value only. Please see the screen shot below of powershell task and its result. image image

Fizcko commented 1 year ago

@tushi0407 the variable is set as a secret value. So each time Azure DevOps see the content of this variable in a log it will be masked.

Maybe try this trick (powershell script) but i don't thinks that will works:

echo "##vso[task.setvariable variable=myUserID;isOutput=true;issecret=false]$(APP1_DbUserId)"
Write-Output "UserID: '$(myUserID)'"
tushi0407 commented 1 year ago

@tushi0407 the variable is set as a secret value. So each time Azure DevOps see the content of this variable in a log it will be masked.

Maybe try this trick (powershell script) but i don't thinks that will works:

echo "##vso[task.setvariable variable=myUserID;isOutput=true;issecret=false]$(APP1_DbUserId)"
Write-Output "UserID: '$(myUserID)'"

No , this is also not working. So there is not any way to print this value ? but if we write it in file and open the file manually , we will be able to see this value ?

Fizcko commented 1 year ago

Print the value will be impossible but yes you will be able to see the value directly in the file

tushi0407 commented 1 year ago

Print the value will be impossible but yes you will be able to see the value directly in the file

Yes thats working fine. I am able to read it manually from text file.