Tests/Test-Functions.ps1
#set permissions for session $permissions = @( 'Application.Read.All', 'Application.ReadWrite.All', 'Directory.Read.All', 'Directory.ReadWrite.All', 'AppRoleAssignment.ReadWrite.All' ) #connect to Microsoft Graph Connect-MgGraph -Scopes $permissions #Get Appliction which will be edited $Application = Get-MgApplication | Where-Object {$_.DisplayName -eq "test"} #set 3 permissions as test Find-MgGraphPermission | Where-Object {$_.PermissionType -eq "Application"} | Select-Object -first 3 | ForEach-Object { Add-MGApplicationAPIPermission -ApplicationId $Application.Id -ApplicationAPIPermissionId $_.Id -Wait $true } #remove 3 permissions again Find-MgGraphPermission | Where-Object {$_.PermissionType -eq "Application"} | Select-Object -first 3 | ForEach-Object { new } |