s

microsoft azure sql database allow ip addresses edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 17 September 2020 | 2755

Exception

Exception Cannot open server 'servername' requested by the login. Client with IP address '104.41.XXX.XXX' is not allowed to access the server.  To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.  It may take up to five minutes for this change to take effect.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot open server 'servername' requested by the login. Client with IP address '104.41.xxx.xxx' is not allowed to access the server.  To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range.  It may take up to five minutes for this change to take effect.

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Solution

solution is to add ip address to sql server firewall

  1. open the Azure portal.
  2. open SQL server
  3. scroll down and select "Firewall and virtual networks" under Security
  4. add any name for rule name followed by Start IP & End IP (starting ip and ending ip can be the same if you want to allow only one IP), you can specify a range also
  5. click on save

If you want to allow all ips give any name followed by starting IP 0.0.0.0 and end Ip 255.255.255.255