コード例 #1
0
        private ClusterCreateParameters GetDataLakeClusterParameters()
        {
            var spec = GetClusterSpecHelpers.GetCustomCreateParametersPaas();

            ServicePrincipal servicePrincipal = new ServicePrincipal(new Guid(ApplicationId), new Guid(AadTenantId), CertificateFileBytes,
                CertificatePassword);
            spec.Principal = servicePrincipal;
            return spec;
        }
コード例 #2
0
        protected override void ProcessRecord()
        {
            parameters.UserName = HttpCredential.UserName;
            parameters.Password = HttpCredential.Password.ConvertToString();

            if (RdpCredential != null)
            {
                parameters.RdpUsername = RdpCredential.UserName;
                parameters.RdpPassword = RdpCredential.Password.ConvertToString();
            }

            if (OSType == OSType.Linux)
            {
                parameters.SshUserName = SshCredential.UserName;
                if (!string.IsNullOrEmpty(SshCredential.Password.ConvertToString()))
                {
                    parameters.SshPassword = SshCredential.Password.ConvertToString();
                }
                if (!string.IsNullOrEmpty(SshPublicKey))
                {
                    parameters.SshPublicKey = SshPublicKey;
                }
            }

            foreach (
                var storageAccount in
                    AdditionalStorageAccounts.Where(
                        storageAccount => !parameters.AdditionalStorageAccounts.ContainsKey(storageAccount.Key)))
            {
                parameters.AdditionalStorageAccounts.Add(storageAccount.Key, storageAccount.Value);
            }
            foreach (var config in Configurations.Where(config => !parameters.Configurations.ContainsKey(config.Key)))
            {
                parameters.Configurations.Add(config.Key, config.Value);
            }
            foreach (var action in ScriptActions.Where(action => parameters.ScriptActions.ContainsKey(action.Key)))
            {
                parameters.ScriptActions.Add(action.Key,
                    action.Value.Select(a => a.GetScriptActionFromPSModel()).ToList());
            }
            if (OozieMetastore != null)
            {
                var metastore = OozieMetastore;
                parameters.OozieMetastore = new Metastore(metastore.SqlAzureServerName, metastore.DatabaseName, metastore.Credential.UserName, metastore.Credential.Password.ConvertToString());
            }
            if (HiveMetastore != null)
            {
                var metastore = HiveMetastore;
                parameters.OozieMetastore = new Metastore(metastore.SqlAzureServerName, metastore.DatabaseName, metastore.Credential.UserName, metastore.Credential.Password.ConvertToString());
            }
            if (CertificateFilePath != null && CertificatePassword != null)
            {
                Microsoft.Azure.Management.HDInsight.Models.ServicePrincipal servicePrincipal = 
                    new Microsoft.Azure.Management.HDInsight.Models.ServicePrincipal(
                        GetApplicationId(), GetTenantId(AadTenantId), File.ReadAllBytes(CertificateFilePath), CertificatePassword);
                parameters.Principal = servicePrincipal;
            }

            var cluster = HDInsightManagementClient.CreateNewCluster(ResourceGroupName, ClusterName, parameters);

            if (cluster != null)
            {
                WriteObject(new AzureHDInsightCluster(cluster.Cluster));
            }
        }
コード例 #3
0
        protected override void ProcessRecord()
        {
            parameters.UserName = HttpCredential.UserName;
            parameters.Password = HttpCredential.Password.ConvertToString();

            if (RdpCredential != null)
            {
                parameters.RdpUsername = RdpCredential.UserName;
                parameters.RdpPassword = RdpCredential.Password.ConvertToString();
            }

            if (OSType == OSType.Linux)
            {
                parameters.SshUserName = SshCredential.UserName;
                if (!string.IsNullOrEmpty(SshCredential.Password.ConvertToString()))
                {
                    parameters.SshPassword = SshCredential.Password.ConvertToString();
                }
                if (!string.IsNullOrEmpty(SshPublicKey))
                {
                    parameters.SshPublicKey = SshPublicKey;
                }
            }

            foreach (
                var storageAccount in
                AdditionalStorageAccounts.Where(
                    storageAccount => !parameters.AdditionalStorageAccounts.ContainsKey(storageAccount.Key)))
            {
                parameters.AdditionalStorageAccounts.Add(storageAccount.Key, storageAccount.Value);
            }
            foreach (var config in Configurations.Where(config => !parameters.Configurations.ContainsKey(config.Key)))
            {
                parameters.Configurations.Add(config.Key, config.Value);
            }
            foreach (var action in ScriptActions.Where(action => parameters.ScriptActions.ContainsKey(action.Key)))
            {
                parameters.ScriptActions.Add(action.Key,
                                             action.Value.Select(a => a.GetScriptActionFromPSModel()).ToList());
            }
            if (OozieMetastore != null)
            {
                var metastore = OozieMetastore;
                parameters.OozieMetastore = new Metastore(metastore.SqlAzureServerName, metastore.DatabaseName, metastore.Credential.UserName, metastore.Credential.Password.ConvertToString());
            }
            if (HiveMetastore != null)
            {
                var metastore = HiveMetastore;
                parameters.HiveMetastore = new Metastore(metastore.SqlAzureServerName, metastore.DatabaseName, metastore.Credential.UserName, metastore.Credential.Password.ConvertToString());
            }
            if (CertificateFilePath != null && CertificatePassword != null)
            {
                Microsoft.Azure.Management.HDInsight.Models.ServicePrincipal servicePrincipal =
                    new Microsoft.Azure.Management.HDInsight.Models.ServicePrincipal(
                        GetApplicationId(), GetTenantId(AadTenantId), File.ReadAllBytes(CertificateFilePath), CertificatePassword);
                parameters.Principal = servicePrincipal;
            }

            var cluster = HDInsightManagementClient.CreateNewCluster(ResourceGroupName, ClusterName, parameters);

            if (cluster != null)
            {
                WriteObject(new AzureHDInsightCluster(cluster.Cluster));
            }
        }