Get-AzureEnvironment
取得 Azure 環境
注意
本檔中參考的 Cmdlet 用於管理使用服務管理 API 的舊版 Azure 資源。 如需管理 Azure Resource Manager 資源的 Cmdlet,請參閱 Az PowerShell 模組 。
Syntax
Get-AzureEnvironment
[-Name <String>]
[-Profile <AzureSMProfile>]
[<CommonParameters>]
Description
Get-AzureEnvironment Cmdlet 會取得 Windows PowerShell 可用的 Azure 環境。
Azure 環境是 Microsoft Azure 的獨立部署,例如適用于全球 Azure 的 Azure 雲端,以及由中國 21Vianet 營運的 AzureChinaCloud。 您也可以使用 Azure Pack 和 WAPack Cmdlet 來建立內部部署 Azure 環境。 如需詳細資訊,請參閱 Azure Pack 。
Get-AzureEnvironment Cmdlet 會從您的訂用帳戶資料檔案取得環境,而不是從 Azure 取得環境。 如果訂用帳戶資料檔案已過期,請執行 Add-AzureAccount 或 Import-PublishSettingsFile Cmdlet 來重新整理它。
本主題描述 Microsoft Azure PowerShell 模組 0.8.10 版中的 Cmdlet。
若要取得您所使用的模組版本,請在 Azure PowerShell 主控台中輸入 (Get-Module -Name Azure).Version
。
範例
範例 1:取得所有環境
PS C:\> Get-AzureEnvironment
EnvironmentName ServiceEndpoint ResourceManagerEndpoint PublishSettingsFileUrl
--------------- --------------- ----------------------- ----------------------
AzureCloud https://management.core.wi... https://management.azure.com/ https://go.microsoft.com/fw...
AzureChinaCloud https://management.core.ch... https://not-supported-serv... https://go.microsoft.com/fw...
此命令會取得 Windows PowerShell 可用的所有環境。
範例 2:依名稱取得環境
PS C:\> Get-AzureEnvironment -Name AzureCloud
Name : AzureCloud
PublishSettingsFileUrl : https://go.microsoft.com/fwlink/?LinkID=301775
ServiceEndpoint : https://management.core.windows.net/
ResourceManagerEndpoint : https://management.azure.com/
ManagementPortalUrl : https://go.microsoft.com/fwlink/?LinkId=254433
ActiveDirectoryEndpoint : https://login.windows.net/
ActiveDirectoryCommonTenantId : common
StorageEndpointSuffix : core.windows.net
StorageBlobEndpointFormat : {0}://{1}.blob.core.windows.net/
StorageQueueEndpointFormat : {0}://{1}.queue.core.windows.net/
StorageTableEndpointFormat : {0}://{1}.table.core.windows.net/
GalleryEndpoint : https://gallery.azure.com/
此範例會取得 AzureCloud 環境。
範例 3:取得所有環境的所有屬性
PS C:\> Get-AzureEnvironment | ForEach-Object {Get-AzureEnvironment -Name $_.EnvironmentName}
此命令會取得所有環境的所有屬性。
此命令會 使用 Get-AzureEnvironment Cmdlet 來取得此帳戶的所有 Azure 環境。 然後,它會使用 Foreach-Object Cmdlet,在每個環境上使用 Name 參數來執行 Get-AzureEnvironment 命令 。 Name 參數的值 是 每個環境的 EnvironmentName 屬性。
如果沒有參數, Get-AzureEnvironment 只會取得環境選取的屬性。
參數
-Name
只取得指定的環境。 輸入環境名稱。 參數值會區分大小寫。 不允許萬用字元。
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Profile
指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設設定檔讀取。
Type: | AzureSMProfile |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
輸入
None
您可以透過屬性名稱將輸入管線傳送至此 Cmdlet,但不能依值傳送。
輸出
根據預設, Get-AzureEnvironment 會傳回自訂物件。
Microsoft.WindowsAzure.Commands.Utilities.Common.WindowsAzureEnvironment
當您使用 Name 參數執行 Get-AzureEnvironment 時,它會傳 回 WindowsAzureEnvironment 物件。