Ejemplo n.º 1
0
        protected override void ProcessRecord()
        {
            WriteWarning("Please note that this commandlet has been deprecated. Use Azure Resource Manager PowerShell commandlets instead. See more at https://azure.microsoft.com/en-us/documentation/articles/machine-learning-deploy-with-resource-manager-template/");
            ProgressRecord pr = new ProgressRecord(1, "Create Workspace", WorkspaceName);

            pr.PercentComplete  = 1;
            pr.CurrentOperation = "Creating...";
            WriteProgress(pr);
            Task <string> createWS = Sdk.CreateWorkspace(ManagementCertThumbprint, AzureSubscriptionId, WorkspaceName, Location, StorageAccountName, StorageAccountKey, OwnerEmail, "PowerShell");

            while (!createWS.IsCompleted)
            {
                if (pr.PercentComplete < 100)
                {
                    pr.PercentComplete++;
                }
                else
                {
                    pr.PercentComplete = 1;
                }
                WriteProgress(pr);
                Thread.Sleep(500);
            }
            pr.StatusDescription = string.Format("Getting status for Workspace\"{0}\"", WorkspaceName);
            pr.CurrentOperation  = "Getting status...";
            WriteProgress(pr);
            string        wsId = createWS.Result;
            WorkspaceRdfe ws   = Sdk.GetCreateWorkspaceStatus(ManagementCertThumbprint, AzureSubscriptionId, wsId, Location);

            pr.CurrentOperation = "Status: " + ws.WorkspaceState;
            WriteProgress(pr);
            while (ws.WorkspaceState != "Enabled")
            {
                pr.CurrentOperation = "Status: " + ws.WorkspaceState;
                WriteProgress(pr);
                if (pr.PercentComplete < 100)
                {
                    pr.PercentComplete++;
                }
                else
                {
                    pr.PercentComplete = 1;
                }
                Thread.Sleep(500);
                ws = Sdk.GetCreateWorkspaceStatus(ManagementCertThumbprint, AzureSubscriptionId, wsId, Location);
            }
            pr.PercentComplete = 100;
            WriteProgress(pr);

            WriteObject(ws);
        }
Ejemplo n.º 2
0
        protected override void ProcessRecord()
        {
            ProgressRecord pr = new ProgressRecord(1, "Create Workspace", WorkspaceName);

            pr.PercentComplete  = 1;
            pr.CurrentOperation = "Creating...";
            WriteProgress(pr);
            Task <string> createWS = Sdk.CreateWorkspace(ManagementCertThumbprint, AzureSubscriptionId, WorkspaceName, Location, StorageAccountName, StorageAccountKey, OwnerEmail, "PowerShell");

            while (!createWS.IsCompleted)
            {
                if (pr.PercentComplete < 100)
                {
                    pr.PercentComplete++;
                }
                else
                {
                    pr.PercentComplete = 1;
                }
                WriteProgress(pr);
                Thread.Sleep(500);
            }
            pr.StatusDescription = string.Format("Getting status for Workspace\"{0}\"", WorkspaceName);
            pr.CurrentOperation  = "Getting status...";
            WriteProgress(pr);
            string        wsId = createWS.Result;
            WorkspaceRdfe ws   = Sdk.GetCreateWorkspaceStatus(ManagementCertThumbprint, AzureSubscriptionId, wsId, Location);

            pr.CurrentOperation = "Status: " + ws.WorkspaceState;
            WriteProgress(pr);
            while (ws.WorkspaceState != "Enabled")
            {
                pr.CurrentOperation = "Status: " + ws.WorkspaceState;
                WriteProgress(pr);
                if (pr.PercentComplete < 100)
                {
                    pr.PercentComplete++;
                }
                else
                {
                    pr.PercentComplete = 1;
                }
                Thread.Sleep(500);
                ws = Sdk.GetCreateWorkspaceStatus(ManagementCertThumbprint, AzureSubscriptionId, wsId, Location);
            }
            pr.PercentComplete = 100;
            WriteProgress(pr);

            WriteObject(ws);
        }