How to read the sensitive parameter value in SSIS script task?

1.4k Views Asked by At

In my SSIS package, I need to use a password parameter and I would like to keep it as sensitive. Is there a way to read this sensitive parameter value in the script task?

I tried to use the GetSensitiveValue() method as in this link but it always returns an empty string.

Image of parameters in visual studio

Adding the code below

Variables varCollection = null;


Dts.VariableDispenser.LockForRead("User::Username");
Dts.VariableDispenser.LockForRead("$Package::Password");
Dts.VariableDispenser.GetVariables(ref varCol);


var username = varCollection["User::Username"].Value.ToString();
var password = varCollection["$Package::Password"].GetSensitiveValue().ToString();


            

Are there any other ways to read the sensitive parameter value?

0

There are 0 best solutions below