Last active
February 9, 2019 10:45
-
-
Save aaronparker/f9581559eb12c496155b3ac30e06fb92 to your computer and use it in GitHub Desktop.
Disable password expiration for an individual Azure AD account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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