尝试执行 Start-AzureService 时,我不断收到上述错误。
执行Get-AzureAccount时提示如下信息:
Id Type Subscriptions Tenants
-- ---- ------------- -------
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e7aa82a78892938b88888cc984888a" rel="noreferrer noopener nofollow">[email protected]</a> User 12345678-1234-5678-9012-345678901235 {12345678-1234-5678-9012-345678901235}
执行Get-AzureSubscription时提示如下信息:
SubscriptionId : 12345678-1234-5678-9012-345678901235
SubscriptionName : My Production (Pay-As-You-Go)
Environment : MyCloud
DefaultAccount : <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d69bb396b9a3a2bab9b9bdf8b5b9bb" rel="noreferrer noopener nofollow">[email protected]</a>
IsDefault : True
IsCurrent : True
TenantId : 12345678-1234-5678-9012-345678901235
CurrentStorageAccountName :
Select-AzureSubscription : Parameter set cannot be resolved using the specified named parameters.
当我尝试执行建议的命令时出现提示:
Select-AzureSubscription -Default "My Production (Pay-As-You-Go)"
最佳答案
使用此选项选择您的默认订阅:
Select-AzureSubscription -Default -SubscriptionName "My Production (Pay-As-You-Go)"
您还可以选择使用 -SubscriptionId
(和 GUID)而不是名称。
有关 Select-AzureSubscription
commandlet 的更多信息;输入 Get-Help Select-AzureSubscription
。
如果这不起作用,请先尝试运行,然后再选择您的订阅:
Add-AzureAccount
如果您仍然遇到问题,请更新:
如果您使用 AzureRM/旧版 cmdlet(或只是 AzureRM)并且仍然遇到问题,我强烈建议您检查是否有多个版本的 AzureRM.Profile 模块。当一个版本安装在 Program Files 下而另一个版本安装在我的用户配置文件下(或 PSModulePath 中的其他位置)时,我已经多次遇到这种情况。
列出安装的模块/版本:
Get-Module AzureRm.Profile -ListAvailable
如果您有多个实例和版本,则可能会给您的某些 cmdlet 带来一些问题。
关于azure - 未指定默认订阅。使用 Select-AzureSubscription -Default <subscriptionName> 设置默认订阅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37908171/