title: Why would Test-AzureName always return false?
body: <p>Running this script in Azure:</p>
  
  <pre><code>Write-Host "Running ps_example.ps1"
  
  $resourceGroupName = 'myGroupName'
  $storageName = "psexample"
  $storageType = "Standard_LRS"
  $location = "centralus"
  
  if (Test-AzureName -Storage $storageName) {
      Write-Host "Use existing storage account - $storageName"
  } Else {
      Write-Host "Make new storage account - $storageName"
      New-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $storageName -Type $storageType -Location $location
  }
  </code></pre>
  
  <p>The first run shows:</p>
  
  <pre><code>Running ps_example.ps1
  Make new storage account - psexample
  </code></pre>
  
  <p>The second run shows:</p>
  
  <pre><code>Running ps_example.ps1
  Make new storage account - psexample
  The storage account named psexample is already taken.
  </code></pre>
  
  <p>Why? That would seem to indicate that <code>if (Test-AzureName -Storage $storageName)</code> always returns false.</p>
  
  <p>If I tell Azure to use powershell 1, the version is 1.113.5. Requesting version 2.0 results in 2.0.11. The behavior is the same for both.</p>
  
  <p>EDIT:</p>
  
  <p>Running this:</p>
  
  <pre><code>$result = Test-AzureName -Storage $storageName
  Write-Host $result
  </code></pre>
  
  <p>always prints False, whether psexample exists or not.</p>