jseerden/IntuneBackupAndRestore

Support for "Connect-MgGraph" authentication

beisheim-dmTECH opened this issue · 5 comments

Is it possible to include a way to use the PowerShell command "Connect-MgGraph" as an authentication method, instead of "Connect-MsGraph"?

This would be great. I would like to authenticate with a azure app registration instead of a user.

The Microsoft.Graph.Intune PowerShell module also adds app-based authentication. Try the PowerShell code below.

Import-Module Microsoft.Graph.Intune

$tenant = "<tenantname>.onmicrosoft.com"
$authority = "https://login.windows.net/$tenant"
$clientId = "<clientId>"
$clientSecret = "<clientSecret>"

Update-MSGraphEnvironment -AppId $clientId
Update-MSGraphEnvironment -AuthUrl $authority
Connect-MSGraph -ClientSecret $clientSecret

Refer to https://oofhours.com/2019/11/29/app-based-authentication-with-intune/ for more information

Nice. Thank you. That actually worked like a charm :)

@jseerden Hope it is okay to ask another question. Is it also possible restore single policies without having to e.g. restore all compliance policies? Thanks in advance :)

Hi @ugurkocfielmann. To restore partially, delete all files in the backup folder, except for the .json files of the policies you wish to restore.

BTW I'm closing this issue, as it is currently not possible to use Connect-MgGraph and there are no plans to add this in the future.