Update-AzADUser

Updates an existing active directory user.

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

-Confirm

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

The credentials, account, tenant, and subscription used for communication with Azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisplayName

New display name for the user.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-EnableAccount

true for enabling the account; otherwise, false.

Type:System.Nullable`1[System.Boolean]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ForceChangePasswordNextLogin

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

The object representing the user to be updated.

Type:Microsoft.Azure.Commands.ActiveDirectory.PSADUser
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ObjectId

The object id of the user to be updated.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Password

New password for the user.

Type:SecureString
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-UPNOrObjectId

The user principal name or object id of the user to be updated.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-UserPrincipalName

The user principal name of the user to be updated.

Type:String
Aliases:UPN
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

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

String

Microsoft.Azure.Commands.ActiveDirectory.PSADUser

System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

SecureString

Outputs

Microsoft.Azure.Commands.ActiveDirectory.PSADUser