title: Azure PowerShell - Object reference not set to an instance of an object
body: <p>I'm trying to write a PowerShell script to automate EventHub creation using Azure PowerShell. I am following the documentation outlined <a href="https://azure.microsoft.com/en-gb/documentation/articles/service-bus-powershell-how-to-provision/" rel="nofollow">here</a> and have installed the Azure PowerShell module (v 1.0.3).</p>
  
  <p>I have added the Microsoft ServiceBus library (v3.0)  using the following</p>
  
  <pre><code>$scriptPath = Split-Path -parent $PSCommandPath
  $dllPath = "$scriptPath\..\..\packages\WindowsAzure.ServiceBus.3.1.2\lib\net45-full\Microsoft.ServiceBus.dll"
  Add-Type -Path $dllPath
  </code></pre>
  
  <p>But as soon as I try and use the <code>Get-AzureSBNamespace</code> command, e.g.</p>
  
  <pre><code>$CurrentNamespace = Get-AzureSBNamespace -Name $Namespace
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>Get-AzureSBNamespace : Object reference not set to an instance of an object.
  </code></pre>
  
  <p>the same is true of <code>New-AzureSBNamespace</code>. I have also tried logging into Azure within the same session using <code>Login-AzureRmAccount</code>, but get the same object null reference exception.</p>
  
  <p>Is this a bug, or am i missing something not outlined in the documentation?</p>