Microsoft Security Labs

Complete Hands-On Guide for Enterprise Security

⏱️
8-10 hrs
Total Lab Time
🔬
5+ Labs
Hands-On Exercises
💾
200GB
Disk Space
🧠
16GB
RAM Required
🎓
Advanced
Skill Level
🏆
Enterprise
Focus Area
01

Overview & Objectives

Master Microsoft's Enterprise Security Stack

🛡️
Microsoft Security Operations Center

Build a complete enterprise security environment with Microsoft's leading security tools. Learn to detect, investigate, and respond to advanced threats using Microsoft Defender for Endpoint, Microsoft Sentinel, and Azure Security Center.

🎯

Learning Objectives

  • Deploy Microsoft 365 E5 security features
  • Configure Microsoft Defender for Endpoint
  • Implement Azure Active Directory security
  • Build detection and response workflows
  • Create custom threat hunting queries
  • Investigate security incidents end-to-end
  • Configure automated response actions
  • Implement Zero Trust security model
💡
Pro Tip

This lab environment simulates a real enterprise network. Take notes of your configurations - you'll be building upon each lab progressively!

02

Prerequisites Checklist

Ensure you have everything ready before starting

💻
Hardware Requirements
  • Windows 10/11 Pro or Enterprise
  • 16GB RAM minimum (32GB recommended)
  • 200GB free disk space
  • CPU with virtualization support
  • Hyper-V capable system
🔧
Software Requirements
  • PowerShell 5.1 or later
  • Administrator access
  • Modern web browser
  • Microsoft Authenticator app
  • Text editor (VS Code recommended)
🌐
Network Requirements
  • Stable internet connection
  • Access to Microsoft portals
  • No restrictive firewall rules
  • Ability to download large files
  • Port 443 (HTTPS) open
📝
Accounts Needed
  • Personal Microsoft account
  • Valid email address
  • Phone number for verification
  • Credit card (Azure, won't be charged)
⚠️
Important Note

This lab will create multiple virtual machines. Ensure your system meets the minimum requirements to avoid performance issues.

03

Initial Environment Setup

Prepare your system for the labs

Enable Virtualization
⏱️ 15 minutes
1
Enable Hyper-V on Windows Pro/Enterprise
PowerShell (Admin)
# Open PowerShell as Administrator
# Enable Hyper-V feature
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All -NoRestart

# Restart your computer to apply changes
Restart-Computer
Alternative: Using VMware or VirtualBox

If you have Windows Home Edition or prefer alternative virtualization:

04

Microsoft 365 E5 Developer Setup

Get your free E5 license for testing

Phase 1: Create Developer Account
⏱️ 30 minutes
1
Join Microsoft 365 Developer Program
  1. Navigate to: Microsoft 365 Developer Program
  2. Click "Join now"
  3. Sign in with personal Microsoft account (or create new)
  4. Complete profile:
    • Country: Your location
    • Company: "Security Lab" or your name
    • Language: English
    • Check: "I accept the terms and conditions"
  5. Click "Next"
  6. Select: "Instant sandbox"
  7. Region: United States (recommended)
  8. Create admin credentials
📝 Save Your Credentials
Tenant: _________________.onmicrosoft.com
Admin Email: admin@_________________.onmicrosoft.com
Password: _________________________________
2
Verify Microsoft 365 Access
  1. Navigate to: Microsoft 365 Admin Center
  2. Sign in with admin@[yourtenant].onmicrosoft.com
  3. Complete MFA setup (use Microsoft Authenticator app)
  4. Verify "Microsoft 365 E5 Developer" license appears
  5. Go to Users > Active users
  6. Verify 25 sample users are pre-created
Success!

You now have a Microsoft 365 E5 tenant with full security features for 90 days (renewable)!

05

Azure Subscription Setup

Activate your free Azure subscription

Phase 2: Create Azure Subscription
⏱️ 15 minutes
1
Sign Up for Azure Free Account
  1. Navigate to: Azure Free Account
  2. Click "Start free"
  3. Sign in with SAME Microsoft account from M365
  4. Enter phone number for verification
  5. Enter credit card (won't be charged for free services)
  6. Complete identity verification via phone
  7. Agreement: Check "I agree" and click "Sign up"
  8. Wait for subscription creation (2-3 minutes)
2
Verify Azure Access
  1. Navigate to: Azure Portal
  2. Verify "Azure subscription 1" appears
  3. Check: $200 free credit available
  4. Verify: Free services for 12 months active
06

Virtual Environment Setup

Create your lab virtual machines

Phase 3: Download Required ISOs
⏱️ 1-2 hours (download time)
💿

ISO Downloads

  • Windows Server 2022: Download (~5GB) - Save to: C:\ISOs\WindowsServer2022.iso
  • Windows 10 Enterprise: Download (~5GB) - Save to: C:\ISOs\Windows10Enterprise.iso
  • Ubuntu 22.04 LTS: Download (~4GB) - Save to: C:\ISOs\Ubuntu2204.iso
Create Virtual Machines
⏱️ 2 hours

Create Domain Controller (DC01)

Windows Server 2022
PowerShell (Admin)
# Create directory for VMs
New-Item -Path "C:\VMs" -ItemType Directory -Force

# Create virtual switch (one time only)
New-VMSwitch -Name "LabSwitch" -SwitchType Internal

# Configure network for switch
New-NetIPAddress -InterfaceAlias "vEthernet (LabSwitch)" -IPAddress 192.168.10.1 -PrefixLength 24

# Create Domain Controller VM
New-VM -Name "DC01" -MemoryStartupBytes 4GB -Generation 2 `
    -NewVHDPath "C:\VMs\DC01\DC01.vhdx" -NewVHDSizeBytes 80GB `
    -SwitchName "LabSwitch"

Set-VMProcessor -VMName "DC01" -Count 2
Set-VMMemory -VMName "DC01" -DynamicMemoryEnabled $true -MinimumBytes 2GB -MaximumBytes 4GB
Add-VMDvdDrive -VMName "DC01"
Set-VMDvdDrive -VMName "DC01" -Path "C:\ISOs\WindowsServer2022.iso"
Set-VMFirmware -VMName "DC01" -EnableSecureBoot Off

# Start VM
Start-VM -VMName "DC01"

# Connect to VM
vmconnect localhost DC01
📝
Installation Steps

1. Boot from ISO
2. Select Windows Server 2022 Standard (Desktop Experience)
3. Set Administrator password: P@ssw0rd123!
4. Configure static IP: 192.168.10.10

Create Windows Client 01

Windows 10 Enterprise
PowerShell (Admin)
# Create CLIENT01
New-VM -Name "CLIENT01" -MemoryStartupBytes 4GB -Generation 2 `
    -NewVHDPath "C:\VMs\CLIENT01\CLIENT01.vhdx" -NewVHDSizeBytes 60GB `
    -SwitchName "LabSwitch"

Set-VMProcessor -VMName "CLIENT01" -Count 2
Add-VMDvdDrive -VMName "CLIENT01"
Set-VMDvdDrive -VMName "CLIENT01" -Path "C:\ISOs\Windows10Enterprise.iso"
Set-VMFirmware -VMName "CLIENT01" -EnableSecureBoot Off

# Start VM
Start-VM -VMName "CLIENT01"

Create Windows Client 02

Windows 10 Enterprise
PowerShell (Admin)
# Create CLIENT02
New-VM -Name "CLIENT02" -MemoryStartupBytes 4GB -Generation 2 `
    -NewVHDPath "C:\VMs\CLIENT02\CLIENT02.vhdx" -NewVHDSizeBytes 60GB `
    -SwitchName "LabSwitch"

Set-VMProcessor -VMName "CLIENT02" -Count 2
Add-VMDvdDrive -VMName "CLIENT02"
Set-VMDvdDrive -VMName "CLIENT02" -Path "C:\ISOs\Windows10Enterprise.iso"
Set-VMFirmware -VMName "CLIENT02" -EnableSecureBoot Off

# Start VM
Start-VM -VMName "CLIENT02"
🌐

Configure Active Directory Domain

PowerShell on DC01
# Install AD DS Role
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools

# Import AD Deployment module
Import-Module ADDSDeployment

# Create domain
$SafeModePassword = ConvertTo-SecureString "P@ssw0rd123!" -AsPlainText -Force

Install-ADDSForest `
    -DomainName "securitylab.local" `
    -DomainNetbiosName "SECURITYLAB" `
    -SafeModeAdministratorPassword $SafeModePassword `
    -InstallDns `
    -Force

# Server will restart automatically
07

Lab 1: Microsoft Defender for Endpoint

Deploy and configure enterprise endpoint protection

🛡️
Defender for Endpoint

Duration: 3-4 hours | Difficulty: Advanced

Phase 1: Enable Defender for Endpoint
⏱️ 30 minutes
1
Access Microsoft 365 Defender Portal
  1. Navigate to: Microsoft 365 Defender
  2. Sign in: admin@[yourtenant].onmicrosoft.com
  3. Complete MFA if prompted
  4. Accept permissions if prompted
2
Configure Defender Settings
  1. Click Settings (gear icon, bottom left)
  2. Select: Endpoints
  3. Click: General > Advanced features
  4. Enable ALL features:
    • Automated Investigation
    • Automated Remediation
    • Live Response
    • Custom Network Indicators
    • Tamper Protection
    • Show user details
    • Preview features
  5. Click "Save preferences"
Phase 2: Onboard Devices
⏱️ 45 minutes
1
Download Onboarding Package
  1. Go to: Settings > Endpoints > Device management > Onboarding
  2. Deployment method: "Local Script (for up to 10 devices)"
  3. Click "Download onboarding package"
  4. Save: WindowsDefenderATPOnboardingPackage.zip
  5. Extract the .zip file
2
Run Onboarding Script on Clients
PowerShell on CLIENT01 (Admin)
# Navigate to script location
cd C:\Temp

# Run onboarding script
.\WindowsDefenderATPOnboardingScript.cmd

# You should see:
# "Successfully onboarded machine to Microsoft Defender for Endpoint"

# Verify onboarding
cd "C:\Program Files\Windows Defender Advanced Threat Protection\Classification"
dir

# Should see MsSense.exe and other files
Verification

Wait 5-10 minutes, then check the portal. Your devices should appear under Assets > Devices

Phase 3: Test Detection Capabilities
⏱️ 1 hour

Test 1: EICAR Malware Detection

Expected Alert: High Severity
PowerShell on CLIENT01
# Create test directory
New-Item -Path "C:\SecurityTests" -ItemType Directory -Force

# Try to create EICAR test file (will be blocked)
$eicar = 'X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
Set-Content -Path "C:\SecurityTests\eicar.txt" -Value $eicar

# Expected: Operation will fail
# Error: "This file contains a virus or potentially unwanted software"

Verify in Portal: Go to Incidents & alerts > Alerts. You should see "Virus detected - Eicar_Test_File"

Test 2: Suspicious PowerShell Activity

Expected Alert: Medium Severity
PowerShell on CLIENT01
# Create suspicious encoded command
$command = "Get-Process"
$bytes = [System.Text.Encoding]::Unicode.GetBytes($command)
$encodedCommand = [Convert]::ToBase64String($bytes)

# Execute encoded PowerShell (suspicious behavior)
powershell.exe -EncodedCommand $encodedCommand

# Create another suspicious pattern
powershell.exe -ExecutionPolicy Bypass -NoProfile -Command "Write-Host 'Test'"

MITRE ATT&CK: T1059.001 (PowerShell)

Test 3: Credential Access Simulation

Expected Alert: High Severity
PowerShell on CLIENT01
# Simulate LSASS enumeration (will trigger alert)
# View LSASS process info
Get-Process lsass | Select Name, Id, Path

# Run credential enumeration command
cmdkey /list

# Check for saved credentials
rundll32.exe keymgr.dll,KRShowKeyMgr

MITRE ATT&CK: T1003.001 (OS Credential Dumping: LSASS Memory)

Phase 4: Investigation & Response
⏱️ 1 hour
1
Investigate Incident
  1. Go to: Incidents & alerts > Incidents
  2. Find incident with multiple alerts
  3. Click on incident to open
  4. Review incident details:
    • Incident ID and severity
    • Alert graph (visual attack chain)
    • Affected devices and users
    • Evidence and artifacts
2
Response Actions

Isolate Device

  1. On CLIENT01 device page
  2. Click "..." (three dots) top right
  3. Select "Isolate device"
  4. Isolation type: Full isolation
  5. Comment: "Isolating for investigation - Lab Test"
  6. Click "Confirm"
Phase 5: Advanced Hunting
⏱️ 30 minutes
🔍

KQL Threat Hunting Queries

KQL - PowerShell Hunt
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName =~ "powershell.exe"
| where ProcessCommandLine has_any ("encodedcommand", "bypass", "hidden")
| project Timestamp, DeviceName, AccountName, ProcessCommandLine
| order by Timestamp desc
KQL - LSASS Access Hunt
DeviceProcessEvents
| where Timestamp > ago(7d)
| where ProcessCommandLine has "lsass"
| where InitiatingProcessFileName !in~ ("werfault.exe", "taskmgr.exe")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine
| order by Timestamp desc
08

Skills & Knowledge Demonstrated

What you've mastered in this lab

🛡️
Endpoint Detection & Response
🔍
Threat Hunting with KQL
Incident Response
🎯
MITRE ATT&CK Framework
📊
Security Analytics
🤖
Automated Remediation
🔐
Azure AD Integration
📝
Compliance Reporting
🎉
Congratulations!

You've successfully deployed a complete Microsoft Security environment!

Lab Accomplishments

  • Configured Microsoft 365 E5 Developer tenant
  • Set up Azure subscription with security services
  • Built enterprise Active Directory domain
  • Deployed Microsoft Defender for Endpoint
  • Configured attack surface reduction rules
  • Detected and investigated security incidents
  • Performed device isolation and remediation
  • Created custom KQL hunting queries
  • Implemented automated response workflows
🚀

Next Steps

  • Deploy Microsoft Sentinel SIEM
  • Configure Microsoft Defender for Identity
  • Implement Conditional Access policies
  • Set up Microsoft Cloud App Security
  • Create custom detection rules
  • Build automation playbooks
  • Configure data connectors
  • Implement Zero Trust architecture