public virtual string OnPremisesEncryptString(SecureString value,
string resourceGroupName,
string dataFactoryName,
string gatewayName,
PSCredential credential,
string type,
string nonCredentialValue,
string authenticationType,
string serverName, string databaseName)
{
LinkedServiceType linkedServiceType = type == null ? LinkedServiceType.OnPremisesSqlLinkedService : GetLinkedServiceType(type);
if (linkedServiceType == LinkedServiceType.OnPremisesSqlLinkedService && linkedServiceType == LinkedServiceType.OnPremisesOracleLinkedService
&& linkedServiceType == LinkedServiceType.OnPremisesFileSystemLinkedService && (value == null || value.Length == 0))
{
throw new ArgumentNullException("value");
}
AuthenticationType authType = authenticationType == null ? AuthenticationType.None : (AuthenticationType)Enum.Parse(typeof(AuthenticationType), authenticationType, true);
var response = DataPipelineManagementClient.Gateways.RetrieveConnectionInfo(resourceGroupName, dataFactoryName, gatewayName);
var gatewayEncryptionInfos = new[]
{
new GatewayEncryptionInfo
{
ServiceToken = response.ConnectionInfo.ServiceToken,
IdentityCertThumbprint = response.ConnectionInfo.IdentityCertThumbprint,
HostServiceUri = response.ConnectionInfo.HostServiceUri,
InstanceVersionString = response.ConnectionInfo.Version
}
};
string userName = credential != null ? credential.UserName : null;
SecureString password = credential != null ? credential.Password : null;
UserInputConnectionString connectionString = new UserInputConnectionString(value, nonCredentialValue, userName, password, linkedServiceType, authType, serverName, databaseName);
return GatewayEncryptionClient.Encrypt(connectionString, gatewayEncryptionInfos);
}