
When you onboard a device with a local account to Microsoft Defender for Endpoint using a local script, the license used is determined by the license assigned to the user account used to sign in to the Microsoft 365 Defender portal. If the user account has a Microsoft Defender for Endpoint Plan 1 license, then the device will be onboarded with that license. If the user account has a Microsoft Defender for Endpoint Plan 2 license, then the device will be onboarded with that license.
References: