Get-AzureAccount

取得 Azure PowerShell 可用的 Azure 帳戶。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

Get-AzureAccount
   [-Name <String>]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

Get-AzureAccount Cmdlet 會取得 Windows PowerShell 可用的 Azure 帳戶。 若要讓您的帳戶可供 Windows PowerShell 使用,請使用 Add-AzureAccountImport-PublishSettingsFile Cmdlet。

範例

範例 1:取得所有帳戶

PS C:\> Get-AzureAccount

Name                         ActiveDirectories
----                         -----------------
contosoadmin@outlook.com     {{ ActiveDirectoryTenantId = abcde5cd-bcc3-441a-bd86-e6a...
contosotest1@outlook.com     {{ ActiveDirectoryTenantId = aaeabcde-386c-4466-bf70-794...

此命令會取得與指定使用者相關聯的所有帳戶。

範例 2:依名稱取得帳戶

PS C:\> Get-AzureAccount -Name contosoadmin@outlook.com

Name                         ActiveDirectories
----                         -----------------
contosoadmin@outlook.com     {{ ActiveDirectoryTenantId = abcde5cd-bcc3-441a-bd86-e6a...

此命令會取得 ContosoAdmin 帳戶。

參數

-Name

只取得指定的帳戶。 預設值是 Windows PowerShell 可用的所有帳戶。 輸入帳戶名稱。 Name 值會區分大小寫。 不允許通配符。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

None

您無法使用管線將輸入傳送至此 Cmdlet。

輸出

None

此 Cmdlet 不會傳回任何輸出。