protected override void ProcessRecord()
        {
            var rdpParams = new RDPSettingsParameters
            {
                OsProfile = new OsProfile
                {
                    WindowsOperatingSystemProfile = new WindowsOperatingSystemProfile
                    {
                        RdpSettings = new RdpSettings
                        {
                            UserName = RdpCredential.UserName,
                            Password = RdpCredential.Password.ConvertToString(),
                            ExpiryDate = RdpAccessExpiry
                        }
                    }
                }
            };

            if (ResourceGroupName == null)
            {
                ResourceGroupName = GetResourceGroupByAccountName(ClusterName);
            }

            HDInsightManagementClient.ConfigureRdp(ResourceGroupName, ClusterName, rdpParams);
        }
        public override void ExecuteCmdlet()
        {
            var rdpParams = new RDPSettingsParameters
            {
                OsProfile = new OsProfile
                {
                    WindowsOperatingSystemProfile = new WindowsOperatingSystemProfile
                    {
                        RdpSettings = null
                    }
                }
            };

            HDInsightManagementClient.ConfigureRdp(ResourceGroupName, ClusterName, rdpParams);
        }
        protected override void ProcessRecord()
        {
            var rdpParams = new RDPSettingsParameters
            {
                OsProfile = new OsProfile
                {
                    WindowsOperatingSystemProfile = new WindowsOperatingSystemProfile
                    {
                        RdpSettings = null
                    }
                }
            };

            if (ResourceGroupName == null)
            {
                ResourceGroupName = GetResourceGroupByAccountName(ClusterName);
            }

            HDInsightManagementClient.ConfigureRdp(ResourceGroupName, ClusterName, rdpParams);
        }
Exemplo n.º 4
0
        public void TestDisableEnableRdp()
        {
            var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK };

            using (var context = UndoContext.Current)
            {
                context.Start();

                //get clients
                var client = HDInsightManagementTestUtilities.GetHDInsightManagementClient(handler);
                var resourceManagementClient = HDInsightManagementTestUtilities.GetResourceManagementClient(handler);
                
                //create resourcegroup
                var resourceGroup = HDInsightManagementTestUtilities.CreateResourceGroup(resourceManagementClient);
                
                //set variables
                const string dnsname = "hdisdk-rdp1";

                var spec = GetClusterSpecHelpers.GetPaasClusterSpec();
                
                var rdpdisable = new RDPSettingsParameters
                {
                    OsProfile = new OsProfile
                    {
                        WindowsOperatingSystemProfile = new WindowsOperatingSystemProfile
                        {
                            RdpSettings = null
                        }
                    }
                };
                var rdpenable = new RDPSettingsParameters
                {
                    OsProfile = new OsProfile
                    {
                        WindowsOperatingSystemProfile = new WindowsOperatingSystemProfile
                        {
                            RdpSettings = new RdpSettings
                            {
                                ExpiryDate = new DateTime(2015, 10, 20),
                                Password = "******",
                                UserName = "******"
                            }
                        }
                    }
                };

                //test
                var cluster = client.Clusters.Create(resourceGroup, dnsname, spec);
                //Assert.True(
                //    cluster.Cluster.Properties.ConnectivityEndpoints.Any(
                //        c => c.Name.Equals("RDP", StringComparison.OrdinalIgnoreCase)));

                client.Clusters.ConfigureRdpSettings(resourceGroup, dnsname, rdpdisable);
                cluster = client.Clusters.Get(resourceGroup, dnsname);
                Assert.False(
                    cluster.Cluster.Properties.ConnectivityEndpoints.Any(
                        c => c.Name.Equals("RDP", StringComparison.OrdinalIgnoreCase)));

                client.Clusters.ConfigureRdpSettings(resourceGroup, dnsname, rdpenable);
                cluster = client.Clusters.Get(resourceGroup, dnsname);
                Assert.True(
                    cluster.Cluster.Properties.ConnectivityEndpoints.Any(
                        c => c.Name.Equals("RDP", StringComparison.OrdinalIgnoreCase)));
                
                client.Clusters.Delete(resourceGroup, dnsname);
            }
        }
 /// <summary>
 /// Configures the RDP settings on the specified cluster.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.HDInsight.IClusterOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// Required. The name of the cluster.
 /// </param>
 /// <param name='rdpParameters'>
 /// Required. The OS profile for RDP. Use null to turn RDP off.
 /// </param>
 /// <returns>
 /// The azure async operation response.
 /// </returns>
 public static Task<OperationResource> ConfigureRdpSettingsAsync(this IClusterOperations operations, string resourceGroupName, string clusterName, RDPSettingsParameters rdpParameters)
 {
     return operations.ConfigureRdpSettingsAsync(resourceGroupName, clusterName, rdpParameters, CancellationToken.None);
 }
 /// <summary>
 /// Configures the RDP settings on the specified cluster.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.HDInsight.IClusterOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// Required. The name of the cluster.
 /// </param>
 /// <param name='rdpParameters'>
 /// Required. The OS profile for RDP. Use null to turn RDP off.
 /// </param>
 /// <returns>
 /// The azure async operation response.
 /// </returns>
 public static OperationResource ConfigureRdpSettings(this IClusterOperations operations, string resourceGroupName, string clusterName, RDPSettingsParameters rdpParameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IClusterOperations)s).ConfigureRdpSettingsAsync(resourceGroupName, clusterName, rdpParameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// Begins configuring the RDP settings on the specified cluster.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.HDInsight.IClusterOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group.
 /// </param>
 /// <param name='clusterName'>
 /// Required. The name of the cluster.
 /// </param>
 /// <param name='rdpParameters'>
 /// Required. The OS profile for RDP.
 /// </param>
 /// <returns>
 /// The cluster long running operation response.
 /// </returns>
 public static Task<HDInsightOperationResponse> BeginConfiguringRdpSettingsAsync(this IClusterOperations operations, string resourceGroupName, string clusterName, RDPSettingsParameters rdpParameters)
 {
     return operations.BeginConfiguringRdpSettingsAsync(resourceGroupName, clusterName, rdpParameters, CancellationToken.None);
 }
 public virtual HDInsightLongRunningOperationResponse ConfigureRdp(string resourceGroupName, string clusterName, RDPSettingsParameters rdpSettings)
 {
     return HdInsightManagementClient.Clusters.ConfigureRdpSettings(resourceGroupName, clusterName, rdpSettings);
 }