azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Test-AzureRmDnsAvailability

Open ronbok opened this issue 9 years ago • 3 comments

Something broke for sure. This cmdlet has been working fine until today. v.3.6

$CheckDNS = Test-AzureRmDnsAvailability -DomainNameLabel $Name.ToLower() -Location $AzureRegion -Verbose

Now it keeps returning this error when PowerShell is called from a batch file:

powershell.exe -ExecutionPolicy bypass -file ....

Test-AzureRmDnsAvailability : Run Login-AzureRmAccount to login. At C:\GitHub...\xxxx.ps1:446 char:13

  • $CheckDNS = Test-AzureRmDnsAvailability -DomainNameLabel $ELBPIPName. ...
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Test-AzureRmDnsAvailability], PSInvalidOperationException
    • FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.Network.TestAzureDnsAvailabilityCmdlet

If you run it from the ISE...it doesn't return this error.

ronbok avatar Apr 13 '17 15:04 ronbok

This is the direct result of how you install v3.6. If you install it from PSGallery instead of the .msi this error will occur. If you install v3.6 from the .msi its not an issue. I'm looking for an explanation of why this should be different depending on the install method. Thanks.

ronbok avatar Apr 13 '17 15:04 ronbok

@ronbok can you run the following script and paste the output after the error. This will help us diagnose the issue. Thanks

function Resolve-Error ($ErrorRecord=$Error[0])
{
   $ErrorRecord | Format-List * -Force
   $ErrorRecord.InvocationInfo |Format-List *
   $Exception = $ErrorRecord.Exception
   for ($i = 0; $Exception; $i++, ($Exception = $Exception.InnerException))
   {   "$i" * 80
       $Exception |Format-List * -Force
   }
}

sphibbs avatar Apr 14 '17 18:04 sphibbs

Closing this issue due to a lack of activity

@ronbok please feel free to re-open this issue if you are still having problems with Test-AzureRmDnsAvailability in the latest release of Azure PowerShell

cormacpayne avatar Jun 06 '17 21:06 cormacpayne