Forum Discussion
Alex_Rechs
Mar 21, 2023Brass Contributor
Method not found 'Void Microsoft.Graph.TokenCredentialAuthProvider'
Hello, I try to run a runbook in Hybrid Worker to collect info from Azure Registered Apps. For that activity I connect to MS Graph with certificate and execute Get-MgApplication cmdlet. However, I s...
Alex_Rechs
Mar 22, 2023Brass Contributor
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
-FilePath "localPath" -CertStoreLocation Cert:\CurrentUser\My\", but I got again: "Connect-MgGraph : <certName> certificate was not found or has expired."
I tried to use the guide and specify the cert path: "$Cert = Get-ChildItem Cert:\LocalMachine\My\$CertThumbprint", but this time I got the same error, but instead of basic <certName>, I got full details of my certificate with ending message "certificate was not found or has expired." which is kind of ridiculous, because the certificate is displayed.
Locally and from Runbook all working well. I just run out of ideas what else could be wrong.
LainRobertson
Mar 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