microsoft/Microsoft365DSC

Problem with uploading exchange configuration

jcdenboer opened this issue · 0 comments

Description of the issue

When I try to upload the configuration file I get the following error, couldn't find any resolution on the internet.

image

Microsoft 365 DSC Version

1.24.612.1

Which workloads are affected

Exchange Online

The DSC configuration

# Generated with Microsoft365DSC version 1.24.612.1
# For additional information on how to use Microsoft365DSC, please visit https://aka.ms/M365DSC
param (
    [parameter()]
    [System.Management.Automation.PSCredential]
    $Credential
)

Configuration M365TenantConfig
{
    param (
        [parameter()]
        [System.Management.Automation.PSCredential]
        $Credential
    )

    if ($null -eq $Credential)
    {
        <# Credentials #>
        $Credscredential = Get-Credential -Message "Credentials"

    }
    else
    {
        $CredsCredential = $Credential
    }

    $OrganizationName = $CredsCredential.UserName.Split('@')[1]

    Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.24.612.1'

    Node localhost
    {
        EXOAntiPhishPolicy "EXOAntiPhishPolicy--Anti Phishing"
        {
            AdminDisplayName                              = "";
            AuthenticationFailAction                      = "Quarantine";
            Credential                                    = $Credscredential;
            Enabled                                       = $True;
            EnableFirstContactSafetyTips                  = $True;
            EnableMailboxIntelligence                     = $True;
            EnableMailboxIntelligenceProtection           = $True;
            EnableOrganizationDomainsProtection           = $True;
            EnableSimilarDomainsSafetyTips                = $True;
            EnableSimilarUsersSafetyTips                  = $True;
            EnableSpoofIntelligence                       = $True;
            EnableTargetedDomainsProtection               = $False;
            EnableTargetedUserProtection                  = $True;
            EnableUnauthenticatedSender                   = $True;
            EnableUnusualCharactersSafetyTips             = $True;
            EnableViaTag                                  = $True;
            Ensure                                        = "Present";
            ExcludedDomains                               = @();
            ExcludedSenders                               = @();
            HonorDmarcPolicy                              = $True;
            Identity                                      = "-Anti Phishing";
            ImpersonationProtectionState                  = "Manual";
            MailboxIntelligenceProtectionAction           = "Quarantine";
            MailboxIntelligenceProtectionActionRecipients = @();
            MailboxIntelligenceQuarantineTag              = "AdminOnlyAccessPolicy";
            MakeDefault                                   = $False;
            PhishThresholdLevel                           = 1;
            SpoofQuarantineTag                            = "AdminOnlyAccessPolicy";
            TargetedDomainActionRecipients                = @();
            TargetedDomainProtectionAction                = "Quarantine";
            TargetedDomainQuarantineTag                   = "AdminOnlyAccessPolicy";
            TargetedDomainsToProtect                      = @();
            TargetedUserActionRecipients                  = @();
            TargetedUserProtectionAction                  = "Quarantine";
            TargetedUserQuarantineTag                     = "AdminOnlyAccessPolicy";
            TargetedUsersToProtect                        = @("");
        }
                EXOAntiPhishRule "EXOAntiPhishRule--Anti Phishing"
        {
            AntiPhishPolicy      = "-Anti Phishing";
            Credential           = $Credscredential;
            Enabled              = $True;
            Ensure               = "Present";
            Identity             = "-Anti Phishing";
            Priority             = 0;
            RecipientDomainIs    = @("$OrganizationName");
        }
        EXOMalwareFilterRule "EXOMalwareFilterRule--Anti Malware"
        {
            Credential           = $Credscredential;
            Enabled              = $True;
            Ensure               = "Present";
            Identity             = "-Anti Malware";
            MalwareFilterPolicy  = "-Anti Malware";
            Priority             = 0;
            RecipientDomainIs    = @("$OrganizationName");
        }
        EXOSafeAttachmentPolicy "EXOSafeAttachmentPolicy--Safe Attachements"
        {
            Action               = "Block";
            AdminDisplayName     = "";
            Credential           = $Credscredential;
            Enable               = $True;
            Ensure               = "Present";
            Identity             = "-Safe Attachements";
            QuarantineTag        = "AdminOnlyAccessPolicy";
            Redirect             = $False;
            RedirectAddress      = "";
        }
        EXOSafeAttachmentRule "EXOSafeAttachmentRule--Safe Attachements"
        {
            Credential           = $Credscredential;
            Enabled              = $True;
            Ensure               = "Present";
            Identity             = "-Safe Attachements";
            Priority             = 0;
            RecipientDomainIs    = @("$OrganizationName");
            SafeAttachmentPolicy = "-Safe Attachements";
        }
        EXOSafeLinksPolicy "EXOSafeLinksPolicy--Safe Links Policy"
        {
            AdminDisplayName           = "";
            AllowClickThrough          = $False;
            Credential                 = $Credscredential;
            CustomNotificationText     = "";
            DeliverMessageAfterScan    = $True;
            DisableUrlRewrite          = $True;
            DoNotRewriteUrls           = @();
            EnableForInternalSenders   = $True;
            EnableOrganizationBranding = $True;
            EnableSafeLinksForEmail    = $True;
            EnableSafeLinksForOffice   = $True;
            EnableSafeLinksForTeams    = $True;
            Ensure                     = "Present";
            Identity                   = "-Safe Links Policy";
            ScanUrls                   = $True;
            TrackClicks                = $True;
        }
        EXOSafeLinksRule "EXOSafeLinksRule--Safe Links Policy"
        {
            Credential           = $Credscredential;
            Enabled              = $True;
            Ensure               = "Present";
            Identity             = "-Safe Links Policy";
            Priority             = 0;
            RecipientDomainIs    = @("$OrganizationName");
            SafeLinksPolicy      = "-Safe Links Policy";
        }
    }
}

