0

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.

1 Answer 1

0

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.

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" `
>>     -FromPointInTimeBackup
Restore-AzSqlInstanceDatabase : Your Azure credentials have not been set up or have expired, please run
Connect-AzAccount to set up your Azure credentials.
At line:1 char:1
+ Restore-AzSqlInstanceDatabase `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Restore-AzSqlInstanceDatabase], ArgumentException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ManagedDatabase.Cmdlet.RestoreAzureRmSqlManagedDatabase

Additionaly, be sure that you use the latest version of Az.Sql module.

Update-Module -Name Az.Sql -Force

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.