0 votes

My script below worked until 2 week ago, after PS Graph module update the script doesn't work only in ADAXES, in powershell and in adaxes powershell works. Can you help me?

# Define the Application (Client) ID and Secret
$ApplicationClientId = 'XXXXX' # Application (Client) ID
$ApplicationClientSecret = 'XXXXX' # Application Secret Value
$TenantId = 'XXXXX' # Tenant ID

# Convert the Client Secret to a Secure String
$SecureClientSecret = ConvertTo-SecureString -String $ApplicationClientSecret -AsPlainText -Force

# Create a PSCredential Object Using the Client ID and Secure Client Secret
$ClientSecretCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $ApplicationClientId, $SecureClientSecret
# Connect to Microsoft Graph Using the Tenant ID and Client Secret Credential
Connect-MgGraph -TenantId $TenantId -ClientSecretCredential $ClientSecretCredential
by (480 points)
0

Hello Simone,

What exactly do you mean by doesn't work only in ADAXES? Do you face any errors/warnings? If you do, please, provide screenshots. You can post them here or send to us at support@adaxes.com.

Also, please, clarify what exactly you mean by in adaxes powershell works.

0

Sorry, I missed to add the error.

ClientCertificateCredential authentication failed: Could not load type 'Microsoft.Identity.Client.BaseAbstractApplicationBuilder`1' from assembly 'Microsoft.Identity.Client, Version=4.48.1.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'. Stack trace: at <ScriptBlock>, <No file>: line 5

Adaxes powershell, I mean C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -command import-module Adaxes

1 Answer

0 votes
by (300k points)
selected by
Best answer

Hello Simone,

Thank you for clarifying. It looks like Adaxes fails to load something from the new module and thus fails to execute the cmdlet. The error is not related to Adaxes itself and seems to be about the permissions of the Adaxes service account executing the script. It can happen that during the module update you installed it in some way that the Adaxes service account cannot access some resources. Unfortunately, we cannot be more specific as the error is not actually about Adaxes.

The fact the you see the script working with Adaxes PowerShell module imported does not make it related to Adaxes in any way. It just a module you import in a script. The same way you can import any other module and the behavior will remain the same.

0

Thanks, I updated the module Microsoft.Identity.Client, now the script works.

Related questions

0 votes
1 answer

We currently have a custom command implemented that sends a remove passcode command to a DEP managed iOS device. The script works fine when testing in the Adminstration console, ... { $Context.LogMessage("Failing to send Wipe command", "Warning") return } }

asked Feb 11 by alexalex (60 points)
0 votes
1 answer

We are creating a scheduled task with powershell script to check for group licensing errors in Azure/Entra ID using Graph API but the connection throws an error. `# Connect to Graph ... ($count -le 0) { write-host "No user found with license errors" }`

asked Jan 26, 2024 by maarten.vaes (140 points)
0 votes
1 answer

Hi, I'm trying to add a column to a report to retrieve the last login data from AAD/Graph using the script posted here but i'm running into the ... [0].signInActivity.lastSignInDateTime # Assign a column value to $Context.Value $Context.Value = $lastLogonDate

asked Feb 22, 2022 by richarddewis (260 points)
0 votes
0 answers

Hello, I get this error after logging into the web interface (As Adaxes Admin):   Fatal Error - Cannot process the request because the request signature is invalid or ... Adaxes Services/Server about 3 or 4 times now and restarting the computer as well.

asked Feb 6, 2023 by Edogstraus00 (490 points)
0 votes
0 answers

Good afternoon Support, I have configured a new stack of servers in the same topology of our existing environment but have hit a snag when trying to terminate SSL on the F5 ... 7.13122.0 and 3.7.11926.0 running Windows Server 2012R2 fully patched by Microsoft.

asked Jul 12, 2016 by strikk (360 points)
3,662 questions
3,349 answers
8,451 comments
549,143 users