Step 1: Sign into Office admin portal via http://portal.office.com
Step 2: From the Microsoft 365 admin center dashboard, Click on Admin.
Step 3: Navigate to Compliance management > Data loss prevention.
Step 4: Click the arrow that is beside the Add Add Icon icon, and select New custom policy.
Step 5: On the New custom policy page, fill all the fields:
Step 6: Click Save and double-click the policy that you just created.
Step 7: Click Rules and click Add icon and configure the rule.
Step 8: Click Save.