Select-AzureStorSimpleResource

リソースを現在のリソースとして設定します。

Note

このドキュメントで参照されているコマンドレットは、Azure Service Manager (ASM) API を使用する従来の Azure リソースを管理するためのものです。 ASM の提供終了が予定されているため、新しいリソースを作成する場合、このレガシ PowerShell モジュールは推奨されません。 詳細については、Azure Service Manager の提供終了に関するページを参照してください

Az PowerShell モジュールは、PowerShell を使用して Azure Resource Manager (ARM) リソースを管理するために推奨される PowerShell モジュールです。

構文

Select-AzureStorSimpleResource
      -ResourceName <String>
      [-RegistrationKey <String>]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]

説明

Select-AzureStorSimpleResource コマンドレットは、リソースを現在のリソースとして設定します。 リソースを選択すると、そのリソース コンテキスト内に他のコマンドレットが適用されます。

例 1: 初めてリソースを選択する

PS C:\>Select-AzureStorSimpleResource -ResourceName "Contoso64-Tsqa" -RegistrationKey "<your registration key>"
ResourceId           ResourceName
----------           ------------
1909806764156522689  Contoso64-Tsqa

このコマンドは、Contoso64-Tsqa という名前のリソースを現在のコンテキストとして選択します。 この例では、コンピューターでこのコンテキストが以前に初期化されていないため、RegistrationKey パラメーターの値を指定する必要があります。

例 2: リソースの選択を試みる

This command gets the current context for this computer by using the **Get-AzureStorSimpleResourceContext** cmdlet. The current selected resource is Contoso64-Tsqa. This is consistent with the previous example. 
PS C:\>Get-AzureStorSimpleResourceContext
ResourceId           ResourceName
----------           ------------
1909806764156522689  Contoso64-Tsqa 

This command attempts to reset the resource to be Contoso02-Resource. For this example, this resource has not been previously selected. The registration key is not saved or included in the command. The command cannot select the resource. 
PS C:\>Select-AzureStorSimpleResource -ResourceName "Contoso02-Resource"
Select-AzureStorSimpleResource : Could not find the persisted secret. Please use Select-AzureStorSimpleResource and
provide the Registration key once again.

例 3: 以前に選択したリソースを選択する

PS C:\>Select-AzureStorSimpleResource -ResourceName "Contoso64-Tsqa"
ResourceId           ResourceName
----------           ------------
1909806764156522689  Contoso64-Tsqa

このコマンドは、Contoso64-Tsqa という名前のリソースを現在のコンテキストとして選択します。 この例では、そのコンテキストは以前に選択されているため、RegistrationKey パラメーターの値を指定する必要はありません。

パラメーター

-Profile

Azure プロファイルを指定します。

型:AzureSMProfile
配置:Named
規定値:None
必須:False
パイプライン入力を受け取る:False
ワイルドカード文字を受け取る:False

-RegistrationKey

登録キーを指定します。 リソースを初めて選択するときにキーを指定します。 このコマンドレットが現在のリソースを選択した後、コマンドレットは必要に応じてこのキーを使用します。 詳細については、「Microsoft Developer Network でサービス登録キー () を取得する」https://msdn.microsoft.com/en-us/library/azure/dn772346.aspxを参照してください。

型:String
配置:Named
規定値:None
必須:False
パイプライン入力を受け取る:True
ワイルドカード文字を受け取る:False

-ResourceName

現在のリソースとして選択するリソースの名前を指定します。

型:String
配置:Named
規定値:None
必須:True
パイプライン入力を受け取る:True
ワイルドカード文字を受け取る:False

入力

None

出力

StorSimpleResourceContext

このコマンドレットは、リソース コンテキストの 詳細を含む StorSimpleResourceContext オブジェクトを返します。