The script signs out the user from all Microsoft 365 services.
To use the script, install modules Microsoft.Graph on the computer where Adaxes service runs.
PowerShell
$azureId = $Context.TargetObject.AzureID
if ($NULL -eq $azureId)
{
$Context.LogMessage("User %fullname% does not have an Azure AD account.", "Warning")
return
}
$accessToken = $Context.CloudServices.GetAzureAuthAccessToken()
Connect-MgGraph -AccessToken ($accessToken | ConvertTo-SecureString -AsPlainText -Force)
Revoke-MgUserSignInSession -UserID $azureId
"One or more errors occurred.: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. Stack trace: at <ScriptBlock>, <No file>: line 16"
The error message occurs because the target user is not present in the scope of the Microsoft 365 tenant in Adaxes. As a result retrieving the tenant credentials fails and user interaction is required. If you still face issues using the script in your Custom Command for user deprovisioning, please, send us (support[at]adaxes.com) a screenshot of the command.
The issue occurs because of the changes in Microsoft Graph PowerShell module. To use the script, you need to install the full module. Thank you for pointing out the issue, we updated the script description accordingly.