0

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?

Ashan
  • 13
  • 5
  • 1
    Show your code and how you're starting the package because that method works – billinkc Jul 27 '20 at 18:03
  • See also https://stackoverflow.com/a/29018507/181965 – billinkc Jul 27 '20 at 18:03
  • @billinkc Thanks for the response. I have added the code and a image of the parameters to this post. – Ashan Jul 27 '20 at 19:26
  • `varCollection["$Package::Password"].GetSensitiveValue.ToString()` is not the same as `varCollection["$Package::Password"].GetSensitiveValue().ToString()` Also, since you have specified the Required is True for the package, showing the design-time parameters doesn't help as you will need to specify them at run-time (which allows us to reproduce your error condition). Obviously, don't tell us the real password but showing how the package is invoked will help provide a minimal reproduction of the error. – billinkc Jul 27 '20 at 19:31
  • @billinkc GetSensitiveValue without () was a typo, I corrected that in the post. . The username, password and other package parameters are stored in the SSIS Environment variables. The package will be invoked from a stored procedure. – Ashan Jul 27 '20 at 19:52

0 Answers0