Select-AzureStorSimpleResource
將資源設定為目前的資源。
注意
本檔中參考的 Cmdlet 用於管理使用服務管理 API 的舊版 Azure 資源。 如需管理 Azure Resource Manager 資源的 Cmdlet,請參閱 Az PowerShell 模組 。
Syntax
Select-AzureStorSimpleResource
-ResourceName <String>
[-RegistrationKey <String>]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
Description
Select-AzureStorSimpleResource Cmdlet 會將 資源設定為目前的資源。 選取資源之後,其他 Cmdlet 會套用在該資源內容中。
範例
範例 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
指定註冊金鑰。 第一次選取資源時,請指定索引鍵。 在此 Cmdlet 選取目前的資源之後,Cmdlet 會視需要使用此金鑰。 如需詳細資訊,請參閱 在 Microsoft 開發人員網路上取得服務註冊金鑰 ( 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
此 Cmdlet 會傳 回 StorSimpleResourceCoNtext 物件,其中包含資源內容的詳細資料。