I am trying to backup an Azure database to my local machine and then restore to a different location in Azure using Powershell . My script I am using is
# Define clear text string for username and password
[string]$userName = '<username>'
[string]$userPassword = '<password>'
# Convert to SecureString
[securestring]$secStringPassword = ConvertTo-SecureString $userPassword -AsPlainText -Force
[pscredential]$credObject = New-Object System.Management.Automation.PSCredential ($userName,
$secStringPassword)
Backup-SqlDatabase -ServerInstance "<server>.database.windows.net" -Database "TestDB" -
BackupFile "c:\testbackup.bak" -Credential $credObject
But I am getting the error :
Backup-SqlDatabase : System.Data.SqlClient.SqlError: Statement 'BACKUP DATABASE' is not
supported in this version of SQL Server.
Is there a different command to backup an Azure database that is any version using Powershell ?