TP Geo Rep Powershell
TP Geo Rep Powershell
io)
Mot de passe : P@ssw0rd
# Establish Active Geo-Replication
$secondaryResourceGroupName = "mySecondaryResourceGroup-$(Get-Random)"
$secondaryServerName = "secondary-server-$(Get-Random)"
-ServerName servreplic
# Connect-AzAccount
$SubscriptionId = ''
# Set the resource group name and location for your primary server
$primaryResourceGroupName = "myPrimaryResourceGroup-$(Get-Random)"
$primaryLocation = "westus2"
# Set the resource group name and location for your secondary server
$secondaryResourceGroupName = "mySecondaryResourceGroup-$(Get-Random)"
$secondaryLocation = "eastus"
$adminSqlLogin = "SqlAdmin"
$password = "ChangeYourAdminPassword1"
# Set server names - the logical server names have to be unique in the system
$primaryServerName = "primary-server-$(Get-Random)"
$secondaryServerName = "secondary-server-$(Get-Random)"
$databasename = "mySampleDatabase"
# The ip address range that you want to allow to access your servers
$primaryStartIp = "0.0.0.0"
$primaryEndIp = "0.0.0.0"
$secondaryStartIp = "0.0.0.0"
$secondaryEndIp = "0.0.0.0"
# Set subscription
# Create two new logical servers with a system wide unique server name
-ServerName $primaryServerName `
-Location $primaryLocation `
-ServerName $secondaryServerName `
-Location $secondaryLocation `
# Create a server firewall rule for each server that allows access from the specified IP range
-ServerName $primaryservername `
-ServerName $primaryServerName `
$secondaryLink | Remove-AzSqlDatabaseSecondary
# Clean up deployment