Remove-AzureRmADUser
Deletes an active directory user.
Warning
The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.
Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.
Syntax
UPNOrObjectIdParameterSet (Default)
Remove-AzureRmADUser
-UPNOrObjectId <String>
[-PassThru]
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
UPNParameterSet
Remove-AzureRmADUser
-UserPrincipalName <String>
[-PassThru]
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ObjectIdParameterSet
Remove-AzureRmADUser
-ObjectId <Guid>
[-PassThru]
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
DisplayNameParameterSet
Remove-AzureRmADUser
-DisplayName <String>
[-PassThru]
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
InputObjectParameterSet
Remove-AzureRmADUser
-InputObject <PSADUser>
[-PassThru]
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Deletes an active directory user (work/school account also popularly known as org-id).
Examples
Example 1 - Remove a user by user principal name
PS C:\> Remove-AzureRmADUser -UserPrincipalName foo@domain.com
Removes the user with user principal name "foo@domain.com" from the tenant.
Example 2 - Remove a user by object id
PS C:\> Remove-AzureRmADUser -ObjectId 00001111-aaaa-2222-bbbb-3333cccc4444
Removes the user with object id '00001111-aaaa-2222-bbbb-3333cccc4444' from the tenant.
Example 3 - Remove a user by piping
PS C:\> Get-AzureRmADUser -ObjectId 00001111-aaaa-2222-bbbb-3333cccc4444 | Remove-AzureRmADUser
Gets the user with object id '00001111-aaaa-2222-bbbb-3333cccc4444' and pipes that to the Remove-AzureRmADUser cmdlet to remove the user from the tenant.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | cf |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Parameter properties
Type: | IAzureContextContainer |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | AzureRmContext, AzureCredential |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DisplayName
The display name of the user to be deleted.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
DisplayNameParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-Force
If specified, doesn't ask for confirmation for deleting the user.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-InputObject
The user object to be deleted.
Parameter properties
Type: | PSADUser |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
InputObjectParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ObjectId
The object id of the user to be deleted.
Parameter properties
Type: | Guid |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ObjectIdParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-PassThru
Specifying this will return true if the command was successful.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-UPNOrObjectId
The user principal name or the objectId of the user to be deleted.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
UPNOrObjectIdParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-UserPrincipalName
The user principal name of the user to be deleted.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | UPN |
Parameter sets
UPNParameterSet
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | wi |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
String
Guid
PSADUser
Parameters: InputObject (ByValue)