Forum Discussion
Method not found 'Void Microsoft.Graph.TokenCredentialAuthProvider'
I'd only expect to see that kind of error under the following conditions:
- A bug in the module;
- You have multiple versions concurrently installed and the wrong one is being called (likely one featuring an older version of Azure.Core.dll.)
I'm inclined to think it'll be the second case, in which case you can run the following script to remove all currently-installed versions (this is based on Windows PowerShell, not PowerShell) and re-install them (see the note in the comments about scope):
I don't use beta/pre-release versions and I am aware they sometimes need manual eviction. I haven't catered to this scenario in the script below.
<#
Local administration rights are required for the "-Scope AllUsers" option to work. Otherwise, remove that option from the commandlets to do a per user refresh.
#>
try
{
$Scope = "AllUsers";
# Enumerate the currently-installed modules from the AllUsers scope.
$Modules = (Get-Module -ListAvailable -Name "Microsoft.Graph.*" -ErrorAction:Stop).Name | Select-Object -Unique;
# Output the list to the pipeline as a "just in case".
Write-Warning -Message "Modules detected:";
$Modules;
# Now, chuck 'em all in the bin.
$Modules |
ForEach-Object {
Uninstall-Module -Name $_ -AllVersions -Force -ErrorAction:Stop;
}
# The authentication module is a prerequisite for all the other Graph modules (which throw a warning on installation if this one isn't already present), hence breaking it out to be first to be re-installed.
Install-Module -Name "Microsoft.Graph.Authentication" -Scope $Scope -Force -ErrorAction:Stop;
# Re-install the rest, excluding the authentication module from above.
$Modules |
ForEach-Object {
if ($_ -ne "Microsoft.Graph.Authentication")
{
Install-Module -Name $_ -Scope $Scope -Force -ErrorAction:Stop;
}
}
}
catch
{
throw;
}
Cheers,
Lain
LainRobertson VasilMichev
Alright. I wiped out module repository and reinstalled all modules (MSGraph 1.23), including Azure.Core.dll which is a part of Az.Accounts (2.12.1). That didn't help and I started getting "Connect-MgGraph : <ThumbprintId> certificate was not found or has expired".
Then I tried to import a certificate using Runbook into CurrentUser with "Import-PfxCertificate
Locally and from Runbook all working well. I just run out of ideas what else could be wrong.
- LainRobertsonMar 22, 2023Silver Contributor
I'd expect this to be about the placement of the certificate - as per the other thread.
As I mentioned there, I don't use the hybrid runbook server meaning I can't perform a like-for-like test, but I'm not having any issues with certificate-based authentication under version 1.23.0.
It tested successfully for me - using an Azure servicePrincipal - both from the certificate store as well as from file, but keep in mind (as per the link in the other thread) that the hybrid runbook documentation specifies a more unique location than the CurrentUser\My or LocalMachine\My stores, so it's got some of its own peculiarities to navigate.
I'd suggest running your own test outside of the runbook scenario as a cross-reference. If that works - and I'd wager it will - then at least that'll be fairly solid evidence (as much as anything ever is) it's not the Graph PowerShell modules.
Cheers,
Lain