You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/sql-database/sql-database-active-geo-replication.md
+72Lines changed: 72 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,6 +119,78 @@ If you decide to create the secondary with lower compute size, the log IO percen
119
119
120
120
For more information on the SQL Database compute sizes, see [What are SQL Database Service Tiers](sql-database-purchase-models.md).
121
121
122
+
## Cross-subscription geo-replication
123
+
124
+
To setup active geo-replication between two databases belonging to different subscriptions (whether under the same tenant or not), you must follow the special procedure described in this section. The procedure is based on SQL commands and requires:
125
+
126
+
- Creating a privileged login on both servers
127
+
- Whitelisting the IP address of the client performing the change on both servers (such as the IP address of the host running SQL Server Management Studio).
128
+
129
+
The client performing the changes needs network access to the primary server. Although the same IP address of the client must be whitelisted on the secondary server, network connectivity to the secondary server is not strictly required.
130
+
131
+
### On the master of the primary server
132
+
133
+
1. Whitelist the IP address of the client performing the changes (for more information see, [Configure firewall](sql-database-firewall-configure.md)).
134
+
1. Create a login dedicated to setup active geo-replication (and adjust the credentials as needed):
135
+
136
+
```sql
137
+
create login geodrsetup with password ='ComplexPassword01'
138
+
```
139
+
140
+
1. Create a corresponding user and assign it to the dbmanager role:
141
+
142
+
```sql
143
+
createusergeodrsetup for login gedrsetup
144
+
alter role geodrsetup dbmanager add member geodrsetup
145
+
```
146
+
1. Take note of the SID of the new login using this query:
147
+
148
+
```sql
149
+
select sid fromsys.sql_loginswhere name ='geodrsetup'
150
+
```
151
+
152
+
### On the source database on the primary server
153
+
154
+
1. Create a user for the same login:
155
+
156
+
```sql
157
+
createusergeodrsetup for login geodrsetup
158
+
```
159
+
160
+
1. Add the user to the db_owner role:
161
+
162
+
```sql
163
+
alter role db_owner add member geodrsetup
164
+
```
165
+
166
+
### On the master of the secondary server
167
+
168
+
1. Whitelist the IP address of the client performing the changes. It must the same exact IP address of the primary server.
169
+
1. Create the same login as on the primary server, using the same username password, and SID:
170
+
171
+
```sql
172
+
create login geodrsetup with password ='ComplexPassword01', sid=0x010600000000006400000000000000001C98F52B95D9C84BBBA8578FACE37C3E
173
+
```
174
+
175
+
1. Create a corresponding user and assign it to the dbmanager role:
176
+
177
+
```sql
178
+
createusergeodrsetup for login geodrsetup;
179
+
alter role dbmanager add member geodrsetup
180
+
```
181
+
182
+
### On the master of the primary server
183
+
184
+
1. Login to the master of the primary server using the new login.
185
+
1. Create a secondary replica of the source database on the secondary server (adjust database name and servername as needed):
186
+
187
+
```sql
188
+
alterdatabase dbrep add secondary on server <servername>
189
+
```
190
+
191
+
After the initial setup, the users, logins, and firewall rules created can be removed.
192
+
193
+
122
194
## Keeping credentials and firewall rules in sync
123
195
124
196
We recommend using [database-level IP firewall rules](sql-database-firewall-configure.md) for geo-replicated databases so these rules can be replicated with the database to ensure all secondary databases have the same IP firewall rules as the primary. This approach eliminates the need for customers to manually configure and maintain firewall rules on servers hosting both the primary and secondary databases. Similarly, using [contained database users](sql-database-manage-logins.md) for data access ensures both primary and secondary databases always have the same user credentials so during a failover, there is no disruptions due to mismatches with logins and passwords. With the addition of [Azure Active Directory](../active-directory/fundamentals/active-directory-whatis.md), customers can manage user access to both primary and secondary databases and eliminating the need for managing credentials in databases altogether.
0 commit comments