> ## Documentation Index
> Fetch the complete documentation index at: https://ps365.clidsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get-MgLAPSPassword

## SYNOPSIS

Retrieves the LAPS password for a Microsoft Entra ID device.

## SYNTAX

### Default (Default)

```powershell theme={null}
Get-MgLAPSPassword [-DeviceName <String>] [-DeviceID <String>] [-ShowPassword] [-IncludeHistory]
 [-RunFromAzureAutomation] [-ProgressAction <ActionPreference>] [<CommonParameters>]
```

### KeyVault

```powershell theme={null}
Get-MgLAPSPassword [-DeviceName <String>] [-DeviceID <String>] [-ShowPassword] [-IncludeHistory]
 [-RunFromAzureAutomation] [-BackupToKeyVault] -KeyVaultName <String> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]
```

## 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

```powershell theme={null}
Get-MgLAPSPassword
```

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

### EXAMPLE 2

```powershell theme={null}
Get-MgLAPSPassword -DeviceName "DESKTOP-ABC123"
```

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

### EXAMPLE 3

```powershell theme={null}
Get-MgLAPSPassword -DeviceID "12345678-1234-1234-1234-123456789012"
```

Retrieves metadata (no password) for the specified device.

### EXAMPLE 4

```powershell theme={null}
Get-MgLAPSPassword -ShowPassword
```

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

### EXAMPLE 5

```powershell theme={null}
Get-MgLAPSPassword -DeviceID "12345678-1234-1234-1234-123456789012" -ShowPassword
```

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

### EXAMPLE 6

```powershell theme={null}
Get-MgLAPSPassword -DeviceID "12345678-1234-1234-1234-123456789012" -ShowPassword -IncludeHistory
```

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

### EXAMPLE 7

```powershell theme={null}
Get-MgLAPSPassword -BackupToKeyVault -KeyVaultName "MyLAPSVault"
```

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

### EXAMPLE 8

```powershell theme={null}
Get-MgLAPSPassword -DeviceID "12345678-1234-1234-1234-123456789012" -BackupToKeyVault -KeyVaultName "MyLAPSVault"
```

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

### EXAMPLE 9

```powershell theme={null}
Get-MgLAPSPassword -RunFromAzureAutomation -BackupToKeyVault -KeyVaultName "MyLAPSVault"
```

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.

```yaml theme={null}
Type: String
Parameter Sets: (All)
Aliases:

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

### -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.

```yaml theme={null}
Type: String
Parameter Sets: (All)
Aliases:

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

### -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.

```yaml theme={null}
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

### -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.

```yaml theme={null}
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

### -RunFromAzureAutomation

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

```yaml theme={null}
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

### -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.

```yaml theme={null}
Type: SwitchParameter
Parameter Sets: KeyVault
Aliases:

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

### -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.

```yaml theme={null}
Type: String
Parameter Sets: KeyVault
Aliases:

Required: True
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](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

## NOTES

Requires the DeviceLocalCredential.Read.All and Device.Read.All permissions in Microsoft Entra ID.

## RELATED LINKS

[https://ps365.clidsys.com/docs/commands/Get-MgLAPSPassword](https://ps365.clidsys.com/docs/commands/Get-MgLAPSPassword)
