Update-AzADUser
Updates an existing active directory user.
Warning
There are upcoming breaking changes in this cmdlet. These changes are currently in preview with Az.Resources version 5.0.0-preview. They will become generally available with our next major release of the Az PowerShell module, version 7.x in December of 2021. For more information, see Azure AD to Microsoft Graph migration changes in Azure PowerShell.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
Update-AzADUser
-UPNOrObjectId <String>
[-DisplayName <String>]
[-EnableAccount <Boolean>]
[-Password <SecureString>]
[-ForceChangePasswordNextLogin]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Update-AzADUser
-UserPrincipalName <String>
[-DisplayName <String>]
[-EnableAccount <Boolean>]
[-Password <SecureString>]
[-ForceChangePasswordNextLogin]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Update-AzADUser
-ObjectId <String>
[-DisplayName <String>]
[-EnableAccount <Boolean>]
[-Password <SecureString>]
[-ForceChangePasswordNextLogin]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Update-AzADUser
-InputObject <PSADUser>
[-DisplayName <String>]
[-EnableAccount <Boolean>]
[-Password <SecureString>]
[-ForceChangePasswordNextLogin]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Updates an existing active directory user (work/school account also popularly known as org-id). For more information: https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/users-operations#UpdateUser
Examples
Example 1: Update the display name of a user using object id
PS C:\> Update-AzADUser -ObjectId 155a5c10-93a9-4941-a0df-96d83ab5ab24 -DisplayName MyNewDisplayName
Updates the display name of the user with object id '155a5c10-93a9-4941-a0df-96d83ab5ab24' to be 'MyNewDisplayName'.
Example 2: Update the display name of a user using user principal name
PS C:\> Update-AzADUser -UserPrincipalName foo@domain.com -DisplayName MyNewDisplayName
Updates the display name of the user with user principal name 'foo@domain.com' to be 'MyNewDisplayName'.
Example 3: Update the display name of a user using piping
PS C:\> Get-AzADUser -ObjectId 155a5c10-93a9-4941-a0df-96d83ab5ab24 | Update-AzADUser -DisplayName MyNewDisplayName
Gets the user with object id '155a5c10-93a9-4941-a0df-96d83ab5ab24' and pipes that to the Update-AzADUser cmdlet to update the display name of that user to 'MyNewDisplayName'.
Parameters
Prompts you for confirmation before running the cmdlet.
| Type: | SwitchParameter |
| Aliases: | cf |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
New display name for the user.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
true for enabling the account; otherwise, false.
| Type: | Nullable<T>[Boolean] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
It must be specified if the user should change the password on the next successful login. Only valid if password is updated otherwise it will be ignored.
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The object representing the user to be updated.
| Type: | PSADUser |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The object id of the user to be updated.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
New password for the user.
| Type: | SecureString |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The user principal name or object id of the user to be updated.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The user principal name of the user to be updated.
| Type: | String |
| Aliases: | UPN |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
| Type: | SwitchParameter |
| Aliases: | wi |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Inputs
Nullable<T>[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]