Thursday, June 30, 2016

Reset an Azure Active Directory (AAD) user account password to never Expires

I was using Azure account to automate my script to up/down VMs. once I noticed the bill is high and found the script not running. finally saw the error that password for the account I was using to authenticate was expired. so I though to make that account password not to expired.


here is how you can do.
you need to have Microsoft Online Services Sign-In Assistant for IT Professionals RTW (do 32 or 64 as per you machine)and Azure Active Directory Module for Windows PowerShell (64-bit version) or Azure Active Directory Module for Windows PowerShell (32-bit version).


once that is installed ( one error you can follow http://azurehospital.blogspot.sg/2016/06/azure-active-directory-module-import.html ) then run below command and it show all false as below
Get-MSOLUser | Select account@XXX.onmicrosoft.com, PasswordNeverExpires

Then run below
Set-MSOLUser -UserPrincipalName account@XXX.onmicrosoft.com -PasswordNeverExpires $true

if you run Get-MSOLUser you will get as few true.

Hope this helps.

Regards,
Yes.Sudhanshu

No comments:

Post a Comment