Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Get-AzureService : Value cannot be null.
Parameter name: subscriptionId

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.

Update

I got a bit further, I used

Set-AzureSubscription -SubscriptionName "Blah" -SubscriptionId 0123

which changed the error from Get-AzureService to:

Get-AzureService : Value cannot be null.
Parameter name: managementCertificate

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

like image 209
Luke Puplett Avatar asked Dec 20 '22 16:12

Luke Puplett


1 Answers

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.

like image 90
kwill Avatar answered Jan 28 '23 18:01

kwill