예제 #1
0
        public async Task DeployAzureMLWorkspaceTest()
        {
            var dataStore = await AAD.GetTokenWithDataStore();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", dataStore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody   = JObject.FromObject(result.Body);
            var subscriptionId = responseBody.GetJObject()["value"][0];

            dataStore.AddToDataStore("SelectedResourceGroup", "UnitTest");
            dataStore.AddToDataStore("SelectedSubscription", subscriptionId);
            dataStore.AddToDataStore("WorkspaceName", "testazuremlworkspace");
            dataStore.AddToDataStore("StorageAccountName", "testazuremlstorage" + RandomGenerator.GetRandomLowerCaseCharacters(5));
            dataStore.AddToDataStore("DeploymentName", "MLWorkspaceDeployment");
            dataStore.AddToDataStore("PlanName", "testazuremlplan");
            dataStore.AddToDataStore("SkuName", "S1");
            dataStore.AddToDataStore("SkuTier", "Standard");
            dataStore.AddToDataStore("SkuCapacity", "1");

            var response = TestHarness.ExecuteAction("Microsoft-DeployAzureMLWorkspace", dataStore);

            Assert.IsTrue(response.Status == ActionStatus.Success);
            response = TestHarness.ExecuteAction("Microsoft-WaitForArmDeploymentStatus", dataStore);
            Assert.IsTrue(response.Status == ActionStatus.Success);
        }
        public async Task CreateConnectionToLogicApp()
        {
            var dataStore = await AAD.GetTokenWithDataStore();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", dataStore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody   = JObject.FromObject(result.Body);
            var subscriptionId = responseBody["value"][0];

            dataStore.AddToDataStore("SelectedSubscription", subscriptionId, DataStoreType.Private);
            dataStore.AddToDataStore("SelectedResourceGroup", "testing");

            var locationResult = await TestHarness.ExecuteActionAsync("Microsoft-GetLocations", dataStore);

            Assert.IsTrue(locationResult.IsSuccess);
            var location = locationResult.Body.GetJObject()["value"][5];

            dataStore.AddToDataStore("SelectedLocation", location, DataStoreType.Public);

            var response = TestHarness.ExecuteAction("Microsoft-CreateResourceGroup", dataStore);

            string[] connectors = new string[5] {
                "bingnews", "azureml", "azureblob", "sql", "cognitiveservicetextanalytics"
            };


            foreach (string connector in connectors)
            {
                dataStore.AddToDataStore("ConnectorName", connector);
                response = TestHarness.ExecuteAction("Microsoft-CreateConnectorToLogicApp", dataStore);
                Assert.IsTrue(response.Status == ActionStatus.Success);
            }
        }
예제 #3
0
        public async Task DeleteResourceGroups()
        {
            DataStore dataStore = await AAD.GetUserTokenFromPopup();

            CloudCredentials creds = new TokenCloudCredentials(dataStore.GetJson("AzureToken")["access_token"].ToString());

            Microsoft.Azure.Subscriptions.SubscriptionClient clientSubscription = new SubscriptionClient(creds);
            var         subscriptionList = (await clientSubscription.Subscriptions.ListAsync(new CancellationToken())).Subscriptions.ToList();
            List <Task> tasksToExecute   = new List <Task>();

            foreach (var subscription in subscriptionList)
            {
                SubscriptionCloudCredentials creds2 = new TokenCloudCredentials(subscription.SubscriptionId, dataStore.GetJson("AzureToken")["access_token"].ToString());
                Microsoft.Azure.Management.Resources.ResourceManagementClient client = new ResourceManagementClient(creds2);
                string subId          = subscription.SubscriptionId;
                var    resourceGroups = await client.ResourceGroups.ListAsync(new ResourceGroupListParameters());

                var resourceGroupsToDelete = resourceGroups.ResourceGroups.Where(p => p.Name.ToLower().StartsWith("solution"));
                foreach (var rg in resourceGroupsToDelete)
                {
                    tasksToExecute.Add(client.ResourceGroups.DeleteAsync(rg.Name, new CancellationToken()));
                }

                resourceGroupsToDelete = resourceGroups.ResourceGroups.Where(p => p.Name.ToLower().StartsWith("unit"));
                foreach (var rg in resourceGroupsToDelete)
                {
                    tasksToExecute.Add(client.ResourceGroups.DeleteAsync(rg.Name, new CancellationToken()));
                }
            }

            await Task.WhenAll(tasksToExecute);
        }
