Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Bug in configurecrmserversidesync.ps1 - Office 365 credentials aren't valid

(0) ShareShare
ReportReport
Posted on by

I spent half of my Saturday troubleshooting this problem only to learn a bug in the PS script put me on a wild-goose chase. While installing a new on-premises CRM 365 I came to the step to connect it to Exchange Online. When running the configurecrmserversidesync.ps1 script the process failed with the error "Office 365 credentials aren't valid." There's very little documentation on this script so to troubleshoot I had to guess at what logon format the script was expecting. When none of those varying formats worked, I tried many combinations of user permission configurations in Office 365 and continued to get this error. When I was about to throw my keyboard across the room in frustration I looked at the contents of the PS script file and I saw this line: 

if(!(Test-Connection -ComputerName $rootDomainName -Quiet)) { ExitWithError("Office 365 credentials aren’t valid.")

This line determines if the CRM server responds to ping, and if not, throws the error "Office 365 credentials aren't valid.". I enabled the rule in the CRM server firewall that allows ping and the script ran successfully. Literally a 30 second fix that I wasted hours on thanks to Microsoft sloppiness. You wouldn't see this kind of sloppiness from Google. 

*This post is locked for comments

  • Neal Santin Profile Picture
    Neal Santin 106 on at
    RE: Bug in configurecrmserversidesync.ps1 - Office 365 credentials aren't valid

    There is also another bug in which it checks if the user is a global admin, however this fails if the user is a global admin AND any other admin.

    need to change this line: 

    if(!$msolUserRole -Or $msolUserRole.ObjectId -ne '62e90394-69f5-4237-9190-012177145e10')

    to this: 

    if(!$msolUserRole -Or $msolUserRole.ObjectId -notcontains '62e90394-69f5-4237-9190-012177145e10')

  • RE: Bug in configurecrmserversidesync.ps1 - Office 365 credentials aren't valid

    Joe,

    It's been almost a year since i did that but I think this page helped me: 

    stackoverflow.com/.../msonline-cant-be-imported-on-powershell-connect-msolservice-error

  • Joe Woltering Profile Picture
    Joe Woltering 12,159 on at
    RE: Bug in configurecrmserversidesync.ps1 - Office 365 credentials aren't valid

    Hi Rodger,

    I'm running into a different issue when trying to run the script. I get to the end and enter in all the relevant info and then I get a message saying that the MSOnlineExtended module for powershell is required but I see no way to install it and there is little to no documentation on this module. It almost appears that it is no longer available. Any ideas?

  • Verified answer
    RE: Bug in configurecrmserversidesync.ps1 - Office 365 credentials aren't valid

    Ensure you can ping the on-prem CRM server.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,253 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans