public void AzureClientCertificateLocalFile()
        {
            TestUtilities        utils  = DefaultUtilities();
            ConfigurationOptions config = utils.ConfigurationOptions;

            utils.ConfigurationOptions.Validate();
            DeleteTokenCache();

            ProcessOutput results = utils.ExecuteTest((config) =>
            {
                AzureResourceManager arm = new AzureResourceManager(config);
                string certFile          = $"{TestUtilities.TempDir}\\{config.AzureClientSecret}.pfx";
                new CertificateUtilities().SaveCertificateToFile(_appCertificate, certFile);

                //config.AzureClientId = "";
                config.AzureClientCertificate = certFile;
                config.AzureKeyVault          = "";
                config.AzureClientSecret      = "";
                Assert.IsTrue(config.IsClientIdConfigured(), "test configuration invalid");
                return(config.ValidateAad());
            }, utils.Collector.Config);

            Assert.IsTrue(results.ExitBool);
            Assert.IsTrue(!results.HasErrors(), results.ToString());
        }
        public void AzureClientCertificateKeyVaultAppRegistration()
        {
            TestUtilities        utils  = DefaultUtilities();
            ConfigurationOptions config = utils.ConfigurationOptions;

            utils.ConfigurationOptions.Validate();
            DeleteTokenCache();

            ProcessOutput results = utils.ExecuteTest((config) =>
            {
                config.AzureClientCertificate = "";
                Assert.IsTrue(config.IsClientIdConfigured(), "test configuration invalid");
                return(config.ValidateAad());
            }, utils.Collector.Config);

            Assert.IsTrue(results.ExitBool);
            Assert.IsTrue(!results.HasErrors(), results.ToString());
        }
        public void AzureClientCertificateKeyVaultUserManagedIdentity()
        {
            TestUtilities        utils  = DefaultUtilities();
            ConfigurationOptions config = utils.ConfigurationOptions;

            utils.ConfigurationOptions.Validate();
            DeleteTokenCache();

            ProcessOutput results = utils.ExecuteTest((config) =>
            {
                //config.AzureClientId = "";
                Assert.IsTrue(config.IsClientIdConfigured(), "test configuration invalid");
                AzureResourceManager arm = new AzureResourceManager(config);

                Assert.IsTrue(arm.ClientIdentity.IsUserManagedIdentity, "arm.IsUserManagedIdentity not detected. test from azure vm with user managed identity enabled.");
                return(config.ValidateAad());
            }, utils.Collector.Config);

            Assert.IsTrue(results.ExitBool);
            Assert.IsTrue(!results.HasErrors(), results.ToString());
        }
        public void AzureClientCertificateX509withPassword()
        {
            TestUtilities        utils  = DefaultUtilities();
            ConfigurationOptions config = utils.ConfigurationOptions;

            utils.ConfigurationOptions.Validate();
            DeleteTokenCache();

            ProcessOutput results = utils.ExecuteTest((config) =>
            {
                CertificateUtilities certificateUtilities = new CertificateUtilities();
                certificateUtilities.SetSecurePassword(TestUtilities.TestProperties.testAdminPassword);

                config.ClientCertificate = certificateUtilities.GetClientCertificate(TestUtilities.TestProperties.AzureClientCertificate);// _appCertificate;
                config.AzureKeyVault     = "";
                Assert.IsTrue(config.IsClientIdConfigured(), "test configuration invalid");
                return(config.ValidateAad());
            }, utils.Collector.Config);

            Assert.IsTrue(results.ExitBool);
            Assert.IsTrue(!results.HasErrors(), results.ToString());
        }