{"id":8420,"date":"2024-11-13T11:14:14","date_gmt":"2024-11-13T11:14:14","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=8420"},"modified":"2024-11-13T11:14:15","modified_gmt":"2024-11-13T11:14:15","slug":"using-microsoft-graph-to-set-users-in-azure-ad-to-force-change-their-password-next-login","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/using-microsoft-graph-to-set-users-in-azure-ad-to-force-change-their-password-next-login","title":{"rendered":"Using Microsoft Graph to Set Users in Azure AD to force change their Password Next Login"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code class=\"\"># Import the Microsoft Graph module\nImport-Module Microsoft.Graph\n\n# Connect to Microsoft Graph with the necessary permissions (User.ReadWrite.All or Directory.AccessAsUser.All)\nConnect-MgGraph -Scopes \"User.ReadWrite.All\"\n\n# Specify the user's UPN (User Principal Name)\n$userUPN = \"user@example.com\"\n\n# Retrieve the user ID for the UPN\n$user = Get-MgUser -UserId $userUPN\n\n# Force the user to change their password at next sign-in by updating the PasswordProfile\nUpdate-MgUser -UserId $user.Id -PasswordProfile @{ ForceChangePasswordNextSignIn = $true }\n\nWrite-Output \"Password change enforced for $userUPN\"<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8420","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8420","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=8420"}],"version-history":[{"count":1,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8420\/revisions"}],"predecessor-version":[{"id":8421,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/8420\/revisions\/8421"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=8420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=8420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=8420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}