获取错误:“在调用此cmdlet之前,请连接到有效的Azure HDInsight群集”,同时在Powershell中运行Hive

时间:2017-02-22 12:26:38

标签: powershell azure hadoop hive hdinsight

我有 Azure HDInsight群集。我想通过 Windows Powershell ISE 在其中运行配置单元脚本。

在Powershell中运行以下脚本时,我收到以下错误。

脚本

$clusterName = "utsavdawncluster"
Use-AzureRmHDInsightCluster $clusterName
Invoke-Hive -Query "show tables;"

错误

enter image description here

我的Powershell版本如下:

enter image description here

我确信群集名称正确且群集已启动并正在运行。

我无法理解这里有什么问题。任何人都可以告诉我们这是什么问题吗?

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

#设置要使用的群集  使用-AnlandRmHDInsightCluster -ClusterName $ clusterName -HttpCredential $ creds

有关完整样本,请参阅

https://docs.microsoft.com/en-us/azure/hdinsight/hdinsight-hadoop-use-hive-powershell