I am trying to figure out how to restore a database from one managed SQL instance to another. I'm following the tutorials, but I keep running into inscrutable error messages.
Here's my command:
Restore-AzSqlInstanceDatabase `
-Name "SomeDatabase" `
-InstanceName "our-oltp-dev" `
-ResourceGroupName "dev-managedsqlinstances" `
-PointInTime "4/7/2020 12:00:00" `
-TargetInstanceDatabaseName "SomeDatabase_FROM_DEV" `
-TargetInstanceName "our-oltp-sandbox" `
-TargetResourceGroupName "sandbox-managedsqlinstances"
Here's the output:
PS C:\WINDOWS\system32> Restore-AzSqlInstanceDatabase `
-Name "SomeDatabase" `
-InstanceName "our-oltp-dev" `
-ResourceGroupName "dev-managedsqlinstances" `
-PointInTime "4/7/2020 12:00:00" `
-TargetInstanceDatabaseName "SomeDatabase_FROM_DEV" `
-TargetInstanceName "our-oltp-sandbox" `
-TargetResourceGroupName "sandbox-managedsqlinstances"
Restore-AzSqlInstanceDatabase : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Restore-AzSqlInstanceDatabase `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Restore-AzSqlInstanceDatabase], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.Sql.ManagedDatabase.Cmdlet.RestoreAzureRmSqlManagedDatabase
It's a copy-and-paste from the Azure docs; so I'm not sure what I'm doing wrong. Any help would be appreciated.
Best Answer
This command is somehow not clear for PowerShell and there is problem to determine which version of the method is accurate.
However it should work if you specify
-FromPointInTimeBackup
switch, I have checked it and got credentials error which is fine as I am not logged in to proper account.Additionaly, be sure that you use the latest version of Az.Sql module.