By using this site, you agree to the Privacy Policy.
Accept
EnterinITEnterinITEnterinIT
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Reading: Azure AD Set password to never expire
Font ResizerAa
EnterinITEnterinIT
Font ResizerAa
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
  • WINDOWS
  • SCCM Query Collection List
Search
  • HOME
  • IT PRO
  • TECH
  • MICROSOFT
    • Azure
    • ConfigMgr/SCCM
    • DPM
    • Orchestrator
    • Hyper-V
    • Microsoft Edge Insider
    • MSI
    • Office 365
    • Office Insider
    • Power BI
    • Skype
    • SQL Server
    • Teams
  • WINDOWS
    • Windows Admin Center
    • Windows Client
    • Windows Server
  • SCCM Query Collection List
Azure

Azure AD Set password to never expire

Published: February 18, 2024
2 Min Read
SHARE

Azure AD Set password to never expire. Check & set a password to never expire on single or multiple Azure Active Directory users’ accounts.

Contents
CheckSingle UserMultiple UsersSetSingle UserMultiple Users

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"}
}
PowerShell

Example:

Get-AzureADUser -ObjectId user@enterinit.com | Select-Object UserPrincipalName, @{N="PasswordNeverExpires";E={$_.PasswordPolicies -contains "DisablePasswordExpiration"}
}
PowerShell

Multiple 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"}
}
}
PowerShell

NOTE: 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
PowerShell

Set

Single User

Set a password to never expire for a single user’s password:

Set-AzureADUser -ObjectId UPN -PasswordPolicies DisablePasswordExpiration
PowerShell

Example:

Set-AzureADUser -ObjectId user@enterinit.com -PasswordPolicies DisablePasswordExpiration
PowerShell

Multiple 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
}
PowerShell

NOTE: 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
TAGGED:Azure Active DirectoryCloudMicrosoft AzurePowerShell
Previous Article Office Insider 1911 for Windows
Next Article PowerShell 7 Preview
1 Comment 1 Comment
  • Rob says:
    June 3, 2024 at 2:52 pm

    very helpful . thank you.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Translation

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
by Transposh - translation plugin for wordpress

Popular Posts

System Requirements for Windows Server 2016
Windows Server
Configuration Manager Query Collection List
Configuration Manager Query Collection List
ConfigMgr
Structured/Managed Navigation enabled on Modern Pages in Classic Team Sites
Tech
SCCM Failed to get DP locations as the expected version from MP
ConfigMgr

Recent Posts

Installing and Configuring Fail2ban for SSH Protection on Ubuntu 24.04
Linux
Enabling and Configuring FirewallD on AlmaLinux
Linux
User Creation and SSH Key Setup in AlmaLinux
Linux
How to reset password on AlmaLinux
Linux

© 2023 EnterinIT

Go to mobile version
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?