Skip to content

Commit 58b9abd

Browse files
alecbainvidai-msft
andauthored
Add support for creating cross-subscription Geo-replicated databases (Azure#26598)
* add cross subscription support for NewAzSqlDatabaseSecondary cmdlet * run replication tests to validate cross-sub change * update changelog * fix typo on resource group assert * update help document with new param * Sanitize data --------- Co-authored-by: Vincent Dai <[email protected]>
1 parent df642ec commit 58b9abd

27 files changed

+22056
-18994
lines changed

src/Sql/Sql.Test/ScenarioTests/DatabaseReplicationTests.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
function Test-CreateDatabaseCopy()
2020
{
2121
# Setup
22-
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
22+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
2323
$rg = Create-ResourceGroupForTest $location
2424
$server = Create-ServerForTest $rg $location
2525
$database = Create-DatabaseForTest $rg $server "Standard"
@@ -67,7 +67,7 @@ function Test-CreateDatabaseCopy()
6767
function Test-CreateVcoreDatabaseCopy()
6868
{
6969
# Setup
70-
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
70+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
7171
$rg = Create-ResourceGroupForTest $location
7272
$server = Create-ServerForTest $rg $location
7373
$db = Create-VcoreDatabaseForTest $rg $server 2 BasePrice
@@ -121,7 +121,7 @@ function Test-CreateVcoreDatabaseCopy()
121121
function Test-CreateSecondaryDatabase()
122122
{
123123
# Setup
124-
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
124+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
125125
$rg = Create-ResourceGroupForTest $location
126126
$server = Create-ServerForTest $rg $location
127127
$database = Create-DatabaseForTest $rg $server
@@ -162,7 +162,7 @@ function Test-CreateSecondaryDatabase()
162162
function Test-CreateNamedSecondaryDatabase()
163163
{
164164
# Setup
165-
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
165+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
166166
$rg = Create-ResourceGroupForTest $location
167167
$server = Create-ServerForTest $rg $location
168168
$database = Create-DatabaseForTest $rg $server
@@ -217,7 +217,7 @@ function Test-CreateNamedSecondaryDatabase()
217217
function Test-CreateNamedSecondaryDatabaseNegative()
218218
{
219219
# Setup
220-
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
220+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
221221
$rg = Create-ResourceGroupForTest $location
222222
$server = Create-ServerForTest $rg $location
223223
$database = Create-DatabaseForTest $rg $server
@@ -251,7 +251,7 @@ function Test-CreateNamedSecondaryDatabaseNegative()
251251
function Test-GetReplicationLink()
252252
{
253253
# Setup
254-
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
254+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
255255
$rg = Create-ResourceGroupForTest $location
256256
$server = Create-ServerForTest $rg $location
257257
$database = Create-DatabaseForTest $rg $server
@@ -295,7 +295,7 @@ function Test-GetReplicationLink()
295295
function Test-SetReplicationLink()
296296
{
297297
# Setup
298-
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
298+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
299299
$rg = Create-ResourceGroupForTest $location
300300
$server = Create-ServerForTest $rg $location
301301
$database = Create-DatabaseForTest $rg $server
@@ -356,7 +356,7 @@ function Test-SetReplicationLink()
356356
function Test-RemoveSecondaryDatabase()
357357
{
358358
# Setup
359-
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
359+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
360360
$rg = Create-ResourceGroupForTest $location
361361
$server = Create-ServerForTest $rg $location
362362
$database = Create-DatabaseForTest $rg $server
@@ -387,7 +387,7 @@ function Test-RemoveSecondaryDatabase()
387387
function Test-FailoverSecondaryDatabase()
388388
{
389389
# Setup
390-
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
390+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
391391
$rg = Create-ResourceGroupForTest $location
392392
$server = Create-ServerForTest $rg $location
393393
$database = Create-DatabaseForTest $rg $server
@@ -484,7 +484,7 @@ function Test-CreateDatabaseCopyWithBackupStorageRedundancy()
484484
function Test-CreateSecondaryDatabaseWithBackupStorageRedundancy()
485485
{
486486
# Setup
487-
$location = "westeurope"
487+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
488488
$rg = Create-ResourceGroupForTest $location
489489
$server = Create-ServerForTest $rg $location
490490
$database = Create-DatabaseForTest $rg $server
@@ -582,7 +582,7 @@ function Test-CreateSecondaryDatabaseWithGeoZoneBackupStorageRedundancy()
582582
function Test-CreateCopyRegularAndZoneRedundantDatabaseWithSourceNotZoneRedundant()
583583
{
584584
# Setup
585-
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
585+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
586586
$rg = Create-ResourceGroupForTest $location
587587
$server = Create-ServerForTest $rg $location
588588
$sourceNonZRDatabaseName = Get-DatabaseName + "-non-zr"
@@ -659,7 +659,7 @@ function Test-CreateCopyRegularAndZoneRedundantDatabaseWithSourceNotZoneRedundan
659659
function Test-CreateCopyRegularAndZoneRedundantDatabaseWithSourceZoneRedundant()
660660
{
661661
# Setup
662-
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
662+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
663663
$rg = Create-ResourceGroupForTest $location
664664
$server = Create-ServerForTest $rg $location
665665
$sourceZRDatabaseName = Get-DatabaseName + "-zr"
@@ -736,7 +736,7 @@ function Test-CreateCopyRegularAndZoneRedundantDatabaseWithSourceZoneRedundant()
736736
function Test-CreateSecondaryRegularAndZoneRedundantDatabaseWithSourceNotZoneRedundant()
737737
{
738738
# Setup
739-
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
739+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
740740

741741
# Setup for geo primary
742742
$rg = Create-ResourceGroupForTest $location
@@ -825,7 +825,7 @@ function Test-CreateSecondaryRegularAndZoneRedundantDatabaseWithSourceNotZoneRed
825825
function Test-CreateSecondaryRegularAndZoneRedundantDatabaseWithSourceZoneRedundant()
826826
{
827827
# Setup
828-
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
828+
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
829829

830830
# Setup for geo primary
831831
$rg = Create-ResourceGroupForTest $location

src/Sql/Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseReplicationTests/CreateDatabaseCopyWithPerDBCMK.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@
555555
"155"
556556
]
557557
},
558-
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}",
558+
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"[Sanitized]\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}",
559559
"ResponseHeaders": {
560560
"Cache-Control": [
561561
"no-cache"
@@ -1839,7 +1839,7 @@
18391839
"155"
18401840
]
18411841
},
1842-
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}",
1842+
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"[Sanitized]\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}",
18431843
"ResponseHeaders": {
18441844
"Cache-Control": [
18451845
"no-cache"
@@ -3914,4 +3914,4 @@
39143914
"Variables": {
39153915
"SubscriptionId": "2c647056-bab2-4175-b172-493ff049eb29"
39163916
}
3917-
}
3917+
}

src/Sql/Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseReplicationTests/TestCreateCopyDatabaseWithGeoZoneBackupStorageRedundancy.json

Lines changed: 3283 additions & 1735 deletions
Large diffs are not rendered by default.

src/Sql/Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseReplicationTests/TestCreateCopyRegularAndZoneRedundantDatabaseWithSourceNotZoneRedundant.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
"RequestUri": "/subscriptions/8313371e-0879-428e-b1da-6353575a9192/resourceGroups/ps8522/providers/Microsoft.Sql/servers/ps3046?api-version=2021-02-01-preview",
191191
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODMxMzM3MWUtMDg3OS00MjhlLWIxZGEtNjM1MzU3NWE5MTkyL3Jlc291cmNlR3JvdXBzL3BzODUyMi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9zZXJ2ZXJzL3BzMzA0Nj9hcGktdmVyc2lvbj0yMDIxLTAyLTAxLXByZXZpZXc=",
192192
"RequestMethod": "PUT",
193-
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"East US 2 EUAP\"\r\n}",
193+
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"[Sanitized]\"\r\n },\r\n \"location\": \"East US 2 EUAP\"\r\n}",
194194
"RequestHeaders": {
195195
"x-ms-client-request-id": [
196196
"2cf25143-74d5-449b-9c35-d44e408689f0"
@@ -337,4 +337,4 @@
337337
"Variables": {
338338
"SubscriptionId": "8313371e-0879-428e-b1da-6353575a9192"
339339
}
340-
}
340+
}

src/Sql/Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseReplicationTests/TestCreateCopyRegularAndZoneRedundantDatabaseWithSourceZoneRedundant.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
"RequestUri": "/subscriptions/8313371e-0879-428e-b1da-6353575a9192/resourceGroups/ps6205/providers/Microsoft.Sql/servers/ps8664?api-version=2021-02-01-preview",
191191
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODMxMzM3MWUtMDg3OS00MjhlLWIxZGEtNjM1MzU3NWE5MTkyL3Jlc291cmNlR3JvdXBzL3BzNjIwNS9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9zZXJ2ZXJzL3BzODY2ND9hcGktdmVyc2lvbj0yMDIxLTAyLTAxLXByZXZpZXc=",
192192
"RequestMethod": "PUT",
193-
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"East US 2 EUAP\"\r\n}",
193+
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"[Sanitized]\"\r\n },\r\n \"location\": \"East US 2 EUAP\"\r\n}",
194194
"RequestHeaders": {
195195
"x-ms-client-request-id": [
196196
"e7f739c6-a5bc-464f-8cca-6bacb80a9f3f"
@@ -337,4 +337,4 @@
337337
"Variables": {
338338
"SubscriptionId": "8313371e-0879-428e-b1da-6353575a9192"
339339
}
340-
}
340+
}

src/Sql/Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseReplicationTests/TestCreateDatabaseCopy.json

Lines changed: 1732 additions & 1948 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)