Get-AzureAccount

Gets Azure accounts that are available to Azure PowerShell.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

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

Description

The Get-AzureAccount cmdlet gets the Azure accounts that are available to Windows PowerShell. To make your accounts available to Windows PowerShell, use the Add-AzureAccount or Import-PublishSettingsFile cmdlets.

Examples

Example 1: Get all accounts

PS C:\> Get-AzureAccount

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

This command gets all accounts associated with the specified user.

Example 2: Get an account by name

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

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

This command gets the ContosoAdmin account.

Parameters

-Name

Gets only the specified account. The default is all accounts that are available to Windows PowerShell. Enter the account name. The Name value is case-sensitive. Wildcards are not permitted.

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

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

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

Inputs

None

You cannot pipe input to this cmdlet.

Outputs

None

This cmdlet does not return any output.