Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

[EXODkimSigningConfig] Issue when using Primary Domain Name (at least)

Open 1Dimitri opened this issue 9 months ago • 6 comments

Description of the issue

I was trying to create the equivalent of https://learn.microsoft.com/en-us/defender-office-365/email-authentication-dkim-configure?view=o365-worldwide#use-the-defender-portal-to-customize-dkim-signing-of-outbound-messages-using-the-onmicrosoftcom-domain

Initially, an Export of the resource doesn't show any instance When creating manually the instance, there's an error in the documentation which doesn't include Identity as key ( microsoft365dsc.com/resources/exchange/EXODkimSigningConfig ) --> Error Message (1)

When adding Identity, message (2) appears

However, The object with the correct identity shown in this issue appears when the operation asked in the portal are done and are waiting for the setting to be enabled twice, which happens after a couple of minutes only.

I'm wondering if there is a timer and a double call to Set-XXXX to be introduced in the resource based on the allusive nature of the documentation ("After a moment")

Microsoft 365 DSC Version

1.26.128.1

Which workloads are affected

SharePoint Online

The DSC configuration

# Generated with Microsoft365DSC version 1.26.128.1
# For additional information on how to use Microsoft365DSC, please visit https://aka.ms/M365DSC
param (
)

Configuration M365TenantConfig
{
    param (
    )

    $OrganizationName = $ConfigurationData.NonNodeData.OrganizationName

    Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.26.128.1'

    Node localhost
    {
        EXODkimSigningConfig "EXODkimSigningConfig-xxx.onmicrosoft.com"
        {
            AdminDisplayName       = "";
            ApplicationId          = $ConfigurationData.NonNodeData.ApplicationId;
            BodyCanonicalization   = "Relaxed";
            CertificateThumbprint  = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Enabled                = $True;
            Ensure                 = "Present";
            HeaderCanonicalization = "Relaxed";
            # Identity              = "xxx.onmicrosoft.com";
            KeySize                = 2048;
            TenantId               = $OrganizationName;
        }
    }
}

Verbose logs showing the problem

(1)
Could not find mandatory property Identity. Add this property and try again.
    + CategoryInfo          : ObjectNotFound: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 6
    + PSComputerName        : localhost

(2)
Write-ErrorMessage : ||Invalid domain name specified "xxx.onmicrosoft.com". Please specify tenant
name or valid accepted domain.
At D:\Users\Dimitri\AppData\Local\Temp\tmpEXO_a2allum0.0c1\tmpEXO_a2allum0.0c1.psm1:1191 char:13
+             Write-ErrorMessage $ErrorObject
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-DkimSigningConfig], ValidationException
    + FullyQualifiedErrorId : [Server=AM9PR10MB4118,RequestId=d6c8f6f0-4fd8-12c3-ae94-ba91310cdbe6,TimeStamp=Fri, 06 Feb 2026 12:45:16 GMT],Write-ErrorMessage

Environment Information + PowerShell Version


1Dimitri avatar Feb 10 '26 12:02 1Dimitri

I was able to successfully create the config, although I did it manually with the New-DkimSigningConfig cmdlet. At first, it wasn't visible when running Get-DkimSigningConfig, my guess is that this is because it's the default signing config and not "already created", which might be the requirement for the cmdlet to return it.

Once created, it was returned without errors and seemed to correspond exactly to what I configured. Haven't seen any issues with delayed configuration, for me it was almost instantaneously. The UI in the security center takes about 10-20 seconds until it reflects the updated values.

For the error message regarding xxx.onmicrosoft.com is invalid, is your onmicrosoft.com address registered as an accepted domain from Get-AcceptedDomain? That's a requirement for it, otherwise it won't work.

FabienTschanz avatar Feb 11 '26 14:02 FabienTschanz

Thanks, I'll try it after the other resources I have to validate during the project I'm assigned to

1Dimitri avatar Feb 12 '26 07:02 1Dimitri

@1Dimitri Just checked again and I receive the same error as you do when I specify a domain that is not a real accepted domain. Please make sure it is returned by Get-AcceptedDomain first before running the Dkim signing configuration. I don't think the code in the PR proposed by @mosesacknals139 is going to fix your issue, but do you mind giving it a try manually? Thanks.

FabienTschanz avatar Feb 17 '26 18:02 FabienTschanz

Yep, will try tomorrow if meetings don't eat up the day

1Dimitri avatar Feb 18 '26 15:02 1Dimitri

I can confirm that:

  • Once you are using the wizard, the xxx.onmicrosoft.com appears in the Get-AcceptedDomain output
  • I'm not able at this stage to test from scratch the proposed patch as the tenants I have are used for a project that has company visibility
  • I'm not able to mimic the original behavior as Remove-DkimSigningConfig does not work if the xxx.onmicrosoft.com is the sole domain Error Message: Write-ErrorMessage : ||The default DKIM signing config cannot be removed.

But from Fabian's assumptions, we may want to test Set-AcceptedDomain and then New-DkimSigningConfig then.

1Dimitri avatar Feb 20 '26 13:02 1Dimitri

I'm going to close this issue here. @1Dimitri if you want to remove the signing config, you can use the -Force parameter and it will work.

FabienTschanz avatar Mar 30 '26 20:03 FabienTschanz