Skip to content

Commit 9fcdbd4

Browse files
author
Rohit Nayak
committed
Updated Data Sync section with automation instructions
1 parent f3c06e9 commit 9fcdbd4

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

articles/sql-database/sql-database-networkaccess-overview.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The Azure SQL Database Query Editor is deployed on VMs in Azure. These VMs are n
5959

6060
Azure SQL Database has the Data Sync feature that connects to your databases using Azure IPs.
6161

62-
To use the Data sync feature with **Allow Azure services to access server** set to OFF, you need to create individual firewall rule entries to [add IP addresses](sql-database-server-level-firewall-rule.md) from the Sql **service tag** for the region hosting the **Hub** database.
62+
To use the Data sync feature with **Allow Azure services to access server** set to OFF, you need to create individual firewall rule entries to [add IP addresses](sql-database-server-level-firewall-rule.md) from the **Sql service tag** for the region hosting the **Hub** database.
6363
Add these server level firewall rules to the logical servers hosting both **Hub** and **Member** databases ( which may be in different regions)
6464

6565
Use the following PowerShell script to generate the IP addresses corresponding to Sql service tag for West US region
@@ -78,18 +78,29 @@ PS C:\> $sql.Properties.AddressPrefixes
7878
```
7979

8080
> [!TIP]
81-
> Get-AzNetworkServiceTag returns the global range for SQL Service Tag despite specifying the Location parameter. Be sure to filter it to the region that hosts the Hub database used by your sync group
82-
83-
Note that the output of the PowerShell script is in Classless Inter Domain Routing(CIDR) notation.
84-
Use [Get-IPrangeStartEnd.ps1](https://gallery.technet.microsoft.com/scriptcenter/Start-and-End-IP-addresses-bcccc3a9) to convert from CIDR notation to Start and End IP addresses- which you can then enter as firewall rules.
81+
> Get-AzNetworkServiceTag returns the global range for Sql Service Tag despite specifying the Location parameter. Be sure to filter it to the region that hosts the Hub database used by your sync group
8582
83+
Note that the output of the PowerShell script is in Classless Inter Domain Routing (CIDR) notation and this needs to be converted to a format of Start and End IP address using [Get-IPrangeStartEnd.ps1](https://gallery.technet.microsoft.com/scriptcenter/Start-and-End-IP-addresses-bcccc3a9) like this
8684
```powershell
8785
PS C:\> Get-IPrangeStartEnd -ip 52.229.17.93 -cidr 26
8886
start end
8987
----- ---
9088
52.229.17.64 52.229.17.127
9189
```
9290

91+
Do the following additional steps to convert all the IP addresses from CIDR to Start and End IP address format.
92+
93+
```powershell
94+
PS C:\>foreach( $i in $sql.Properties.AddressPrefixes) {$ip,$cidr= $i.split('/') ; Get-IPrangeStartEnd -ip $ip -cidr $cidr;}
95+
start end
96+
----- ---
97+
13.86.216.0 13.86.216.127
98+
13.86.216.128 13.86.216.191
99+
13.86.216.192 13.86.216.223
100+
```
101+
You can now add these as distinct firewall rules and then set **Allow Azure services to access server** to OFF.
102+
103+
93104
## IP firewall rules
94105
Ip based firewall is a feature of Azure SQL Server that prevents all access to your database server until you explicitly [add IP addresses](sql-database-server-level-firewall-rule.md) of the client machines.
95106

0 commit comments

Comments
 (0)