Share via


Select-AzureStorSimpleResource

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

注意

このドキュメントで参照されているコマンドレットは、Service Management API を使用するレガシ Azure リソースを管理するためのものです。 Azure Resource Manager リソースを管理するためのコマンドレットについては、Az 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 プロファイルを指定します。

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RegistrationKey

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceName

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

入力

None

出力

StorSimpleResourceContext

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