Skip to content

Geo-Restore Instance database cmdlet #8493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Feb 21, 2019

Conversation

lixiachena
Copy link
Contributor

Description

Design spec PR is https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/225

Using this cmdlet, customer can

  • Get geo-redundant backups on the managed instance.
  • Restore an instance database from a geo-redundant backup .

The changeset is adding 1 cmdlet and updating 1 cmdlet.

  • New cmdlet
    Get-AzSqlInstanceDatabaseGeoBackup: get geo-redundant backups on the managed instance.
  • Changed cmdlet
    Restore-AzSqlInstanceDatabase: restore an instance database from a geo-redundant backup with -FromGeoBackup parameter.

Checklist

Geo-Restore Instance Database cmdlet
change help files
@adxsdkps
Copy link
Collaborator

adxsdkps commented Feb 6, 2019

Can one of the admins verify this patch?

@vladimir-shcherbakov
Copy link
Contributor

@azuresdkci Add to whitelist

1 similar comment
@vladimir-shcherbakov
Copy link
Contributor

@azuresdkci Add to whitelist

@vladimir-shcherbakov
Copy link
Contributor

@azuresdkci test this please

@vladimir-shcherbakov
Copy link
Contributor

@lixiachena
Please resolve the merge conflict
ci-build failures reason could be found here


<#
.SYNOPSIS
Tests Getting a managed database
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the SYNOPSIS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

Assert-NotNull $all
if($all.Count -le 1)
{
throw "Should mget more than 1 backup geo backups"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: Should get

{
# Setup
$rgName = "restore-rg"
$managedInstanceName = "restorerunnermanagedserverwus"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change server name?

"-1"
]
},
"ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-02T15:26:04.6930711Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/restorerunnermanagedserverwus/recoverableDatabases/sourceDb_recovered6\",\r\n \"name\": \"sourceDb_recovered6\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-02T15:26:04.6930711Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/restorerunnermanagedserverwus/recoverableDatabases/sourceDb_recovered4\",\r\n \"name\": \"sourceDb_recovered4\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-02T15:26:04.6930711Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/restorerunnermanagedserverwus/recoverableDatabases/sourceDb_recovered2\",\r\n \"name\": \"sourceDb_recovered2\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-02T15:26:04.6930711Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/restorerunnermanagedserverwus/recoverableDatabases/sourceDb_recovered1_recovered\",\r\n \"name\": \"sourceDb_recovered1_recovered\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-02T15:26:04.6930711Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/restorerunnermanagedserverwus/recoverableDatabases/sourceDb_recovered1\",\r\n \"name\": \"sourceDb_recovered1\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n },\r\n {\r\n \"properties\": {\r\n \"lastAvailableBackupDate\": \"2019-02-02T15:26:04.6930711Z\"\r\n },\r\n \"id\": \"/subscriptions/a8c9a924-06c0-4bde-9788-e7b1370969e1/resourceGroups/restore-rg/providers/Microsoft.Sql/managedInstances/restorerunnermanagedserverwus/recoverableDatabases/sourceDb\",\r\n \"name\": \"sourceDb\",\r\n \"type\": \"Microsoft.Sql/managedInstances/recoverableDatabases\"\r\n }\r\n ]\r\n}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change restorerunnermanagedserverwus everywhere in this file to another server name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay.

@maddieclayton
Copy link
Contributor

pixia
pixia previously approved these changes Feb 13, 2019
Regenerate restore-azsqlinstancedatabase.md
@@ -63,5 +63,19 @@ public void TestRestoreManagedDatabase()
{
RunPowerShellTest("Test-RestoreManagedDatabase");
}

[Fact(Skip = "Setup time is long (more than 10 hours)")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the test recorded - it should't take long to playback - so you don't need to skip it. If a test skipped it's in fact disabled.


[Fact(Skip = "Setup time is long (more than 10 hours)")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestGeoRestoreManagedDatabase()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same comment.


# geo-restore managed database using piping
$restoredDb4 = Restore-AzSqlInstanceDatabase -FromGeoBackup -ResourceGroupName $rgName -InstanceName $managedInstanceName -Name $managedDatabaseName -TargetInstanceDatabaseName $targetManagedDatabaseName4 -TargetInstanceName $targetInstanceName -TargetResourceGroupName $targetRgName
Assert-NotNull $restoredDb4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you point me to where piping gets actually tested?

PS C:\>$GeoBackup = Get-AzSqlInstanceDatabaseGeoBackup -ResourceGroupName "ResourceGroup01" -InstanceName "managedInstance1" -Name "Database01"
PS C:\> Restore-AzSqlDatabase -FromGeoBackup -GeoBackupObject $GeoBackup -TargetInstanceDatabaseName "Database01_restored" -TargetInstanceName "managedInstance1" -TargetResourceGroupName "ResourceGroup02"
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no changes.

@@ -149,13 +199,41 @@ public class RestoreAzureRmSqlManagedDatabase
Position = 0,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource id of instance database object to restore")]
[Parameter(ParameterSetName = GeoRestoreFromGeoBackupSetNameFromResourceIdParameterSet,
Mandatory = true,
HelpMessage = "The name of the target instance to restore to.")]
[ValidateNotNullOrEmpty]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the HelpMessage value.

@vladimir-shcherbakov
Copy link
Contributor

@vladimir-shcherbakov vladimir-shcherbakov merged commit 67b66d3 into Azure:master Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants