Skip to main content

SYNOPSIS

Retrieves the LAPS password for a Microsoft Entra ID device.

SYNTAX

Default (Default)

KeyVault

DESCRIPTION

Gets the Windows Local Administrator Password Solution (LAPS) password for one or all devices in Microsoft Entra ID (formerly Azure AD). By default, only metadata is returned (no password). Use -ShowPassword to retrieve the password in plain text. Passwords can optionally be backed up to an Azure Key Vault.

EXAMPLES

EXAMPLE 1

Retrieves metadata (no password) for all devices with LAPS configured.

EXAMPLE 2

Retrieves metadata (no password) for the device with the specified display name.

EXAMPLE 3

Retrieves metadata (no password) for the specified device.

EXAMPLE 4

Retrieves the current LAPS password in plain text for all devices.

EXAMPLE 5

Retrieves the current LAPS password in plain text for the specified device.

EXAMPLE 6

Retrieves the current and historical LAPS passwords for the specified device. The IsCurrent property indicates which entry is the active password.

EXAMPLE 7

Backs up LAPS passwords for all devices to Azure Key Vault.

EXAMPLE 8

Backs up the LAPS password for the specified device to Azure Key Vault.

EXAMPLE 9

Backs up LAPS passwords for all devices using managed identity authentication. Suitable for Azure Automation runbooks.

PARAMETERS

-DeviceName

Filter results to a specific device by its display name. Cannot be used together with DeviceID parameter.

-DeviceID

Filter results to a specific device by its Entra ID (Azure AD) object ID. If not specified, retrieves LAPS passwords for all devices. Cannot be used together with DeviceName parameter.

-ShowPassword

Retrieve and display the LAPS password in plain text. By default, only metadata (expiration time, etc.) is returned. Use with caution, as this will expose the password in the console output.

-IncludeHistory

Include previous LAPS passwords in the output, in addition to the current one. Only applicable when -ShowPassword or -BackupToKeyVault is specified. Has no effect otherwise. The output includes an IsCurrent property to identify the active password.

-RunFromAzureAutomation

Use managed identity authentication instead of interactive authentication. Suitable for Azure Automation runbooks, Azure Functions, or VMs with managed identity enabled.

-BackupToKeyVault

Enable backup of LAPS passwords to Azure Key Vault. Must be used together with -KeyVaultName. The secret name is the device name; the Content Type field contains the account name and backup date.

-KeyVaultName

Name of the Azure Key Vault to back up LAPS passwords to. Mandatory when -BackupToKeyVault is specified. Requires the Az.KeyVault module and appropriate permissions.

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

Requires the DeviceLocalCredential.Read.All and Device.Read.All permissions in Microsoft Entra ID. https://ps365.clidsys.com/docs/commands/Get-MgLAPSPassword