public async Task ICanAddAndDeleteRDPUser() { IHDInsightSubscriptionCredentials credentials = IntegrationTestBase.GetValidCredentials(); IHDInsightClient client = HDInsightClient.Connect(credentials); ClusterCreateParametersV2 clusterCreationDetails = GetRandomCluster(); clusterCreationDetails.Version = "1.6"; ClusterDetails clusterDetails = client.CreateCluster(clusterCreationDetails); // add a rdp user - rdp is OFF by default, hence we enable it first string userName = "******"; string password = GetRandomValidPassword(); client.EnableRdp(clusterDetails.Name, clusterDetails.Location, userName, password, DateTime.UtcNow.AddHours(1)); ClusterDetails cluster = await client.GetClusterAsync(clusterDetails.Name); Assert.AreEqual(userName, cluster.RdpUserName, "Rdp user name has not been updated"); // now disable the rdp user await client.DisableRdpAsync(clusterDetails.Name, clusterDetails.Location); cluster = await client.GetClusterAsync(clusterDetails.Name); Assert.IsFalse(String.IsNullOrEmpty(cluster.Name), "Cluster user name is empty, maybe cluster was not created."); Assert.IsTrue(String.IsNullOrEmpty(cluster.RdpUserName), "Rdp user name has not been cleared"); // delete the cluster if (!string.Equals(clusterDetails.Name, IntegrationTestBase.TestCredentials.WellKnownCluster.DnsName)) { client.DeleteCluster(clusterDetails.Name); } }
public override async Task EndProcessing() { this.Name.ArgumentNotNullOrEmpty("Name"); this.Location.ArgumentNotNullOrEmpty("Location"); IHDInsightClient client = this.GetClient(IgnoreSslErrors); if (this.Enable) { this.RdpCredential.ArgumentNotNull("RdpCredential"); await client.EnableRdpAsync(this.Name, this.Location, this.RdpCredential.UserName, this.RdpCredential.GetCleartextPassword(), RdpAccessExpiry); } else { await client.DisableRdpAsync(this.Name, this.Location); } var getCommand = ServiceLocator.Instance.Locate <IAzureHDInsightCommandFactory>().CreateGet(); getCommand.CurrentSubscription = this.CurrentSubscription; getCommand.Name = this.Name; await getCommand.EndProcessing(); this.Output.AddRange(getCommand.Output); }