예제 #4
0
        public async Task GetAzureEmail()
        {
            DataStore dataStore = new DataStore();
            var       datastore = await AAD.GetUserTokenFromPopup();

            var emailAddress = AzureUtility.GetEmailFromToken(datastore.GetJson("AzureToken"));
        }
        public async Task DeployArmTemplateTest()
        {
            var datastore = await AAD.GetTokenWithDataStore();

            var subscriptionResult = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", datastore);

            Assert.IsTrue(subscriptionResult.IsSuccess);
            var subscriptionId = subscriptionResult.Body.GetJObject()["value"][0];

            datastore.AddToDataStore("SelectedSubscription", subscriptionId, DataStoreType.Public);

            var locationResult = await TestHarness.ExecuteActionAsync("Microsoft-GetLocations", datastore);

            Assert.IsTrue(locationResult.IsSuccess);
            var location = locationResult.Body.GetJObject()["value"][5];

            datastore.AddToDataStore("SelectedLocation", location, DataStoreType.Public);


            datastore.AddToDataStore("SelectedResourceGroup", "Test");
            var deleteResourceGroupResult = await TestHarness.ExecuteActionAsync("Microsoft-DeleteResourceGroup", datastore);

            var resourceGroupResult = await TestHarness.ExecuteActionAsync("Microsoft-CreateResourceGroup", datastore);

            Assert.IsTrue(resourceGroupResult.IsSuccess);

            datastore.AddToDataStore("AzureArmFile", "Service/Arm/armtemplate.json");
            var paramFile = JsonUtility.GetJsonObjectFromJsonString(System.IO.File.ReadAllText(@"Apps/TestApps/TestApp/Service/Arm/armparam.json"));

            paramFile["AzureArmParameters"]["SqlServerName"] = "sqltestserver" + RandomGenerator.GetRandomLowerCaseCharacters(10);
            datastore.AddToDataStore("AzureArmParameters", paramFile["AzureArmParameters"]);
            var armResult = await TestHarness.ExecuteActionAsync("Microsoft-DeployAzureArmTemplate", datastore);

            Assert.IsTrue(armResult.IsSuccess);
        }
예제 #6
0
        public async Task DeployCognitiveServiceTextTest()
        {
            var dataStore = await AAD.GetTokenWithDataStore();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", dataStore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody   = JObject.FromObject(result.Body);
            var subscriptionId = responseBody["value"][0]["SubscriptionId"].ToString();

            dataStore.AddToDataStore("SubscriptionId", subscriptionId, DataStoreType.Private);
            dataStore.AddToDataStore("SelectedResourceGroup", "testing");
            dataStore.AddToDataStore("CognitiveServiceName", "TestCognitiveService");
            dataStore.AddToDataStore("SkuName", "F0");

            var response = TestHarness.ExecuteAction("Microsoft-CreateResourceGroup", dataStore);

            response = TestHarness.ExecuteAction("Microsoft-DeployCognitiveServiceText", dataStore);
            Assert.IsTrue(response.Status == ActionStatus.Success);
            response = TestHarness.ExecuteAction("Microsoft-WaitForArmDeploymentStatus", dataStore);
            Assert.IsTrue(response.Status == ActionStatus.Success);

            if (response.Status == ActionStatus.Success)
            {
                response = TestHarness.ExecuteAction("Microsoft-DeleteResourceGroup", dataStore);
                Assert.IsTrue(response.Status == ActionStatus.Success);
            }
        }
        public async Task GetAzureToken()
        {
            DataStore dataStore = new DataStore();

            var datastore = await AAD.GetTokenWithDataStore();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", datastore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody = JObject.FromObject(result.Body);
        }
예제 #8
0
        public async Task CreateEnvironment()
        {
            //Create Environment
            var dataStore = await AAD.GetUserTokenFromPopup();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", dataStore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody = JObject.FromObject(result.Body);

            dataStore.AddToDataStore("Location", "unitedstates", DataStoreType.Private);
            dataStore.AddToDataStore("EnvironmentName", "TestEnvironment", DataStoreType.Private);
            var environmentResponse = TestHarness.ExecuteAction("Microsoft-CreateEnvironment", dataStore);

            Assert.IsTrue(environmentResponse.Status == ActionStatus.Success);
        }
