2015-07-29 5 views
5

में एसक्यूएल एज़ूर के लिए आंतरिक एज़ूर सेवाओं को कैसे सक्षम करें I कैसे सक्षम सेवाओं को सक्षम कर सकते हैं: विंडोज़ एज़ूर सर्विसेज जैसा कि सी # में प्रबंधन पोर्टल में देखा गया है?सी #

 _client = new SqlManagementClient(GetSubscriptionCredentials()); 

     var result = _client.Servers.CreateAsync(new ServerCreateParameters 
     { 
      AdministratorUserName = _config.ServerUserName, 
      AdministratorPassword = _config.ServerPassword, 
      Location = _config.Location, 
      Version = "12.0" 
     }, CancellationToken.None).Result; 

     var sqlServerName = result.ServerName; 

     // This will go away once we can enable the Azure internal firewall settings == Yes 
     var ipAddress = _firewallManagement.GetPublicIP(); 
     var firewall = _client.FirewallRules.Create(sqlServerName, new FirewallRuleCreateParameters("Server", ipAddress, ipAddress)); 

enter image description here

उत्तर

5

बस sys.firewall_rules

लिए नीचे दिए गए start_ip_address और T-SQL की तरह end_ip_address के रूप में 0.0.0.0 जोड़ने
exec sp_set_firewall_rule N'MicrosoftServices','0.0.0.0','0.0.0.0' 

0.0.0.0 रेंज, एसक्यूएल Azure कोई आपत्ति नहीं है जानता है कि यह केवल आपकी सदस्यता में Azure आईपी के लिए है।

select * from sys.firewall_rules 

id name start_ip_address end_ip_address create_date modify_date 
7 MicrosoftService 0.0.0.0 0.0.0.0 2015-07-29 13:34:55.790 2015-07-29 13:34:55.790 

Azure एसक्यूएल डाटाबेस फ़ायरवॉल

जब Azure से एक आवेदन पत्र अपने डेटाबेस सर्वर से कनेक्ट करने का प्रयास करता है, फ़ायरवॉल पुष्टि करता है कि Azure कनेक्शन की अनुमति है। 0.00.0 के बराबर प्रारंभ और समापन पते के साथ फ़ायरवॉल सेटिंग इंगित करता है कि इन कनेक्शनों की अनुमति है।

https://msdn.microsoft.com/en-us/library/azure/ee621782.aspx#ConnectingFromAzure

जोड़ना और हटाया जा रहा है एसक्यूएल Azure फ़ायरवॉल नियमों को प्रोग्राम के

http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/adding-and-deleting-sql-azure-firewall-rules-programmatically/

public void AddFirewallRule(FirewallRule rule) 
     { 
      using (SqlConnection conn = new SqlConnection(this.ConnectionString)) 
      using (SqlCommand cmd = conn.CreateCommand()) 
      { 
       conn.Open(); 
       cmd.CommandText = "sp_set_firewall_rule"; 
       cmd.CommandType = CommandType.StoredProcedure; 
       cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = rule.Name; 
       cmd.Parameters.Add("@start_ip_address", SqlDbType.VarChar).Value = rule.startIPAddress.ToString(); 
       cmd.Parameters.Add("@end_ip_address", SqlDbType.VarChar).Value = rule.endIPAdress.ToString(); 
       cmd.ExecuteNonQuery(); 
      } 
     } 
+1

'वर करने का नवीनतम तरीका है azureFirewall = _clien t.FirewallRules.Create (sqlServerName, नया फ़ायरवॉलरूलेक्रेट पैरामीटर ("माइक्रोसॉफ्ट सर्विसेज", "0.0.0.0", "0.0.0.0")); ' –