使用带有Datalakestore连接的证书的HDInsight命令期间出现PowerShell错误

时间:2018-01-15 07:09:41

标签: powershell azure hdinsight

尝试使用powershell创建HDInsight群集,并将datalakestore作为附加存储。能够通过以pfx格式上传证书来使用门户创建集群。 Powershell命令给我错误,附上截图。

New-AzureRmHDInsightClusterConfig `
        | Add-AzureRmHDInsightClusterIdentity `
            -ObjectID $objectId `
            -AadTenantId $tenantId `
            -CertificateFilePath $certificateFilePath `
            -CertificatePassword $certificatePassword `
        | New-AzureRmHDInsightCluster `
            -ClusterName $clusterName `
            -ResourceGroupName $clusterResourceGroupName `
            -HttpCredential $httpCredentials `
            -SshCredential $sshCredentials `
            -Location $location `
            -DefaultStorageAccountName "$storageAccountName.blob.core.windows.net" `
            -DefaultStorageAccountKey $storageAccountKey `
            -DefaultStorageContainer $storageAccountContainer `
            -ClusterSizeInNodes $clusterNodes `
            -ClusterType Spark `
            -Version "3.6" `
            -OSType Linux

我也试过以下。

New-AzureRmHDInsightCluster `
-ClusterName $clusterName `
-ResourceGroupName $clusterResourceGroupName `
-HttpCredential $httpCredentials `
-SshCredential $sshCredentials `
-Location $location `
-DefaultStorageAccountName "$storageAccountName.blob.core.windows.net" `
-DefaultStorageAccountKey $storageAccountKey `
-DefaultStorageContainer $storageAccountContainer `
-ClusterSizeInNodes $clusterNodes `
-ClusterType Spark `
-Version "3.6" `
-OSType Linux `
-ObjectID $objectId `
-AadTenantId $tenantId `
-CertificateFilePath $certificateFilePath `
-CertificatePassword $certificatePassword

我在下面看到错误。不确定缺少什么。错误并没有给我太多的洞察力(没有双关语;))。 screenshot

我可以创建没有证书的群集。我还希望能够提供-CertificateFileContents属性并传递从azure密钥库中检索到的byte []读取证书,一旦能够使其正常工作。任何指针都会很棒。

1 个答案:

答案 0 :(得分:1)

能够解决此错误。我提供的objectId是应用程序ObjectId,相反,当我提供对应于ADApp的Service Principal的objectId时,它工作正常。

但是当我尝试提供参数-CertificateFileContents并输入从keyvault检索到的byte []时,会创建集群但是没有配置访问DLS的Service Principal设置。不确定这里设置出错了什么。在作为参数传递之前将cert内容转换为字节数组。

$cert = Get-AzureKeyVaultSecret -VaultName 'keyvault' -Name $certName
$certBytes = [System.Convert]::FromBase64String($cert.SecretValueText)

New-AzureRmHDInsightCluster `
    -ClusterName $clusterName `
    -ResourceGroupName $clusterResourceGroupName `
    -HttpCredential $httpCredentials `
    -SshCredential $sshCredentials `
    -Location $location `
    -DefaultStorageAccountName "$storageAccountName.blob.core.windows.net" `
    -DefaultStorageAccountKey $storageAccountKey `
    -DefaultStorageContainer $storageAccountContainer `
    -ClusterSizeInNodes $clusterNodes `
    -ClusterType Spark `
    -Version "3.6" `
    -OSType Linux `
    -ObjectID $objectId `
    -AadTenantId $tenantId `
    -CertificateFileContents $certBytes