title: "The Azure PowerShell session has not been properly initialized" error message in Octopus
body: <p>I am trying to run the <code>Get-AzureRmEventHubNamespaceKey</code> cmdlet in an Azure Powershell step within Octopus.</p>
  
  <p>I am getting the following error:</p>
  
  <pre><code>Get-AzureRmEventHubNamespaceKey : The Azure PowerShell session has not been properly 
                                    initialized.  Please import the module and try again
  </code></pre>
  
  <p>The module is installed in the following directory on the Octopus server:</p>
  
  <p><code>C:\Program Files (x86)\Microsoft 
       SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.EventHub</code></p>
  
  <p>I have tried importing the module first as part of the same step:</p>
  
  <p><code>Import-Module –Name "C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.EventHub" -Verbose</code></p>
  
  <p>And I can see in the output that it has been imported:</p>
  
  <p><code>VERBOSE: Importing cmdlet 'Get-AzureRmEventHubNamespaceKey'.</code></p>
  
  <p>But it is immediately followed by the above error. If I RDP to the octopus server and run directly from there it runs fine.</p>
  
  <p>Any ideas on what might be causing this?</p>