powershell - 使用 Datalakestore 连接的证书执行 HDInsight 命令期间出现错误 powershell

标签 powershell azure 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 key Vault 检索到的 byte[] 读取证书,一旦能够正常工作。任何指点都会很棒。

最佳答案

能够解决此错误。我提供的objectId是应用程序ObjectId,而当我提供与ADApp对应的服务主体的objectId时,它起作用了。

但是当我尝试提供参数 -CertificateFileContents 并输入从 keyvault 检索到的 byte[] 时,集群已创建,但用于访问 DLS 的服务主体设置未配置。不确定这里的设置出了问题。在作为参数传递之前,我将证书内容转换为字节数组。

$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

关于powershell - 使用 Datalakestore 连接的证书执行 HDInsight 命令期间出现错误 powershell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48258356/

相关文章:

arrays - 如何在 Powershell 中使用数组调用带有参数的函数?

Azure Powershell - 根据私有(private)IP查找NIC

azure - 我们是否真的需要创建一个应用程序注册 Azure AD 到 Azure AD B2C 以便与其他身份提供商进行通信?

Azure 应用服务上的 Python 代码运行速度比本地慢 10 倍

HTML电子邮件中的PowerShell显示表

azure - 我们可以为 Azure 中的多个资源分配多个角色吗?

azure - 当我使用自定义策略时,如何在 token 中返回 Azure AD B2C 的内置声明?

azure - 为 Azure Kafka 配置灾难恢复和自动故障转移?

azure - 带有HDInsight的Azure Blob存储是否在完整行上拆分文件?

azure - HDInsight - 由于 -8 个核心的订阅限制,Spark 群集验证失败