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.