ArgumentNullException - Get-AzureService

时间:2014-04-02 16:27:56

标签: powershell azure azure-powershell

我正在尝试使用Windows Azure PowerShell模块来管理订阅。

我已下载了我的证书(.publishsettings文件),并使用Import-AzurePublishSettingsFile导入了该文件,然后我选择了Select-AzureSubscription我的订阅,但这些订阅都没有出错。

我还使用Set-AzureSubscription -SubscriptionName "Blah"

设置订阅

仍然,我得到了

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

运行Get-AzureService

我已经阅读了入门指南和各种文档,但我无法弄清楚我做错了什么。在我看来,这是微软应该解决的用户体验问题。

更新

我进一步了,我用了

Set-AzureSubscription -SubscriptionName "Blah" -SubscriptionId 0123

将错误从Get-AzureService更改为:

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

但是现在我无法设置证书,因为参数需要X509Certificate类型。

2 个答案:

答案 0 :(得分:11)

使用Azure Powershell cmdlet --- Add-AzureAccount时,有一种更好的身份验证方法。这将提示您输入登录凭据,而不是使用服务管理证书。

您可能仍会遇到一些问题,因为Azure powershell会将您的订阅缓存在%appdata%\Windows Azure Powershell的XML文件中。

我建议:

  1. 关闭Azure Powershell窗口
  2. 删除%appdata%\Windows Azure Powershell
  3. 中的XML文件
  4. 打开Azure Powershell并运行Add-AzureAccount
  5. 这应该确保您配置了正确的订阅。

答案 1 :(得分:0)

我希望这对你有帮助 -

添加-AzureAccount GET-AzurePublishSettingsFile 导入-AzurePublishSettingsFile filenamewithpath

filenamewithpath 是发布设置文件,其路径保存在您的电脑上