예제 #9
0
        public async Task CreateCDMEntity()
        {
            var dataStore = await AAD.GetUserTokenFromPopup();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", dataStore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody = JObject.FromObject(result.Body);

            dataStore.AddToDataStore("EnvironmentID", "Legacy-1806a3cb-4a99-4491-aa5f-ac186fd73f10", DataStoreType.Private);
            dataStore.AddToDataStore("EntityName", "TestEntity20", DataStoreType.Private);

            var CreateCDMEntity = TestHarness.ExecuteAction("Microsoft-CreateCDMEntity", dataStore);

            Assert.IsTrue(CreateCDMEntity.Status == ActionStatus.Success);
        }
        public async Task GetCognitiveServiceKeys()
        {
            var dataStore = await AAD.GetTokenWithDataStore();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", dataStore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody   = JObject.FromObject(result.Body);
            var subscriptionId = responseBody["value"][0];

            dataStore.AddToDataStore("Azure", "SelectedResourceGroup", "testing");
            dataStore.AddToDataStore("CognitiveService", "CognitiveServiceName", "TestCognitiveService2");

            var response = TestHarness.ExecuteAction("Microsoft-GetCognitiveKey", dataStore);

            Assert.IsTrue(response.Status == ActionStatus.Success);
        }
예제 #11
0
        public async Task CheckCDMEntities()
        {
            //Get Token
            var dataStore = await AAD.GetUserTokenFromPopup();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", dataStore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody = JObject.FromObject(result.Body);

            dataStore.AddToDataStore("EnvironmentID", "Legacy-1806a3cb-4a99-4491-aa5f-ac186fd73f10", DataStoreType.Private);
            //dataStore.AddToDataStore("ObjectID", "63439178-643b-4b6d-92ed-db2e1f2f5b14", DataStoreType.Private);
            dataStore.AddToDataStore("EntityName", "TestEntity", DataStoreType.Private);

            var getCDMEntityResponse = TestHarness.ExecuteAction("Microsoft-CheckCDMEntities", dataStore);

            Assert.IsTrue(getCDMEntityResponse.Status == ActionStatus.Success);
        }
        public async Task DeployCognitiveServiceTest()
        {
            var dataStore = await AAD.GetTokenWithDataStore();

            var result = await TestHarness.ExecuteActionAsync("Microsoft-GetAzureSubscriptions", dataStore);

            Assert.IsTrue(result.IsSuccess);
            var responseBody   = JObject.FromObject(result.Body);
            var subscriptionId = responseBody["value"][0];

            dataStore.AddToDataStore("DeploymentName", "CongitiveServiceDeploy", DataStoreType.Private);
            dataStore.AddToDataStore("SelectedSubscription", subscriptionId, DataStoreType.Private);
            dataStore.AddToDataStore("SelectedResourceGroup", "testing");
            dataStore.AddToDataStore("CognitiveServiceName", "TestCognitiveService2");
            //dataStore.AddToDataStore("CognitiveServiceType", "TextAnalytics");
            dataStore.AddToDataStore("CognitiveServiceType", "Bing.Search");

            dataStore.AddToDataStore("CognitiveSkuName", "S1");
            var locationResult = await TestHarness.ExecuteActionAsync("Microsoft-GetLocations", dataStore);

            Assert.IsTrue(locationResult.IsSuccess);
            var location = locationResult.Body.GetJObject()["value"][5];

            dataStore.AddToDataStore("SelectedLocation", location, DataStoreType.Public);

            var response = TestHarness.ExecuteAction("Microsoft-CreateResourceGroup", dataStore);

            response = TestHarness.ExecuteAction("Microsoft-DeployCognitiveService", dataStore);
            Assert.IsTrue(response.Status == ActionStatus.Success);

            //if (response.Status == ActionStatus.Success)
            //{
            //    response = TestHarness.ExecuteAction("Microsoft-DeleteResourceGroup", dataStore);
            //    Assert.IsTrue(response.Status == ActionStatus.Success);
            //}
        }
예제 #13
0
        public async Task ValidatePBIPublish()
        {
            DataStore ds = await AAD.GetUserTokenFromPopup("powerbi");

            Assert.IsTrue(await TestManager.IsSuccessAsync("Microsoft-GetPBIClusterUri", ds));
        }
예제 #14
0
        public async Task GetAllEnvironments()
        {
            var dataStore = await AAD.GetUserTokenFromPopup();

            var environIdResponse = TestHarness.ExecuteAction("Microsoft-GetAllEnvironments", dataStore);
        }