Azure AD Set password to never expire. Check & set a password to never expire on single or multiple Azure Active Directory users’ accounts.
NOTE: This applies only to cloud-based accounts, if you are synching accounts from the local Active Directory to Azure AD, you need to set passwords to never expire on the local Active Directory account.
Check
Single User
Check expiration policies for a single user’s password:
Get-AzureADUser -ObjectId UPN | Select-Object UserPrincipalName, @{N="PasswordNeverExpires";E={$_.PasswordPolicies -contains "DisablePasswordExpiration"}
}
PowerShellExample:
Get-AzureADUser -ObjectId user@enterinit.com | Select-Object UserPrincipalName, @{N="PasswordNeverExpires";E={$_.PasswordPolicies -contains "DisablePasswordExpiration"}
}
PowerShellMultiple Users
Check expiration policies for multiple user’s passwords using a CSV input file:
Import-CSV azureadusers.csv | ForEach {
Get-AzureADUser -ObjectId $_.AzureADUPN | Select-Object UserPrincipalName,@{N="PasswordNeverExpires";E={$_.PasswordPolicies -contains "DisablePasswordExpiration"}
}
}
PowerShellNOTE: The CSV file must contain the User Principal Name (UPN) of the Azure AD users:
AzureAD
user1@enterinit.com
user2@enterinit.com
user3@enterinit.com
PowerShellSet
Single User
Set a password to never expire for a single user’s password:
Set-AzureADUser -ObjectId UPN -PasswordPolicies DisablePasswordExpiration
PowerShellExample:
Set-AzureADUser -ObjectId user@enterinit.com -PasswordPolicies DisablePasswordExpiration
PowerShellMultiple Users
Set a password to never expire for multiple user’s passwords using a CSV input file:
Import-CSV azureadusers.csv | ForEach {
Set-AzureADUser -ObjectId $_.AzureADUPN -PasswordPolicies DisablePasswordExpiration
}
PowerShellNOTE: Check the expiry has been set correctly by running Get-AzureADUser:
Import-CSV azureadusers.csv | ForEach { Get-AzureADUser -ObjectId $_.AzureADUPN | Select-Object UserPrincipalName, ` @{N="PasswordNeverExpires";E={$_.PasswordPolicies -contains "DisablePasswordExpiration"}
}
}
PowerShell
very helpful . thank you.