title: Azure database connection error.
body: <p>Hello Friends, </p>
  
  <p>I'm new to Azure. and still learning all internal things. I'm trying to connect a DB and getting below exception. Any pointers will be very appreciated? </p>
  
  <p>I wonder if anyone has ever experienced this or what would be the reason?
  Connecting to DB:</p>
  
  <pre><code> System.Data.SqlClient.SqlException was unhandled by user code
        HResult=-2146232060
        Message=Cannot open server 'XXXX' requested by the login. Client with IP address 'XX.XX.XX.XX' 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.
      Login failed for user 'User'.
      This session has been assigned a tracing ID of 'bf7474de-2a5a-4ce2-a8fb-7d3cc57a473b'.  Provide this tracing ID to customer support when you need assistance.
        Source=.Net SqlClient Data Provider
        ErrorCode=-2146232060
        Class=16
        LineNumber=65536
        Number=40615
        Procedure=""
        Server=&lt;SERVER NAME&gt;
        State=1
  </code></pre>
  
  <p><strong>Connecting to DB:</strong>
   <strong>StackTrace:</strong></p>
  
  <pre><code>  at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection)
             at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection)
             at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection)
             at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
             at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
             at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
             at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
             at System.Data.SqlClient.SqlConnection.Open()
             at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.&lt;Open&gt;b__38(DbConnection t, DbConnectionInterceptionContext c)
             at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
             at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
  </code></pre>