#Issue Deploying Rules in Office 365 with M365 DSC

25 messages · Page 1 of 1 (latest)

shadow patrol
#

I want to deploy configuration rules in an Office 365 tenant using M365 DSC and Microsoft Graph for the following requirements:

Must have:

Anti-Phishing Policy (CIS 2.1.7)
Restrict Administrative Rights (CIS 1.1.3)
Block Legacy Authentication for MFA (CIS 5.2.2.2)
Implement Strict Access Rules (CIS 5.2.4)
Enforce Strong Password Policies (CIS 1.3.1)
Enable DLP Policies (CIS 3.2.1)
Should have:

Monitor Registered Applications (CIS 5.1.5.3)
Restrict Anonymous Links in SharePoint (CIS 7.2.7)
Limit API Access (CIS 5.1.5.2)
Restrict Permissions in SharePoint Online (CIS 7.2.7)
Could have:

Block Login to Shared Mailboxes (CIS 1.2.2)
Information Security Policies for SharePoint (CIS 3.3.1)
Periodically Review Guest Permissions (CIS 5.3.2)
I split these requirements into three scripts: one for "Must haves," one for "Should haves," and one for "Could haves." However, when deploying the "Must haves" script, I encounter errors stating that the required modules are missing from my device. Despite reinstalling and updating the modules multiple times, the issue persists. I used ChatGPT to troubleshoot, but the provided solutions did not resolve the problem. Here are two versions of my script, neither of which worked.

true swallow
#

Do you have the error message in bulk? Does it say what modules are missing?

shadow patrol
#

when i run this script "complete-o365.ps1" i get this errors

tawny talon
#

which line is it referring to? cause line 125 isn't the same in the file you uploaded

shadow patrol
#

im now trying to depoly rule by rule

#

im using it on a test tenant

#

so there is no configraution

#

this is what im getting

tawny talon
#

error says you can add a property to bypass that

shadow patrol
#

how to fix it?

true swallow
shadow patrol
#

im trying to run this now but it does not work

Compile Configuration

Office365CISBaseline -ConfigurationData $ConfigData -OutputPath $ConfigurationPath -Credentials $Credentials -TenantId "n47p.onmicrosoft.com"

#

i tried to uninstall the moudels multi times still not working

#

i tried to update it still not working

#

and when i run this command Get-Command -Module ExchangeOnlineManagement
i dont find the EXOAntiPhishingPolicy

#

and on the powershell page is not showing

tawny talon
#

because it's EXOAntiPhishPolicy

shadow patrol
#

when i try to run this

Define Configuration

Configuration Office365CISBaseline {
param(
[Parameter(Mandatory = $true)]
[PSCredential]$Credentials,

    [Parameter(Mandatory = $true)]
    [string]$TenantId
)

Import-DscResource -ModuleName Microsoft365DSC

Node localhost {
  
    # CIS 2.1 - Anti-Phishing Protection
    EXOAntiPhishingPolicy 'CIS_2.1_AntiPhishingPolicy' {
        Identity                              = "CIS-2.1-Anti-Phishing"
        AdminDisplayName                      = "CIS 2.1 - Configure anti-phishing policies"
        AuthenticationFailAction              = "Quarantine"
        Enabled                               = $true
        EnableMailboxIntelligence             = $true
        EnableMailboxIntelligenceProtection   = $true
        EnableOrganizationDomainsProtection   = $true
        EnableSimilarDomainsSafetyTips        = $true
        EnableSimilarUsersSafetyTips          = $true
        EnableTargetedDomainsProtection       = $true
        EnableTargetedUserProtection          = $true
        EnableUnauthenticatedSender           = $true
        PhishThresholdLevel                   = 2
        Credential                            = $Credentials
        TenantId                              = "n47p.onmicrosoft.com"
    }

       }

}

Configuration Data and Paths

$ConfigData = @{
AllNodes = @(
@{
NodeName = "localhost"
}
)
}

#

it works

#

but when i want to compile it it does not work

#

Compile Configuration

Office365CISBaseline -ConfigurationData $ConfigData -OutputPath $ConfigurationPath -Credentials $Credentials -TenantId "n47p.onmicrosoft.com"