Microsoft365DSC remote name could not be resolved lyncdiscover
A couple of days ago I stumbled upon a LinkedIn post/article by Nik Charlebois about the Microsoft365DSC project. The first sentence on Github already sold the idea to me “This module allows organizations to automate the deployment, configuration, and monitoring of Microsoft 365 Tenants via PowerShell Desired State Configuration.”
After starting to playing with it a little I came across a nasty error that took me some time to resolve. To prevent others from also losing valuable time I thought it might be a good idea to document the steps.
My focus in general at the moment is on Microsoft Teams. With that in mind, I tried the Microsoft365DSC with the Teams components first. But every time I tried to export policies from Teams I got the following error:
System.Management.Automation.MethodInvocationException: Exception calling “GetResponse” with “0” argument(s): “The remote name could not be resolved: ‘lyncdiscover.thomy.tech’” —> System.Net.WebException: The remote name could not be resolved: ‘lyncdiscover.thomy.tech’
The first time it already was really late at night, or to be more precise early morning so I just let it slide and as always was pretty sure the error is not on my side. With all things in the cloud, one is quite fast with thinking “must be their fault, let’s try again tomorrow”. Turns out that’s rarely the case anyways and particular not in this one.
For all you Skype for Business and Lync veterans out there, this costs you just a smile, I know. For someone coming to Office365 with a SharePoint and developer background that isn’t so clear.
As you see in the error message I’m using a custom domain with Office365 called thomy.tech. There is a good article on how to set up all things needed for custom domains at https://docs.microsoft.com/en-us/microsoft-365/admin/setup/add-domain and one with more details on how to configure your DNS if you are not using a registrar Microsoft is connecting to at https://docs.microsoft.com/en-us/microsoft-365/admin/get-help-with-domains/create-dns-records-at-any-dns-hosting-provider?view=o365-worldwide
Browsing through this article you quickly spot this section:
As I did not follow all the steps in the article when adding my custom domain the whole idea of “saving time” by not following through bite me once again.
The technical reason for the error is, that the Microsoft365DSC uses a couple of different PowerShell modules to deliver its magic. One of them is the Skype for Business Online PowerShell module that is responsible for handling a lot in Teams as well:
I bought my domain from Namecheap but all the DNS settings there point to my AWS account. Yep, this page is brought to you by AWS not Azure, sorry. After adding all missing custom domain settings in my AWS dashboard the Microsoft365DSC connected to my teams tenant and I can continue with the next step.