[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:

SNAGHTML290be6c4

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

SNAGHTML291611da

Execute the following command to have the password policy:

Get-MsolPasswordPolicy –DomainName domain.onmicrosoft.com

SNAGHTML2919eb63

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

SNAGHTML291ad17d

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

SNAGHTML291d42ac

Replace with your own values. My new values are:

SNAGHTML291f8624

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

SNAGHTML2920b935

The result can be displayed with the following command:

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

SNAGHTML2921f985

I hope that this quick explanation will help you Sourire