PowerShell issue: Account with name ‘True’ does not exist

Whilst I was scripting out some azure deployment stuff, I suddenly was getting this error whenever I tried to invoke

Get-AzureSqlDatabaseServer or Get-AzureSqlDatabaseServerFirewallRule

Account with name ‘True’ does not exist

So I ended up looking at my different subscriptions and I noticed the following (see screenshot)


As you can see, 2 subscriptions contain the value True for DefaultAccount, so obviously this was causing the issue (as the account I was querying against was my Default one)

Once I noticed the above, I only had to get my account information for my subscriptions and update my subscriptions which had the DefaultAccount set to true.

So I performed the following steps to resolve the issue

1. In powershell execute: Get-AzureAccount and match the correct ID to Subscription (lookup the value in subscriptions (1) and compare them to the subscriptions id obtained using Get-Subscriptions). Once found, copy the corresponding Id (2)


2. Now execute the following

Select-AzureSubscription -SubscriptionName “YOUR SUBSCRIPTION NAME” -Account “VALUE OBTAINED IN PREVIOUS STEP”

Et voila; it works again


Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress spam blocked by CleanTalk.