public override ProjectTaskProperties ProcessTaskCmdlet()
        {
            ConnectToTargetSqlMISyncTaskProperties properties = new ConnectToTargetSqlMISyncTaskProperties();

            if (MyInvocation.BoundParameters.ContainsKey(TargetConnection))
            {
                var          targetConnectionInfo = (MiSqlConnectionInfo)MyInvocation.BoundParameters[TargetConnection];
                PSCredential cred = (PSCredential)MyInvocation.BoundParameters[TargetCred];
                targetConnectionInfo.UserName = cred.UserName;
                targetConnectionInfo.Password = Decrypt(cred.Password);

                PSAzureActiveDirectoryApp aadAp = (PSAzureActiveDirectoryApp)MyInvocation.BoundParameters[AadApp];

                AzureActiveDirectoryApp app = new AzureActiveDirectoryApp
                {
                    ApplicationId = aadAp.ApplicationId,
                    AppKey        = Decrypt(aadAp.AppKey),
                    TenantId      = aadAp.TenantId
                };

                properties.Input = new ConnectToTargetSqlMISyncTaskInput
                {
                    TargetConnectionInfo = targetConnectionInfo,
                    AzureApp             = app
                };
            }
            else
            {
                throw new PSArgumentException("Invalid Argument List");
            }

            return(properties);
        }
        public override ProjectTaskProperties ProcessTaskCmdlet()
        {
            MiSqlConnectionInfo targetConnectionInfo = null;
            SqlConnectionInfo   sourceConnectionInfo = null;
            List <MigrateSqlServerSqlMIDatabaseInput> selectedDatabases = null;
            FileShare backupFileShare = null;
            string    storageId       = null;

            if (MyInvocation.BoundParameters.ContainsKey(TargetConnection))
            {
                targetConnectionInfo = (MiSqlConnectionInfo)MyInvocation.BoundParameters[TargetConnection];
                PSCredential cred = (PSCredential)MyInvocation.BoundParameters[TargetCred];
                targetConnectionInfo.UserName = cred.UserName;
                targetConnectionInfo.Password = Decrypt(cred.Password);
            }

            if (MyInvocation.BoundParameters.ContainsKey(SourceConnection))
            {
                sourceConnectionInfo = (SqlConnectionInfo)MyInvocation.BoundParameters[SourceConnection];
                PSCredential cred = (PSCredential)MyInvocation.BoundParameters[SourceCred];
                sourceConnectionInfo.UserName = cred.UserName;
                sourceConnectionInfo.Password = Decrypt(cred.Password);
            }

            if (MyInvocation.BoundParameters.ContainsKey(SelectedDatabase))
            {
                selectedDatabases
                    = ((MigrateSqlServerSqlMIDatabaseInput[])MyInvocation.BoundParameters[SelectedDatabase]).ToList();
            }

            if (MyInvocation.BoundParameters.ContainsKey(BackupFileShare))
            {
                backupFileShare = (FileShare)MyInvocation.BoundParameters[BackupFileShare];
            }

            if (MyInvocation.BoundParameters.ContainsKey(StorageResourceId))
            {
                storageId = MyInvocation.BoundParameters[StorageResourceId] as string;
            }

            PSAzureActiveDirectoryApp aadAp = (PSAzureActiveDirectoryApp)MyInvocation.BoundParameters[AadApp];

            AzureActiveDirectoryApp app = new AzureActiveDirectoryApp
            {
                ApplicationId = aadAp.ApplicationId,
                AppKey        = Decrypt(aadAp.AppKey),
                TenantId      = aadAp.TenantId
            };

            var properties = new MigrateSqlServerSqlMISyncTaskProperties
            {
                Input = new MigrateSqlServerSqlMISyncTaskInput
                {
                    TargetConnectionInfo = targetConnectionInfo,
                    SourceConnectionInfo = sourceConnectionInfo,
                    SelectedDatabases    = selectedDatabases,
                    BackupFileShare      = backupFileShare,
                    StorageResourceId    = storageId,
                    AzureApp             = app
                }
            };

            return(properties);
        }