Public/Start-IntuneBackupSP.ps1

function Start-IntuneBackupSP() {
    <#
    .SYNOPSIS
    Backup Intune Configuration
 
    .DESCRIPTION
    Backup Intune Configuration
 
    .PARAMETER Path
    Path to store backup (JSON) files.
 
    .EXAMPLE
    Start-IntuneBackup -Path C:\temp
 
    .NOTES
    Requires the MSGraphFunctions PowerShell Module
 
    Connect to MSGraph first, using the 'Connect-Graph' cmdlet.
    #>


    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$Path
    )

    [PSCustomObject]@{
        "Action" = "Backup"
        "Type"   = "Intune Backup and Restore Action"
        "Name"   = "IntuneBackupAndRestore - Start Intune Backup Config and Assignments"
        "Path"   = $Path
    }

    Invoke-IntuneBackupClientAppSP -Path $Path
    Invoke-IntuneBackupConfigurationPolicySP -Path $Path
    Invoke-IntuneBackupDeviceCompliancePolicySP -Path $Path
    Invoke-IntuneBackupDeviceConfigurationSP -Path $Path
    Invoke-IntuneBackupDeviceManagementScriptSP -Path $Path
    Invoke-IntuneBackupGroupPolicyConfigurationSP -Path $Path
    Invoke-IntuneBackupDeviceManagementIntentSP -Path $Path
    Invoke-IntuneBackupAppProtectionPolicySP -Path $Path
    Invoke-IntuneBackupDeviceHealthScriptSP -Path $Path
    Invoke-IntuneBackupdeviceshellScriptSP -path $Path

    Disconnect-MgGraph
}