/// <summary>
        /// Adds IP addresses to the WASD firewall for a
        /// </summary>
        public void AddIpsToSqlFirewallFromCloudService(string cloudServiceName, bool removeAllOtherRules = true, DeploymentSlot slot = DeploymentSlot.Production)
        {
            if (ServerName == null)
            {
                throw new FluentManagementException("unable to continue without windows azure sql database server name", "SqlDatabaseClient");
            }

            if (removeAllOtherRules)
            {
                // get these rules
                var command = new ListFirewallRulesCommand(ServerName)
                {
                    SubscriptionId = _subscriptionId,
                    Certificate    = _managementCertificate
                };
                command.Execute();
                foreach (var rule in command.FirewallRules)
                {
                    var ruleCommand = new DeleteSqlFirewallRuleCommand(ServerName, rule.RuleName)
                    {
                        SubscriptionId = _subscriptionId,
                        Certificate    = _managementCertificate
                    };
                    ruleCommand.Execute();
                }
            }

            var inputs = new LinqToAzureInputs()
            {
                ManagementCertificateThumbprint = _managementCertificate.Thumbprint,
                SubscriptionId = _subscriptionId
            };
            // build up a filtered query to check the new account
            var cloudServiceQueryable = new LinqToAzureOrderedQueryable <CloudService>(inputs);
            // get only production deployments
            var query = from service in cloudServiceQueryable
                        where service.Deployments.Count != 0 &&
                        service.Deployments.Any(a => a.Slot == slot)
                        select service;
            var cloudService = query.First();
            // enumerate the cloud service deployment and add the ips to the database firewall
            var addRuleCommand = new AddNewFirewallRuleCommand(cloudServiceName,
                                                               cloudService.Deployments.First().RoleInstances.First().VirtualIpAddress,
                                                               cloudService.Deployments.First().RoleInstances.First().VirtualIpAddress)
            {
                SubscriptionId = _subscriptionId,
                Certificate    = _managementCertificate
            };

            addRuleCommand.ConfigureFirewallCommand(ServerName);
            addRuleCommand.Execute();
        }
        /// <summary>
        /// Adds IP addresses to the WASD firewall for a 
        /// </summary>
        public void AddIpsToSqlFirewallFromCloudService(string cloudServiceName, bool removeAllOtherRules = true, DeploymentSlot slot = DeploymentSlot.Production)
        {
            if(ServerName == null)
                throw new FluentManagementException("unable to continue without windows azure sql database server name", "SqlDatabaseClient");

            if (removeAllOtherRules)
            {
                // get these rules
                var command = new ListFirewallRulesCommand(ServerName)
                    {
                        SubscriptionId = _subscriptionId,
                        Certificate = _managementCertificate
                    };
                command.Execute();
                foreach (var rule in command.FirewallRules)
                {
                    var ruleCommand = new DeleteSqlFirewallRuleCommand(ServerName, rule.RuleName)
                        {
                            SubscriptionId = _subscriptionId,
                            Certificate = _managementCertificate
                        };
                    ruleCommand.Execute();
                }
            }

            var inputs = new LinqToAzureInputs()
            {
                ManagementCertificateThumbprint = _managementCertificate.Thumbprint,
                SubscriptionId = _subscriptionId
            };
            // build up a filtered query to check the new account
            var cloudServiceQueryable = new LinqToAzureOrderedQueryable<CloudService>(inputs);
            // get only production deployments
            var query = from service in cloudServiceQueryable
                        where service.Deployments.Count != 0
                        && service.Deployments.Any(a => a.Slot == slot)
                        select service;
            var cloudService = query.First();
            // enumerate the cloud service deployment and add the ips to the database firewall
            var addRuleCommand = new AddNewFirewallRuleCommand(cloudServiceName,
                                                               cloudService.Deployments.First().RoleInstances.First().VirtualIpAddress,
                                                               cloudService.Deployments.First().RoleInstances.First().VirtualIpAddress)
                {
                    SubscriptionId = _subscriptionId,
                    Certificate = _managementCertificate
                };
            addRuleCommand.ConfigureFirewallCommand(ServerName);
            addRuleCommand.Execute();
        }