M365TenantConfig -ConfigurationData .\ConfigurationData.psd1 -Credential $Credential

Verbose logs showing the problem

VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] Test-TargetResource returned False                                                                        VERBOSE: [DB-NB41C]: LCM:  [ End    Test     ]  [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing]  in 17.2420 seconds.                                                                                      VERBOSE: [DB-NB41C]: LCM:  [ Start  Set      ]  [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing]                                                                                                           VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] Setting configuration of AntiPhishPolicy for -Anti Phishing                                     VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] Getting configuration of AntiPhishPolicy for -Anti Phishing                                     VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] AntiPhishPolicy -Anti Phishing does not exist.                                                  VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] Creating new instance of AntiPhish Policy {-Anti Phishing}                                      VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] Returning precomputed version info: 3.4.0                                                                 VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] POST with -1-byte payload                                                                                 VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] Query 1 failed.                                                                                           VERBOSE: [DB-NB41C]:                            [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing] Getting message from error object                                                                         |Microsoft.Exchange.Management.Tasks.ValidationException|                                                               + CategoryInfo          : InvalidArgument: (:) [], CimException                                                     + FullyQualifiedErrorId : [Server=AS4P195MB2039,RequestId=6947fc46-cf56-781f-d899-a6326136dc42,TimeStamp=Fri,      14 Jun 2024 19:16:39 GMT],Write-ErrorMessage                                                                         + PSComputerName        : localhost                                                                                                                                                                                                 VERBOSE: [DB-NB41C]: LCM:  [ End    Set      ]  [[EXOAntiPhishPolicy]EXOAntiPhishPolicy--Anti      Phishing]  in 7.3410 seconds.

Environment Information + PowerShell Version

OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage           : en-GB
OsMuiLanguages       : {en-GB, nl-NL}



PS C:\Users\cor>
PS C:\Users\cor> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.3672
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.3672
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1