Skip to main content

Get-MsIdAzureUsers

SYNOPSIS

Returns a list of users that have signed into the Azure portal, Azure CLI, or Azure PowerShell over the last 30 days by querying the sign-in logs.

If your tenant is a Microsoft Entra ID Free, the sign-in logs need to be downloaded from

  • Required permission scopes: Directory.Read.All, AuditLog.Read.All
  • Required Microsoft Entra role: Global Reader

SYNTAX

Get-MsIdAzureUsers [[-SignInsJsonPath] <String>] [[-Days] <Int32>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]

DESCRIPTION

  • Entra ID free tenants have access to sign-in logs for the last 7 days.
  • Entra ID premium tenants have access to sign-in logs for the last 30 days.

EXAMPLES

EXAMPLE 1

Connect-MgGraph -Scopes Directory.Read.All, AuditLog.Read.All
PS > Get-MsIdAzureUsers

Queries all available logs and returns all the users that have signed into Azure.

EXAMPLE 2

Get-MsIdAzureUsers -Days 3

Queries the logs for the last three days and returns all the users that have signed into Azure during this period.

EXAMPLE 3

Get-MsIdAzureUsers -SignInsJsonPath ./signIns.json

Uses the sign-ins json file downloaded from the Microsoft Portal and returns all the users that have signed into Azure during this period.

PARAMETERS

-SignInsJsonPath

Optional. Path to the sign-ins JSON file. If provided, the report will be generated from this file instead of querying the sign-ins.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Days

Number of days to query sign-in logs. Defaults to 30 days for premium tenants and 7 days for free tenants

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES