Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OrgSettings PW Policy #2665

Open
michaelbaltes opened this issue Dec 13, 2022 · 2 comments
Open

OrgSettings PW Policy #2665

michaelbaltes opened this issue Dec 13, 2022 · 2 comments
Labels
Enhancement New feature or request Office 365 Admin

Comments

@michaelbaltes
Copy link

To set Office 365 Passwords to Expire, use the Microsoft 365 Admin Center:

  1. Expand Settings then select the Org Settings subcategory.
  2. Click on Security & privacy.
  3. Select Password expiration policy.
  4. If the Set user passwords to expire after a number of days box is checked,
    uncheck it.
  5. Click Save.
    To set Office 365 Passwords Are Not Set to Expire, use the Microsoft Online
    PowerShell Module:
  6. Connect to Microsoft Online service using Connect-MSOLService.
  7. Run the following Microsoft Online PowerShell command:
    Set-MsolPasswordPolicy -ValidityPeriod 2147483647 -DomainName -
    NotificationDays 30
@malauter malauter added the Enhancement New feature or request label Dec 13, 2022
@NikCharlebois
Copy link
Collaborator

Unfortunately there are no Graph APIs available for these settings just yet. We made a decision a while back not to call into MSOOnline under the cover. We will leave this one on the backlog until a Graph API equivalent becomes available.

//cc @darrelmiller for visibility

@SteveMutungi254
Copy link

This should work:

Import-Module Microsoft.Graph.Identity.DirectoryManagement

Connect-MgGraph  -Scopes 'Domain.ReadWrite.All'

$domainId = "contoso.com"
$params = @{
	passwordValidityPeriodInDays = 90
	passwordNotificationWindowInDays = 15
}

Update-MgDomain -DomainId $domainId -BodyParameter $params

Where:

passwordValidityPeriodInDays indicates the length of time that a password remains valid before it must be changed. passwordNotificationWindowInDays indicates the number of days before the password expiration date that will trigger when users will receive their first notification that their password will soon expire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Office 365 Admin
Projects
None yet
Development

No branches or pull requests

5 participants