Skip to content

Commit

Permalink
Add support for creating cross-subscription Geo-replicated databases (#…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
alecbain and vidai-msft authored Nov 8, 2024
1 parent df642ec commit 58b9abd
Show file tree
Hide file tree
Showing 27 changed files with 22,056 additions and 18,994 deletions.
28 changes: 14 additions & 14 deletions src/Sql/Sql.Test/ScenarioTests/DatabaseReplicationTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
function Test-CreateDatabaseCopy()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server "Standard"
Expand Down Expand Up @@ -67,7 +67,7 @@ function Test-CreateDatabaseCopy()
function Test-CreateVcoreDatabaseCopy()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$db = Create-VcoreDatabaseForTest $rg $server 2 BasePrice
Expand Down Expand Up @@ -121,7 +121,7 @@ function Test-CreateVcoreDatabaseCopy()
function Test-CreateSecondaryDatabase()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server
Expand Down Expand Up @@ -162,7 +162,7 @@ function Test-CreateSecondaryDatabase()
function Test-CreateNamedSecondaryDatabase()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server
Expand Down Expand Up @@ -217,7 +217,7 @@ function Test-CreateNamedSecondaryDatabase()
function Test-CreateNamedSecondaryDatabaseNegative()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server
Expand Down Expand Up @@ -251,7 +251,7 @@ function Test-CreateNamedSecondaryDatabaseNegative()
function Test-GetReplicationLink()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server
Expand Down Expand Up @@ -295,7 +295,7 @@ function Test-GetReplicationLink()
function Test-SetReplicationLink()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server
Expand Down Expand Up @@ -356,7 +356,7 @@ function Test-SetReplicationLink()
function Test-RemoveSecondaryDatabase()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "West Europe"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server
Expand Down Expand Up @@ -387,7 +387,7 @@ function Test-RemoveSecondaryDatabase()
function Test-FailoverSecondaryDatabase()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server
Expand Down Expand Up @@ -484,7 +484,7 @@ function Test-CreateDatabaseCopyWithBackupStorageRedundancy()
function Test-CreateSecondaryDatabaseWithBackupStorageRedundancy()
{
# Setup
$location = "westeurope"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$database = Create-DatabaseForTest $rg $server
Expand Down Expand Up @@ -582,7 +582,7 @@ function Test-CreateSecondaryDatabaseWithGeoZoneBackupStorageRedundancy()
function Test-CreateCopyRegularAndZoneRedundantDatabaseWithSourceNotZoneRedundant()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$sourceNonZRDatabaseName = Get-DatabaseName + "-non-zr"
Expand Down Expand Up @@ -659,7 +659,7 @@ function Test-CreateCopyRegularAndZoneRedundantDatabaseWithSourceNotZoneRedundan
function Test-CreateCopyRegularAndZoneRedundantDatabaseWithSourceZoneRedundant()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"
$rg = Create-ResourceGroupForTest $location
$server = Create-ServerForTest $rg $location
$sourceZRDatabaseName = Get-DatabaseName + "-zr"
Expand Down Expand Up @@ -736,7 +736,7 @@ function Test-CreateCopyRegularAndZoneRedundantDatabaseWithSourceZoneRedundant()
function Test-CreateSecondaryRegularAndZoneRedundantDatabaseWithSourceNotZoneRedundant()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"

# Setup for geo primary
$rg = Create-ResourceGroupForTest $location
Expand Down Expand Up @@ -825,7 +825,7 @@ function Test-CreateSecondaryRegularAndZoneRedundantDatabaseWithSourceNotZoneRed
function Test-CreateSecondaryRegularAndZoneRedundantDatabaseWithSourceZoneRedundant()
{
# Setup
$location = Get-Location "Microsoft.Sql" "operations" "East US 2 EUAP"
$location = Get-Location "Microsoft.Sql" "operations" "West US 3"

# Setup for geo primary
$rg = Create-ResourceGroupForTest $location
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@
"155"
]
},
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}",
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"[Sanitized]\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}",
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
Expand Down Expand Up @@ -1839,7 +1839,7 @@
"155"
]
},
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}",
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"[Sanitized]\"\r\n },\r\n \"location\": \"eastus2euap\"\r\n}",
"ResponseHeaders": {
"Cache-Control": [
"no-cache"
Expand Down Expand Up @@ -3914,4 +3914,4 @@
"Variables": {
"SubscriptionId": "2c647056-bab2-4175-b172-493ff049eb29"
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
"RequestUri": "/subscriptions/8313371e-0879-428e-b1da-6353575a9192/resourceGroups/ps8522/providers/Microsoft.Sql/servers/ps3046?api-version=2021-02-01-preview",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODMxMzM3MWUtMDg3OS00MjhlLWIxZGEtNjM1MzU3NWE5MTkyL3Jlc291cmNlR3JvdXBzL3BzODUyMi9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9zZXJ2ZXJzL3BzMzA0Nj9hcGktdmVyc2lvbj0yMDIxLTAyLTAxLXByZXZpZXc=",
"RequestMethod": "PUT",
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"East US 2 EUAP\"\r\n}",
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"[Sanitized]\"\r\n },\r\n \"location\": \"East US 2 EUAP\"\r\n}",
"RequestHeaders": {
"x-ms-client-request-id": [
"2cf25143-74d5-449b-9c35-d44e408689f0"
Expand Down Expand Up @@ -337,4 +337,4 @@
"Variables": {
"SubscriptionId": "8313371e-0879-428e-b1da-6353575a9192"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
"RequestUri": "/subscriptions/8313371e-0879-428e-b1da-6353575a9192/resourceGroups/ps6205/providers/Microsoft.Sql/servers/ps8664?api-version=2021-02-01-preview",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvODMxMzM3MWUtMDg3OS00MjhlLWIxZGEtNjM1MzU3NWE5MTkyL3Jlc291cmNlR3JvdXBzL3BzNjIwNS9wcm92aWRlcnMvTWljcm9zb2Z0LlNxbC9zZXJ2ZXJzL3BzODY2ND9hcGktdmVyc2lvbj0yMDIxLTAyLTAxLXByZXZpZXc=",
"RequestMethod": "PUT",
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"East US 2 EUAP\"\r\n}",
"RequestBody": "{\r\n \"properties\": {\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"[Sanitized]\"\r\n },\r\n \"location\": \"East US 2 EUAP\"\r\n}",
"RequestHeaders": {
"x-ms-client-request-id": [
"e7f739c6-a5bc-464f-8cca-6bacb80a9f3f"
Expand Down Expand Up @@ -337,4 +337,4 @@
"Variables": {
"SubscriptionId": "8313371e-0879-428e-b1da-6353575a9192"
}
}
}

Large diffs are not rendered by default.

Loading

0 comments on commit 58b9abd

Please sign in to comment.