首页 > 解决方案 > Invoke-AzureRmHDInsightHiveJob :远程服务器返回错误:(404)未找到

问题描述

我正在尝试使用 powershell 对我的 HDInsight 群集运行 Hive 查询。Hadoop 作业成功完成,因为我可以在 yarn UI 中看到日志。但是该Invoke-AzureRmHDInsightHiveJob命令失败并出现以下错误。我做错了什么?

在此处输入图像描述

这是完整的代码:

$RunAsConnection = Get-AutomationConnection -Name AzureRunAsConnection;

try 
{
    $Login=Add-AzureRmAccount -ServicePrincipal -TenantId $RunAsConnection.TenantId -ApplicationId $RunAsConnection.ApplicationId -CertificateThumbprint $RunAsConnection.CertificateThumbprint -ErrorAction Stop
}
catch
{
    Sleep 10;
    $Login=Add-AzureRmAccount -ServicePrincipal -TenantId $RunAsConnection.TenantId -ApplicationId $RunAsConnection.ApplicationId -CertificateThumbprint $RunAsConnection.CertificateThumbprint
};

Set-AzureRmContext -SubscriptionId $RunAsConnection.SubscriptionID

Connect-AzureRmAccount -ServicePrincipal -Tenant $RunAsConnection.TenantID -ApplicationId $RunAsConnection.ApplicationID -CertificateThumbprint $RunAsConnection.CertificateThumbprint

$ResourceGroupName = "xxxxxx"
$StorageAccountName = "xxxxxx"
$StorageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $ResourceGroupName -AccountName $StorageAccountName).Value[0]
$StorageAccountName -StorageAccountKey $StorageAccountKey
$StorageAccountContainer = "xxxxxx"

$clusterName = "xxxxxx"
$creds=Get-Credential -Message "Enter the login for the cluster"

Use-AzureRmHDInsightCluster -ClusterName $clusterName -HttpCredential $creds

$queryString = "select 1"

Invoke-AzureRmHDInsightHiveJob -Query $queryString -Verbose -DefaultStorageAccountName "$StorageAccountName.blob.core.windows.net" -DefaultStorageAccountKey $StorageAccountKey -DefaultContainer $StorageAccountContainer

标签: azureazure-storagehadoop2azure-powershellazure-hdinsight

解决方案


推荐阅读