ArgumentNullException – Get-AzureService


I’m trying to use the Windows Azure PowerShell module to manage a subscription.

I have downloaded my certificate (the .publishsettings file) and imported it with Import-AzurePublishSettingsFile and then I’ve selected my subscription with Select-AzureSubscription neither of which gave errors.

I’ve also set my subscription using Set-AzureSubscription -SubscriptionName "Blah"

Still, I get a

when running Get-AzureService

I’ve read getting started guides and various documentation but I can’t work out what I’m doing wrong. Which in my mind, makes this a UX problem that Microsoft should address.


I got a bit further, I used

which changed the error from Get-AzureService to:

But now I cannot set my certificate since the argument wants an X509Certificate type.


There is a better way to authenticate when using the Azure Powershell cmdlets — Add-AzureAccount. This will prompt you for your login credentials instead of using the service management certificate.

You may still run into some issues because Azure powershell caches your subscriptions in XML files in %appdata%\Windows Azure Powershell.

I would recommend:

  1. Close the Azure Powershell window
  2. Delete the XML files in %appdata%\Windows Azure Powershell.
  3. Open Azure Powershell and run Add-AzureAccount.

This should ensure that you have the correct subscriptions configured.


ArgumentNullException – Get-AzureService by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply