Skip to content

"Select-AzureRmSubscription -SubscriptionId" will give you an error after Azure PS 1.5.0 #2388

@TeppeiIshii-zz

Description

@TeppeiIshii-zz

PS C:\Users\teppei> Select-AzureRmSubscription -SubscriptionId "XXXXX-YYYY-ZZZZ"
Set-AzureRmContext : パラメーター 'SubscriptionId の引数を確認できません。引数 "XXXXX-YYYY-ZZZZ"
は、ValidateSet 属性で指定されたセット "52c748bc-65e5-44aa-8d64-97abff022b4e" に属していません。このセットの引数を指定
して、コマンドを再度実行してください。
発生場所 行:1 文字:44

  • ... RmSubscription -SubscriptionId "aee69007-7b6d-465e-9df7-ae8b05fb2e94"
  •                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Set-AzureRmContext]、ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.Profile.SetAzureRMContextComma
      nd

// It's odd.
// The following goes successful.

PS C:\Users\teppei> $sub = get-azurermsubscription
PS C:\Users\teppei> Select-AzureRmSubscription -SubscriptionId $sub[0].SubscriptionId

// But the following will fail in the same error.

PS C:\Users\teppei> $subid = "XXXXX-YYYY-ZZZZ"
PS C:\Users\teppei> Select-AzureRmSubscription -SubscriptionId $subid
Set-AzureRmContext : パラメーター 'SubscriptionId の引数を確認できません。引数 "aee69007-7b6d-465e-9df7-ae8b05fb2e94"
は、ValidateSet 属性で指定されたセット "52c748bc-65e5-44aa-8d64-97abff022b4e" に属していません。このセットの引数を指定
して、コマンドを再度実行してください。
発生場所 行:1 文字:44

  • Select-AzureRmSubscription -SubscriptionId $subid
  •                                        ~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Set-AzureRmContext]、ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.Profile.SetAzureRMContextComma
      nd

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions