-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
Geo-Restore Instance Database cmdlet
change help files
Update one test
Can one of the admins verify this patch? |
@azuresdkci Add to whitelist |
1 similar comment
@azuresdkci Add to whitelist |
@azuresdkci test this please |
@lixiachena |
modify after syncing
|
||
<# | ||
.SYNOPSIS | ||
Tests Getting a managed database |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the SYNOPSIS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
src/Sql/Sql.Test/ScenarioTests/ManagedDatabaseCrudScenarioTests.ps1
Outdated
Show resolved
Hide resolved
Assert-NotNull $all | ||
if($all.Count -le 1) | ||
{ | ||
throw "Should mget more than 1 backup geo backups" |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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}", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay.
Update md file and test fiels
Added Example
Modify example
@lixiachena Please check out the file here to fix your build: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell/10703/artifact/artifacts/ValidateHelpIssues.csv/*view*/ |
Update example
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)] |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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" | ||
``` | ||
|
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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.
Description
Design spec PR is https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/225
Using this cmdlet, customer can
The changeset is adding 1 cmdlet and updating 1 cmdlet.
Get-AzSqlInstanceDatabaseGeoBackup: get geo-redundant backups on the managed instance.
Restore-AzSqlInstanceDatabase: restore an instance database from a geo-redundant backup with -FromGeoBackup parameter.
Checklist
CONTRIBUTING.md
platyPS
module