How to migrate SQL Server Instance from Local Instance to Azure VM SQL Server Instance?

Seeking for experts support resolving following issue.

Scenario:

LocalInstance: SQLSRV01

Azure VM: 23.96.20.20

-Local SQL SERVER and Azure VM SQL SERVER Instance are of SQLSERVER 2017 (14.0)

-Added Inbound port rule for sql server

-SharedPath accessible from both sides ( Local computer as well as from Azure VM: 23.96.20.20 )

-DBSERVER17 instance is accessible and connected from local computer

-Same command worked well at my local computer with two different SQL SERVER Instances.

Power Shell Script:

 $params = @{
 Source = "SQLSRV01"
 Destination = "23.96.20.20"
 SharedPath = "Z:"
 BackupRestore = $true
 }
  Start-DbaMigration @params -Force | Select * | Out-GridView

Output Received:

PS C:\WINDOWS\system32> E:\PowerShellScripts\RemoteInstance.ps1
WARNING: [16:05:58][Copy-DbaSpConfigure] Error occurred while establishing connection to 23.96.20.20 | The wait operat
ion timed out
WARNING: [16:06:15][Copy-DbaCustomError] Error occurred while establishing connection to 23.96.20.20 | The wait operat
ion timed out
WARNING: [16:06:15][Copy-DbaCredential] Console not elevated, but elevation is required to perform some actions on loc
alhost for this command.
WARNING: [16:06:15][Copy-DbaDbMail] Error occurred while establishing connection to 23.96.20.20 | The wait operation t
imed out
WARNING: [16:06:15][Copy-DbaRegServer] Error occurred while establishing connection to 23.96.20.20 | The wait operatio
n timed out
WARNING: [16:06:15][Copy-DbaBackupDevice] Error occurred while establishing connection to 23.96.20.20 | The wait opera
tion timed out
WARNING: [16:06:15][Copy-DbaInstanceTrigger] Error occurred while establishing connection to 23.96.20.20 | The wait op
eration timed out
WARNING: [16:06:15][Copy-DbaDatabase] Error occurred while establishing connection to 23.96.20.20 | The wait operation
 timed out
WARNING: [16:06:15][Copy-DbaLogin] Error occurred while establishing connection to 23.96.20.20 | The wait operation ti
med out
The wait operation timed out
At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.0.113\allcommands.ps1:83435 char:9
         throw $records[0]
         ~~~~~~~~~~~~~~~~~
     CategoryInfo          : NotSpecified: (:) [], Exception
     FullyQualifiedErrorId : dbatools_Connect-DbaInstance
1

There are 1 best solutions below

0
On BEST ANSWER

Supplied parameters $scred, $dcred then passed $scred object to the SourceSqlCredential and passed $dcred object to the DestinationSqlCredential that's it.

  $scred = Get-Credential
  $dcred = Get-Credential
  $params = @{
  Source = "SQLSRV01"
  Destination = "23.96.20.20"
  SourceSqlCredential = $scred
  DestinationSqlCredential =$dcred
  SharedPath = "\\SharedDB"
  BackupRestore = $true
  }
   Start-DbaMigration @params -Force | Select * | Out-GridView