Esempio n. 1
0
        public virtual string OnPremisesEncryptString(SecureString value, string resourceGroupName, string dataFactoryName, string gatewayName, PSCredential credential)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            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, userName, password);
            var gatewayEncryptionClient = new GatewayEncryptionClient();

            return(gatewayEncryptionClient.Encrypt(connectionString, gatewayEncryptionInfos));
        }
Esempio n. 2
0
        public virtual string OnPremisesEncryptString(SecureString value, string resourceGroupName, string dataFactoryName, string gatewayName, PSCredential credential, string type, string nonCredentialValue, string authenticationType)
        {
            LinkedServiceType linkedServiceType = type == null ? LinkedServiceType.OnPremisesSqlLinkedService : (LinkedServiceType)Enum.Parse(typeof(LinkedServiceType), type, true);

            if (linkedServiceType != LinkedServiceType.OnPremisesOdbcLinkedService && (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);

            return(GatewayEncryptionClient.Encrypt(connectionString, gatewayEncryptionInfos));
        }
        public virtual string OnPremisesEncryptString(SecureString value, string resourceGroupName, string dataFactoryName, string gatewayName, PSCredential credential, string type, string nonCredentialValue, string authenticationType)
        {
            LinkedServiceType linkedServiceType = type == null ? LinkedServiceType.OnPremisesSqlLinkedService : (LinkedServiceType)Enum.Parse(typeof(LinkedServiceType), type, true);

            if (linkedServiceType != LinkedServiceType.OnPremisesOdbcLinkedService && (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);
            return GatewayEncryptionClient.Encrypt(connectionString, gatewayEncryptionInfos);
        }
        public virtual string OnPremisesEncryptString(SecureString value, string resourceGroupName, string dataFactoryName, string gatewayName, PSCredential credential)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            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, userName, password);
            var gatewayEncryptionClient = new GatewayEncryptionClient();
            return gatewayEncryptionClient.Encrypt(connectionString, gatewayEncryptionInfos);
        }