[Azure Automation] Error Validating Credentials

January 29, 2016 at 7:00 am in Azure, Azure Active Directory, Azure Automation, Microsoft by Florent

Today, one of my client had the following error in Azure Automation:


After reflecting about where could be the problem, I thought that in Azure AD, passwords must have a expiration date. I found this link: https://msdn.microsoft.com/en-us/library/azure/jj943764.aspx?f=255&MSPPError=-2147217396

In fact, the password expire after 90 days by default and I didn’t received an email because my account didn’t have an email address set.

I logged in with this user to Azure Active Directory in PowerShell with the following commands (I updated my password because the old password wasn’t working anymore):

$credentials = Get-Credential automation@domain.onmicrosoft.com
Connect-MsolService -Credential $credentials


Execute the following command to have the password policy:

Get-MsolPasswordPolicy –DomainName domain.onmicrosoft.com


If you have the above error, check if the acocunt is Global Admin in your Azure AD:


You can now update the settings for the Password Validity and the Notifications in your Azure AD, with the following command:

Set-MsolPasswordPolicy –DomainName domain.onmicrosoft.com –ValidityPeriod 180 –NotificationDays 30


Replace with your own values. My new values are:


SIf you want to set the password to Never Expire, you can do it with the following command:

Set-MsolUser -UserPrincipalName automation@domain.onmicrosoft.com -PasswordNeverExpires $True


The result can be displayed with the following command:

Get-MsolUser | Where {$_.PasswordNeverExpires -eq $True}


I hope that this quick explanation will help you Sourire