private ClusterCreateParameters GetDataLakeClusterParameters() { var spec = GetClusterSpecHelpers.GetCustomCreateParametersPaas(); ServicePrincipal servicePrincipal = new ServicePrincipal(new Guid(ApplicationId), new Guid(AadTenantId), CertificateFileBytes, CertificatePassword); spec.Principal = servicePrincipal; return spec; }
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)); } }
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)); } }