Skip to content

Instantly share code, notes, and snippets.

@aaronparker
Last active February 9, 2019 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronparker/f9581559eb12c496155b3ac30e06fb92 to your computer and use it in GitHub Desktop.
Save aaronparker/f9581559eb12c496155b3ac30e06fb92 to your computer and use it in GitHub Desktop.
Disable password expiration for an individual Azure AD account
# Install the Azure AD module and log into Azure AD
Install-Module AzureADPreview
Connect-AzureAD
# Get details of the specific account
$user = Get-AzureADUser -SearchString "user@domain.com"
# View password policy on the acccount
$user | Select-Object @{N = "PasswordNeverExpires"; E = {$_.PasswordPolicies -contains "DisablePasswordExpiration"}}
# Disable the password expiration
Set-AzureADUser -ObjectId $user.ObjectId -PasswordPolicies DisablePasswordExpiration -Verbose
# Confirm that the password expiration policy is set
Get-AzureADUser -ObjectId $user.ObjectId | `
Select-Object @{N = "PasswordNeverExpires"; E = {$_.PasswordPolicies -contains "DisablePasswordExpiration"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment