Azure AD exclude user from password experation policy

Connect to Azure AD with PowerShell:


Now we would like to get an overview of all users, run the following command:


If you have the UserPrincipalName or email address we might shorten the list to just that single user bij adding a filter:

Get-AzureADUser -ObjectId <UserPrincipleName> 

Next task is to link the default password policy without a password expiration to this user. Run the following command:

Set-AzureADUser -ObjectId <UserPrincipalName> -PasswordPolicies DisablePasswordExpiration

Once this has been completed, verify if the policy has been set correctly with the following command:

Get-AzureADUser -ObjectId <UserPrincipalName> | fl UserPrincipalName,passwordpolicies

Connect to Azure AD with PowerShell

On your Windows device open a PowerShell prompt. To be able to connect we first need to make sure that the PowerShell module has been installed. Run the following command and confirm all questions with yes

Install-Module -Name AzureAD

Now we are ready to connect to Azure AD. Because of the different Office 365 clouds, it might be required to add the option -AzureEnvironmentName. Please review your environment below, by default you are hosted in Worldwide.

Office 365 cloud Command
Office 365 Worldwide (+GCC) Connect-AzureAD
Office 365 operated by 21 Vianet Connect-AzureAD
-AzureEnvironmentName AzureChinaCloud
Office 365 Germany Connect-AzureAD
-AzureEnvironmentName AzureGermanyCloud
Office 365 U.S. Government Connect-AzureAD
-AzureEnvironmentName AzureUSGovernment

Run the command:


You will now be prompted with a sign-in prompt. After sign-in you are connected

Log in screen