public bool AddAccount(string accountName, string clientid, string clientsecretkey, string tenantid, string subscriptionid)
        {
            try
            {
                AzureProfile azure = new AzureProfile();
                azure.ClientId        = clientid;
                azure.ClientSecretKey = clientsecretkey;
                azure.TenantId        = tenantid;
                azure.SubscriptionId  = subscriptionid;
                var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(clientid, clientsecretkey, tenantid, AzureEnvironment.AzureGlobalCloud);
                var response    = Azure.Authenticate(credentials).WithSubscription(subscriptionid);
                if (response.ResourceGroups.List().Count() > 0)
                {
                    if (SqlHelper.AddNewAccount("Azure", accountName) && SqlHelper.AddAzureAccountDetails(azure, accountName))
                    {
                        return(true);
                    }

                    return(false);
                }

                return(false);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
        public bool AddAccount(string accountName, string profilename, string accesskey, string secretkey)
        {
            try
            {
                AWSProfile profile = new AWSProfile();
                profile.ProfileName = profilename;
                profile.Accesskey   = accesskey;
                profile.Secretkey   = secretkey;
                var    regions = Amazon.RegionEndpoint.EnumerableAllRegions;
                string region_ = "";
                int    count   = 0;
                foreach (var r in regions)
                {
                    if (count == 0)
                    {
                        region_ = r.SystemName;
                    }

                    count++;
                }
                var                       region   = RegionEndpoint.GetBySystemName(region_);
                AmazonEC2Client           client   = new AmazonEC2Client(accesskey, secretkey, region);
                DescribeInstancesRequest  request  = new DescribeInstancesRequest();
                DescribeInstancesResponse response = client.DescribeInstances(request);
                if (response.HttpStatusCode.ToString() == "OK" && SqlHelper.AddNewAccount("AWS", accountName) && SqlHelper.AddAWSAccountDetails(profile, accountName))
                {
                    return(true);
                }

                return(false);
            }
            catch (Exception e)
            {
                this.log.Error(e);
                return(false);
            }
        }