我正在尝试使用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