The Remove-MgUserExtension cmdlet is used in Microsoft Graph PowerShell to delete extension attributes from a user object in Microsoft Entra ID.
Extensions are custom attributes added to Microsoft Entra ID user objects for storing additional information. Over time, some of these attributes may become obsolete, redundant, or no longer relevant to business processes. The Remove-MgUserExtension cmdlet is particularly useful for maintaining data hygiene by ensuring that only necessary and up-to-date attributes are retained, reducing clutter and minimizing security risks associated with storing unnecessary user data.
Before using the Remove-MgUserExtension cmdlet, ensure the following:
Install-Module Microsoft.Graph -Scope CurrentUser
Here's how you can use the Remove-MgUserExtension cmdlet to remove user extensions in Microsoft Entra ID:
Remove-MgUserExtension
-UserId <String>
-ExtensionId <String>
Example 1: Remove a specific user extension
Remove-MgUserExtension
-UserId "john@savvy.com"
-ExtensionId"extensionAttribute1"
The following are some parameters that can be used along with the Remove-MgUserExtension cmdlet:
| Parameters | Description |
|---|---|
| -ExtensionId | This parameter allows you to specify the unique ID of the extension you would like to remove. |
| -WhatIf | This parameter allows you to simulate the command without executing it. |
| -UserId | This parameter allows you to specify the user ID, such as UPN, object ID, or other identifiers. |
| -Confirm | This parameter asks for confirmation before executing the cmdlet. |
ADManager Plus, an IGA solution with a user-friendly interf ace, bulk management, and automation capabilities, helps administrators overcome the limitations of Graph PowerShell in managing Microsoft Entra ID. With comprehensive reporting, multi-level workflows, and seamless user management capabilities, it enhances efficiency, security, and compliance for IT teams.