This produces the following record
selector2-example-co.nz._domainkey.exampleconz.onmicrosoft.com.
Expected behavior
Microsoft expects the record to be formatted as below
selector2-example-co-nz._domainkey.exampleconz.onmicrosoft.com.
Workaround
I have overridden the M365_BUILDER function in my build of DNSControl with the only change being the highlighted line below
if (!value.domainGUID) {
// Does not work with dashes in domain name.
// Microsoft uses its own, (probably) deterministic algorithm to transform these domains.
// Unfortunately, underlying algorithm is not known to us.
if (name.indexOf('-') !== -1) {
throw (
'M365_BUILDER requires domainGUID for domains with dashes: ' +
name
);
}
value.domainGUID = name.replace(/\./g, '-'); <- Changed from value.domainGUID = name.replace('.', '-');
}
Changing to the Regex pattern now produces the expected output below
selector2-example-co-nz._domainkey.exampleconz.onmicrosoft.com.
DNS Provider
Cloudflare
Additional context
I have also tested this for domains deeper than second level, I.E (marketing.example.co.nz)
With the regex above this will produce selector2-marketing-example-co-nz._domainkey.exampleconz.onmicrosoft.com.
This matched what Microsoft requested
Describe the bug Using the production version of the M365_BUILDER in v4.14.0 produces incorrect output with second level domains
To Reproduce Steps to reproduce the behavior: Below is an example of an affected record
This produces the following record
selector2-example-co.nz._domainkey.exampleconz.onmicrosoft.com.
Expected behavior Microsoft expects the record to be formatted as below
selector2-example-co-nz._domainkey.exampleconz.onmicrosoft.com.
Workaround I have overridden the M365_BUILDER function in my build of DNSControl with the only change being the highlighted line below
Changing to the Regex pattern now produces the expected output below
selector2-example-co-nz._domainkey.exampleconz.onmicrosoft.com.
DNS Provider Cloudflare
Additional context I have also tested this for domains deeper than second level, I.E (marketing.example.co.nz) With the regex above this will produce
selector2-marketing-example-co-nz._domainkey.exampleconz.onmicrosoft.com.
This matched what Microsoft requested