Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

I hope this might help you-

Add-AzureAccount Get-AzurePublishSettingsFile Import-AzurePublishSettingsFile filenamewithpath

filenamewithpath is the publishsetting file with path saved on your pc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top