Skip to content

[v2.27.0]Update-MGUser password setting still not working #3289

@wongcc2012

Description

@wongcc2012

Describe the bug

$UPN = "[email protected]"

$UserPassProfile = @{
Password = 'XXXXXX' #Define password IN CSV file
ForceChangePasswordNextSignIn = $False #Change password True or False
}

Update-MgUser -UserId $UPN -PasswordProfile $UserPassProfile

Expected behavior

Able to update user password and force change = false

How to reproduce

Run the command

SDK Version

2.27.0

Latest version known to work for scenario above?

2.25.0

Known Workarounds

use a working version

Debug output


Windows PowerShell transcript start
Start time: 20250422194504
Username: KW-W11-24H2-01\Administrator
RunAs User: KW-W11-24H2-01\Administrator
Configuration Name:
Machine: KW-W11-24H2-01 (Microsoft Windows NT 10.0.26100.0)
Host Application: PowerShell.exe -noexit -command Set-Location -literalPath C:\Users\Administrator\Desktop\PS-O365-UAT
Process ID: 9752
PSVersion: 5.1.26100.2161
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.26100.2161
BuildVersion: 10.0.26100.2161
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1


Transcript started, output file is 20250422b-MGPWD.log
PS C:\Users\Administrator\Desktop\PS-O365-UAT> cls
PS C:\Users\Administrator\Desktop\PS-O365-UAT> Get-InstalledModule

Version Name Repository Description


2.0.2.182 AzureAD PSGallery Azure Active Directory V2 General Availability M...
3.7.2 ExchangeOnlineManagement PSGallery This is a General Availability (GA) release of t...
2.27.0 Microsoft.Graph PSGallery Microsoft Graph PowerShell module
2.27.0 Microsoft.Graph.Applications PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Authentication PSGallery Microsoft Graph PowerShell Authentication Module.
2.27.0 Microsoft.Graph.BackupRestore PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Bookings PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Calendar PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.ChangeNotifications PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.CloudCommunications PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Compliance PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.CrossDeviceExper... PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.DeviceManagement PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.DeviceManagement... PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.DeviceManagement... PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.DeviceManagement... PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Devices.CloudPrint PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Devices.Corporat... PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Devices.ServiceA... PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.DirectoryObjects PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Education PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Files PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Groups PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Identity.Directo... PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Identity.Governance PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Identity.Partner PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Identity.SignIns PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Mail PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Notes PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.People PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.PersonalContacts PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Planner PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Reports PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.SchemaExtensions PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Search PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Security PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Sites PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Teams PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Users PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Users.Actions PSGallery Microsoft Graph PowerShell Cmdlets
2.27.0 Microsoft.Graph.Users.Functions PSGallery Microsoft Graph PowerShell Cmdlets
6.9.0 MicrosoftTeams PSGallery Microsoft Teams cmdlets module for Windows Power...
1.1.183.81 MSOnline PSGallery Microsoft Azure Active Directory Module for Wind...

PS C:\Users\Administrator\Desktop\PS-O365-UAT> $UPN = "[email protected]"
PS C:\Users\Administrator\Desktop\PS-O365-UAT> $UserPassProfile = @{
Password = "EnterPass!!12345" #Define password
ForceChangePasswordNextSignIn = $False #Change password True or False
}
PS C:\Users\Administrator\Desktop\PS-O365-UAT> Update-MgUser -UserId $UPN -PasswordProfile $UserPassProfile
PS C:\Users\Administrator\Desktop\PS-O365-UAT> Update-MgUser -UserId $UPN -PasswordProfile $UserPassProfile -Debug
DEBUG: [CmdletBeginProcessing]: - Update-MgUser begin processing with parameterSet 'UpdateExpanded'.
Confirm
Continue with this operation?
&Yes Yes to &All &Halt Command &Suspend
A
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientSecret', ContextScope: 'Process', AppName: 'Powershell Graph API 2023xxxx'.
DEBUG: [Authentication]: - Scopes: [User.ReadWrite.All, Domain.ReadWrite.All, DelegatedPermissionGrant.ReadWrite.All, Application.ReadWrite.All, Directory.ReadWrite.All, User.EnableDisableAccount.All, DeviceManagementServiceConfig.ReadWrite.All, Organization.ReadWrite.All, DeviceManagementManagedDevices.ReadWrite.All, User.ManageIdentities.All, DeviceManagementConfiguration.ReadWrite.All, DeviceManagementApps.ReadWrite.All].
Confirm
Are you sure you want to perform this action?
Performing the operation "Update-MgUser_UpdateExpanded" on target "Call remote 'PATCH /users/{user-id}' operation".
&Yes Yes to &All &No No to A&ll &Suspend
A
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PATCH

Absolute Uri:
https://graph.microsoft.com/v1.0/users/[email protected]

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-US),PowerShell/5.1.26100.2161
SdkVersion : graph-powershell/2.27.0
client-request-id : b2f1cc1e-ee26-441f-9e6a-610f4983c6f2

Body:
{
"passwordProfile": {
"forceChangePasswordNextSignIn": false
}
}
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NoContent

Headers:
Strict-Transport-Security : max-age=31536000
request-id : d1c26999-b295-4adc-aff9-d6bab54b5416
client-request-id : b2f1cc1e-ee26-441f-9e6a-610f4983c6f2
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Southeast Asia","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"SI2PEPF00005711"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Tue, 22 Apr 2025 11:45:38 GMT

Body:
DEBUG: [CmdletEndProcessing]: - Update-MgUser end processing.

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions