Public/Import-EdgeSecurityBaselineToIntune.ps1

<#
.SYNOPSIS
    Imports Microsoft Edge Security Baseline to Intune.
.DESCRIPTION
    Downloads and applies Microsoft Edge Security Baseline to Intune as Device Configuration policies.
.EXAMPLE
    Import-EdgeSecurityBaselineToIntune
#>

function Import-EdgeSecurityBaselineToIntune {
    [CmdletBinding()]
    param(
        [switch]$DryRun
    )

    $ErrorActionPreference = "Stop"
    $workspacePath = Get-WorkspacePath
    if (-not $workspacePath) {
        Write-Error "Workspace not configured. Run Initialize-NLBaseline first."
        return
    }

    $config = Get-Config -WorkspacePath $workspacePath
    if (-not $config -or [string]::IsNullOrEmpty($config.AppRegistration.ClientId) -or [string]::IsNullOrEmpty($config.AppRegistration.ClientSecret) -or [string]::IsNullOrEmpty($config.AppRegistration.TenantId)) {
        Write-Error "App Registration not configured in config.json."
        return
    }

    Write-Host "`nImporting Microsoft Edge Security Baseline to Intune`n" -ForegroundColor Cyan

    if ($DryRun) {
        Write-Host "[DryRun] Would download and apply Microsoft Edge Security Baseline" -ForegroundColor Cyan
        Write-Host "Note: Edge Security Baseline is part of Microsoft Security Compliance Toolkit" -ForegroundColor Yellow
        Write-Host "`nTo get latest baseline, visit:" -ForegroundColor Yellow
        Write-Host " https://www.microsoft.com/download/details.aspx?id=55319" -ForegroundColor White
        return
    }

    Write-Host "`nNote: Microsoft Edge Security Baseline must be downloaded and applied via:" -ForegroundColor Yellow
    Write-Host "1. Download baseline ZIP from Microsoft Security Compliance Toolkit" -ForegroundColor White
    Write-Host "2. Extract ADMX/ADML files and GPO backup" -ForegroundColor White
    Write-Host "3. Use Group Policy Analytics in Intune to convert to Settings Catalog policy" -ForegroundColor White
    Write-Host "`nLatest download: https://www.microsoft.com/download/details.aspx?id=55319" -ForegroundColor Cyan
    Write-Host "`nNote: Edge Browser configurations are already included in EdgeBrowserConfigurations baseline component" -ForegroundColor Gray
}