Kaffeeundcode
Script Library
PowerShell 11.12.2025

Script Workspace

Import IntuneJSON

Review the purpose, inspect the code, then test it safely in your own tenant.

86_Import-IntuneJSON.ps1

<#
.SYNOPSIS
    Imports/Creates Policy from JSON.
    
.DESCRIPTION
    Reads a JSON file and creates a new policy resource.
    
.NOTES
    File Name: 86_Import-IntuneJSON.ps1
    Author: Mattia Cirillo
    Version: 1.0
#>

param(
    [string]$JsonPath
)

Connect-MgGraph -Scopes "DeviceManagementConfiguration.ReadWrite.All"

$Json = Get-Content $JsonPath | ConvertFrom-Json
# Convert back to hashtable for body parameter often needed
# New-MgDeviceManagementDeviceCompliancePolicy -BodyParameter $Json
Write-Host "Import logic requires casting JSON object to Hashtable carefully."