Hi @Khidir Elsanosi ,
The answer is outlined here: using-sensitive-parameters-ssis-series
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have username and password as package parameters [$Package::user] and [$Package::Pass], which I set the sensitivity property to true (Sensitive=True). These parameters are then used inside a script task (C#) to authenticate a rest call using httpClient as below:
string myuser = Dts.Variables["$Package::user"].GetSensitiveValue().ToString();
string mypass = Dts.Variables["$Package::pass"].GetSensitiveValue().ToString();
var httpClientHandler = new HttpClientHandler()
{
Credentials = new NetworkCredential(myuser, mypass),
};
var client = new HttpClient(httpClientHandler);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var response = client.GetStringAsync(new Uri(url)).Result;
this peace of code returns the following error:
"Accessing value of the parameter variable for the sensitive parameter "pass" is not allowed. Verify that the variable is used properly and that it protects the sensitive information"
It worth mentioning that when I change the sensitivity of the parameters to (False) the exact same code above works, and I get the response back.
My question is: how to resolve this error, so I can make the rest call using the sensitive username and password.
Thanks
Hi @Khidir Elsanosi ,
The answer is outlined here: using-sensitive-parameters-ssis-series
Hi @Khidir Elsanosi ,
According to my test, we can use the following script to read the sensitive parameter :
public void Main()
{
string myuser = Dts.Variables["$Package::User"].GetSensitiveValue().ToString();
string mypass = Dts.Variables["$Package::Pass"].GetSensitiveValue().ToString();
MessageBox.Show("MyUser: "+myuser+ "/n"+"MyPass: "+mypass);
Dts.TaskResult = (int)ScriptResults.Success;
}
Please refer to the following links and pictures:
Reading sensitive parameters in a script
Access Control for Sensitive Data in Packages
Best Regards,
Mona
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues in October--Users always get connection timeout problem when using multi subnet AG via listener. Especially after failover to another subnet.