/// <summary>
        /// Deletes a database and also deletes the server if the database is the last one
        /// </summary>
        public void DeleteDatabase(string name, bool deleteServerIfLastDatabase = true)
        {
            CheckLoginCredentials();
            // we need to add IP detect and add to the firewall first
            var firewallCommandWithIpDetect = new AddNewFirewallRuleWithIpDetectCommand("mobileser")
            {
                SubscriptionId = _subscriptionId,
                Certificate    = _managementCertificate
            };

            firewallCommandWithIpDetect.ConfigureFirewallCommand(ServerName);
            firewallCommandWithIpDetect.Execute();
            // get the connection to the server
            var connection = GetConnection("master");

            // drop the named database
            ExecuteCommand(connection, "DROP DATABASE " + name);
            // Gets the count of databases left on the server
            if (deleteServerIfLastDatabase && DatabaseCount == 1)
            {
                // delete the server
                var command = new DeleteSqlServerCommand(ServerName)
                {
                    SubscriptionId = _subscriptionId,
                    Certificate    = _managementCertificate
                };
                command.Execute();
            }
        }
 internal void DeleteSqlServer()
 {
     try
     {
         var command = new DeleteSqlServerCommand(_manager.SqlAzureServerName)
         {
             SubscriptionId = _manager.SubscriptionId,
             Certificate    = _manager.ManagementCertificate
         };
         command.Execute();
     }
     catch (Exception ex)
     {
         _manager.WriteComplete(EventPoint.SqlAzureServerCreated, ex.Message);
     }
 }
 internal void DeleteSqlServer()
 {
     try
     {
         var command = new DeleteSqlServerCommand(_manager.SqlAzureServerName)
                           {
                               SubscriptionId = _manager.SubscriptionId,
                               Certificate = _manager.ManagementCertificate
                           };
         command.Execute();
     }
     catch (Exception ex)
     {
         _manager.WriteComplete(EventPoint.SqlAzureServerCreated, ex.Message);
     }
 }
 /// <summary>
 /// Deletes a database and also deletes the server if the database is the last one 
 /// </summary>
 public void DeleteDatabase(string name, bool deleteServerIfLastDatabase = true)
 {
     CheckLoginCredentials();
     // we need to add IP detect and add to the firewall first
     var firewallCommandWithIpDetect = new AddNewFirewallRuleWithIpDetectCommand("mobileser")
         {
             SubscriptionId = _subscriptionId,
             Certificate = _managementCertificate
         };
     firewallCommandWithIpDetect.ConfigureFirewallCommand(ServerName);
     firewallCommandWithIpDetect.Execute();
     // get the connection to the server
     var connection = GetConnection("master");
     // drop the named database
     ExecuteCommand(connection, "DROP DATABASE " + name);
     // Gets the count of databases left on the server
     if (deleteServerIfLastDatabase && DatabaseCount == 1)
     {
         // delete the server
         var command = new DeleteSqlServerCommand(ServerName)
             {
                 SubscriptionId = _subscriptionId,
                 Certificate = _managementCertificate
             };
         command.Execute();
     }
 }