none
How do i apply powershell to prevent my Azure account been expire. RRS feed

Answers

  • Are your accounts cloud-only accounts or are they synchronized from somewhere on-premise via e.g. DirSync / ADConnect?

    The cmdlets you're referring to can be run from any machine as long as it has the rights Powershell modules.

    If they're cloud-only accounts the following cmdlet can be run via PowerShell via any workstation to disable password expiration for ALL Azure AD accounts. Handle with care and also note this applies only to existing users and cloud-only accounts:

    # Login with an account that is allowed to modify AzureAD attributes.
    Connect-AzureAD 
    
    # Sets ALL accounts to "Password never expires"
    Get-AzureADUser -All $true | Set-AzureADUser -PasswordPolicies DisablePasswordExpiration 

    If you don't have the correct Powershell modules available on your workstation try using the Azure Cloud Shell

    ---On the road to MVP---

    • Marked as answer by Chang Hian Tuesday, September 10, 2019 4:12 AM
    Monday, September 9, 2019 1:33 PM

All replies

  • Are your accounts cloud-only accounts or are they synchronized from somewhere on-premise via e.g. DirSync / ADConnect?

    The cmdlets you're referring to can be run from any machine as long as it has the rights Powershell modules.

    If they're cloud-only accounts the following cmdlet can be run via PowerShell via any workstation to disable password expiration for ALL Azure AD accounts. Handle with care and also note this applies only to existing users and cloud-only accounts:

    # Login with an account that is allowed to modify AzureAD attributes.
    Connect-AzureAD 
    
    # Sets ALL accounts to "Password never expires"
    Get-AzureADUser -All $true | Set-AzureADUser -PasswordPolicies DisablePasswordExpiration 

    If you don't have the correct Powershell modules available on your workstation try using the Azure Cloud Shell

    ---On the road to MVP---

    • Marked as answer by Chang Hian Tuesday, September 10, 2019 4:12 AM
    Monday, September 9, 2019 1:33 PM
  • HI, mine is only cloud account with no on premise. Can you help me?

    I got this error, it does not seem to be working. as I am new to powershell as well.

    Tuesday, September 10, 2019 3:33 AM
  • Okay, so first install the AzureAD PowerShell module as described here

    install-module azuread
    import-module azuread



    ---On the road to MVP---

    • Marked as answer by Chang Hian Tuesday, September 10, 2019 4:10 AM
    • Unmarked as answer by Chang Hian Tuesday, September 10, 2019 4:12 AM
    Tuesday, September 10, 2019 3:41 AM