title: Getting Error: "Please connect to a valid Azure HDInsight cluster before calling this cmdlet" while running Hive in Powershell
body: <p>I have a <strong>Azure HDInsight Cluster</strong>. I want to run hive scripts in it through <strong>Windows Powershell ISE</strong>.</p>
  
  <p>While running the following script in Powershell I am getting the following error.</p>
  
  <p><strong>Script</strong>:</p>
  
  <pre><code>$clusterName = "utsavdawncluster"
  Use-AzureRmHDInsightCluster $clusterName
  Invoke-Hive -Query "show tables;"
  </code></pre>
  
  <p><strong>Error</strong>:</p>
  
  <p><a href="https://i.stack.imgur.com/Z0PT5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z0PT5.png" alt="enter image description here"></a></p>
  
  <p>My Powershell versions are as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/C4hJv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C4hJv.png" alt="enter image description here"></a></p>
  
  <p><strong>I am sure that the cluster name is correct and the cluster it is up and running.</strong></p>
  
  <p>I am not able to understand what is wrong here. Can anyone please tell what is the issue?</p>