/// <summary>
        /// This method demonstrates how to create monitoring account for those with permissions.
        /// </summary>
        public static void CreateMonitoringAccount()
        {
            var connectionInfo = new ConnectionInfo(MdmEnvironment.Int);

            var manager = new MonitoringAccountConfigurationManager(connectionInfo);

            var newAccountToCreate = "NewAccount";

            Console.WriteLine($"Create a new monitoring account '{newAccountToCreate}' from scratch...");

            var permissions       = new IPermissionV2[] { new UserPermissionV2("my-alias", RoleConfiguration.Administrator) };
            var monitoringAccount = new MonitoringAccount(newAccountToCreate, "test account creation", permissions);

            try
            {
                manager.CreateAsync(monitoringAccount, "int2.metrics.nsatc.net").Wait();
                Console.WriteLine($"{newAccountToCreate} is successfully created.");
            }
            catch (AggregateException e)
            {
                var inner = e.InnerException as ConfigurationValidationException;
                if (inner?.Message?.IndexOf($"{newAccountToCreate} is already in use", StringComparison.Ordinal) >= 0)
                {
                    Console.WriteLine($"{newAccountToCreate} is already in use.");
                }
                else
                {
                    throw;
                }
            }

            newAccountToCreate = "NewAccount2";
            var monitoringAccountToCopyFrom = "NewAccount";

            Console.WriteLine($"Create a new monitoring account named '{newAccountToCreate}' by copying the common settings from '{monitoringAccountToCopyFrom}'...");

            try
            {
                manager.CreateAsync(newAccountToCreate, monitoringAccountToCopyFrom, "int2.metrics.nsatc.net").Wait();
                Console.WriteLine($"{newAccountToCreate} is successfully created.");
            }
            catch (AggregateException e)
            {
                var inner = e.InnerException as ConfigurationValidationException;
                if (inner?.Message?.IndexOf($"{newAccountToCreate} is already in use", StringComparison.Ordinal) >= 0)
                {
                    Console.WriteLine($"{newAccountToCreate} is already in use.");
                }
                else
                {
                    throw;
                }
            }
        }
        /// <summary>
        /// This method demonstrates how this api can be used to get monitoring account and metric configuration information.
        /// These objects can be modified and saved as well, which is not demonstrated here due to permissions.
        /// </summary>
        public static void GetConfigurations()
        {
            // Replace 31280E2F2D2220808315C212DF8062A295B28325 with your cert thumbprint,
            // install it to the "Personal\Certificates" folder in the "Local Computer" certificate store,
            // and grant the permission of reading the private key to the service/application using the MDM consumption APIs.
            string testCertificateThumbprint = "31280E2F2D2220808315C212DF8062A295B28325";

            var connectionInfo = new ConnectionInfo(testCertificateThumbprint, StoreLocation.LocalMachine, MdmEnvironment.Int);

            var manager = new MonitoringAccountConfigurationManager(connectionInfo);

            var account = manager.GetAsync("MetricTeamInternalMetrics").Result;

            Console.WriteLine("------- ACCOUNT INFORMATION -------");
            Console.WriteLine("Users: {0}", string.Join(", ", account.Permissions.Where(x => x is UserPermission).Select(x => x.Identity)));
            Console.WriteLine("SecurityGroups: {0}", string.Join(", ", account.Permissions.Where(x => x is SecurityGroup).Select(x => x.Identity)));
            Console.WriteLine("Certificates: {0}", string.Join(", ", account.Permissions.Where(x => x is Certificate).Select(x => x.Identity)));

            var metricConfigurationManager = new MetricConfigurationManager(connectionInfo);

            var metric    = metricConfigurationManager.GetAsync(account, "metrics.server", "clientPostCount").Result;
            var rawMetric = (RawMetricConfiguration)metric;

            Console.WriteLine("\n------- RAW METRIC INFORMATION -------");
            Console.WriteLine("Dimensions: {0}", string.Join(",", rawMetric.Dimensions));
            Console.WriteLine("Preaggregates: {0}", string.Join(",", rawMetric.Preaggregations.Select(x => x.Name)));

            metric = metricConfigurationManager.GetAsync(account, "metrics.server", "AccountThrottlingWatchdog").Result;
            var compositeMetric = (CompositeMetricConfiguration)metric;

            Console.WriteLine("\n------- COMPOSITE METRIC INFORMATION -------");

            Console.WriteLine("CompositeExpressions: {0}", string.Join(",", compositeMetric.CompositeExpressions.Select(x => x.Expression)));
            Console.WriteLine(
                "FirstMetricSource: {0} - {1} - {2}",
                compositeMetric.MetricSources.First().MonitoringAccount,
                compositeMetric.MetricSources.First().MetricNamespace,
                compositeMetric.MetricSources.First().Metric);

            var metricsServerMetrics = metricConfigurationManager.GetMultipleAsync(account, "Metrics.Server").Result;

            Console.WriteLine("\n------- MULTIPLE METRIC INFORMATION -------");
            Console.WriteLine("Name of all metrics under Metrics.Server namespace: {0}", string.Join("\n", metricsServerMetrics.Select(x => x.Name)));

            Console.WriteLine("\n############################ END OF GetConfigurations ##############################");
        }