Getting an error when running scripts with the Microsoft.Graph.Reports module. The module is installed on the machine, I created a new environment based on Powershell 5.1 with that specifically in it, I have it being imported within the script. When the Connect-MgGraph command is run this error appears
[error] The system cannot find the file specified.
This happens on 2.8.2 as well in any environment. I can run this script inside VSCode on 7.1.5 and Powershell ISE on 5.1 and it works correctly. I cannot run it as part of an automation inside of Universal.
I checked the modules page and verified the paths. The psd1 is in the correct location
Notice there was a new version of the graph module available. Updated it, restarted Universal, and re-ran the script. Same issue happens. I grabbed the log for the last job I ran with this in it
Any idea’s on this? Looking like I’ll have to rewrite the script to use the REST API directly and work around throttling issues the module handles on it’s own.
If I run it manually in VSCode Powershell 7.1.5 it works, same with 5.1 in ISE. It’s only when run from Universal it gives this error.
Can you try capturing the stack trace? It might help isolate the problem. If the MgGraph module is open source we might be able to find the line that’s causing this issue.
System.Security.Cryptography.CryptographicException: The system cannot find the file specified.
at Microsoft.Graph.PowerShell.Authentication.Cmdlets.ConnectMgGraph.ProcessRecordAsync>__56.MoveNext()
Hello,
In case you are working with the IIS 7, the solution for me was to change application pool’s settings to load its identity profile. The command that does this is as follows:
appcmd set apppool “AppPoolName” -processModel.loadUserProfile:true
I had a problem with gaining access to certificate's private key under the account of the application pool in the context of a web service execution. The certificate was to be acquired from application pool's user personal certificate store.
Well I feel like an idiot. I had the cert in my account’s cert store, and the machine store, but not in the cert store of the user account the script was running as.
imported the cert there and I can now connect to graph.