Microsoft.WindowsAzure.Management.ServiceManagement.Test.FunctionalTests.ServiceManagementCmdletTestHelper.GetAzureRemoteDesktopFile C# (CSharp) Method

GetAzureRemoteDesktopFile() public method

public GetAzureRemoteDesktopFile ( string vmName, string serviceName, string localPath, bool launch ) : void
vmName string
serviceName string
localPath string
launch bool
return void
        public void GetAzureRemoteDesktopFile(string vmName, string serviceName, string localPath, bool launch)
        {
            GetAzureRemoteDesktopFileCmdletInfo getAzureRemoteDesktopFileCmdletInfo = new GetAzureRemoteDesktopFileCmdletInfo(vmName, serviceName, localPath, launch);
            WindowsAzurePowershellCmdlet getAzureRemoteDesktopFileCmdlet = new WindowsAzurePowershellCmdlet(getAzureRemoteDesktopFileCmdletInfo);

            Collection<PSObject> result = getAzureRemoteDesktopFileCmdlet.Run();
        }

Usage Example

Exemplo n.º 1
0
        public void ManagingRDPSSHConnectivity()
        {
            ServiceManagementCmdletTestHelper vmPowershellCmdlets = new ServiceManagementCmdletTestHelper();
            vmPowershellCmdlets.ImportAzurePublishSettingsFile(); // Import-AzurePublishSettingsFile
            var defaultAzureSubscription = vmPowershellCmdlets.SetDefaultAzureSubscription(Resource.DefaultSubscriptionName); // Set-AzureSubscription
            Assert.AreEqual(Resource.DefaultSubscriptionName, defaultAzureSubscription.SubscriptionName);

            //
            string imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "MSFT", "testvmimage" }, false); // Get-AzureVMImage
            Console.WriteLine("Image Name: {0}", imageName);

            string locationName = vmPowershellCmdlets.GetAzureLocationName(new[] { Resource.Location }, false); // Get-AzureLocation
            Console.WriteLine("Location Name: {0}", locationName);

            // Create a unique VM name
            string newAzureQuickVMName = Utilities.GetUniqueShortName("PSTestVM");

            // Create a unique Service Name
            string newAzureQuickVMSvcName = Utilities.GetUniqueShortName("PSTestService");

            // Create a new Azure quick VM
            vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName, newAzureQuickVMSvcName, imageName, "p@ssw0rd", locationName); // New-AzureQuickVM
            Console.WriteLine("VM is created successfully: -Name {0} -ServiceName {1}", newAzureQuickVMName, newAzureQuickVMSvcName);

            // starting the test.

            PersistentVMRoleContext vmRoleCtxt = vmPowershellCmdlets.GetAzureVM(newAzureQuickVMName, newAzureQuickVMSvcName); // Get-AzureVM
            InputEndpointContext inputEndpointCtxt = vmPowershellCmdlets.GetAzureEndpoint(vmRoleCtxt); // Get-AzureEndpoint
            Console.WriteLine("InputEndpointContext Name: {0}", inputEndpointCtxt.Name);
            Console.WriteLine("InputEndpointContext port: {0}", inputEndpointCtxt.Port);
            Console.WriteLine("InputEndpointContext protocol: {0}", inputEndpointCtxt.Protocol);
            Assert.AreEqual(inputEndpointCtxt.Name, "RemoteDesktop", true);

            string path = "C:\\temp\\myvmconnection.rdp";
            vmPowershellCmdlets.GetAzureRemoteDesktopFile(newAzureQuickVMName, newAzureQuickVMSvcName, path, false); // Get-AzureRemoteDesktopFile
            Console.WriteLine("RDP file is successfully created at: {0}", path);

            // ToDo: Automate RDP.
            //vmPowershellCmdlets.GetAzureRemoteDesktopFile(newAzureQuickVMName, newAzureQuickVMSvcName, path, true); // Get-AzureRemoteDesktopFile -Launch

            Console.WriteLine("Test passed");

            // Cleanup
            vmPowershellCmdlets.RemoveAzureVM(newAzureQuickVMName, newAzureQuickVMSvcName);
            Assert.AreEqual(null, vmPowershellCmdlets.GetAzureVM(newAzureQuickVMName, newAzureQuickVMSvcName));
            Console.WriteLine("VM is successfully removed");
            // vmPowershellCmdlets.RemoveAzureService(newAzureQuickVMSvcName);
            // Assert.AreEqual(null, vmPowershellCmdlets.GetAzureService(newAzureQuickVMSvcName));
            //Console.WriteLine("The service is successfully removed");

            //TODO: Need to do proper cleanup of the service
            //            vmPowershellCmdlets.RemoveAzureService(newAzureQuickVMSvcName);
            //            Assert.AreEqual(null, vmPowershellCmdlets.GetAzureService(newAzureQuickVMSvcName));
        }
ServiceManagementCmdletTestHelper