2

For the past while, I’ve been learning PowerShell to administrate our Office 365 tenancy instead of using the web interface.

After adding a new domain and confirming ownership of the domain name (all done through PowerShell), I was wondering if there’s a cmdlet that can be used to obtain the zone records that should be configured for a domain that is to be managed by Office 365.

Gather the information you need to create Office 365 DNS records explains how to obtain this information using the web interface but I’d prefer to do as much as possible using PowerShell.

At the moment, I can use the Get-DkimSigningConfig to determine the correct CNAME record to enable DKIM, e.g.,

Get-DkimSigningConfig -Identity contoso.com | fl Selector?CNAME

This should generally be of the form selector1-contoso-com._domainkey.contoso.onmicrosoft.com but I found that for one of our managed domains the DKIM CNAME had to be set to selector1-contoso-com0i._domainkey.contoso.onmicrosoft.com (an additional 0i).

For the MX record, I’d expect it to be contoso-com.mail.protection.outlook.com but I’d like to be certain so I’m wondering if there’s a PowerShell cmdlet or Azure object that lists the DNS records that should be configured for a managed domain (in particular what to use for the MX record).

I spent a lot of time searching the web and Microsoft’s own documentation but I only found references to how to determine this information using the web interface.

Anthony Geoghegan
  • 2,875
  • 1
  • 24
  • 34

1 Answers1

3

A little bit late, but for future reference, this is now possible using the AzureAD module:

Get-AzureADDomainServiceConfigurationRecord -Name mydomain.com

Or if you want to get only the MX record:

(Get-AzureADDomainServiceConfigurationRecord -Name mydomain.com | `
           where RecordType -eq MX).MailExchange

You can also set the supported services for a newly added domain using:

Set-AzureADDomain -Name mydomain.com -SupportedServices Email, OfficeCommunicationsOnline, Intune
Ioan Agopian
  • 146
  • 3
  • Thanks for answering. Unfortunately, since asking this question, I've changed jobs (to a Unix-only role) so I can't verify it. From a cursory look at the documentation, it looks like this will do the job so I've upvoted and accepted this answer. Hopefully, this can help others administer their Azure/365 tenancies. – Anthony Geoghegan Jan 16 '20 at 18:22
  • I was able to use these commands and they work. Thank you for the -SupportedServices argument. That was what I was missing. – Wayne Jul 24 '20 at 17:59