Product: PowerShell Universal
Version: 3.5.5
Environment: Windows PowerShell 5.1
Credential: localCredentials (a local user defined as a Secret with access to the Certificate I'm using)
Since upgrading to 3.5.5, I’ve been unable to connect to the PowerShell Graph SDK. Running the same cmdlet/parameters locally as a the account I’m running As in the script works. Here’s what I’m running:
try{
Write-Host "Connecting to Graph App ID: $secret:appID on Tenant ID: $clientTenantId with thumbprint: $secret:graphCertThumbprint"
$null = Connect-MgGraph -AppId $secret:appID -TenantID $clientTenantId -CertificateThumbprint $secret:graphCertThumbprint -ErrorAction Stop
Write-Host "Connected to Graph"
}
catch{
Write-Warning $Error[0]
Write-Host "Unable to Connect to Graph; exiting"
}
I added the Write-Host at the beginning to make sure it’s pulling the appID and Cert Thumbprint properly from my secret store. I’m running this as a local, non-admin user. This script worked when I was on 3.3.7. I’ve upgraded a few times since then but hadn’t specifically tested this script and it doesn’t look like it’s been called in a while, so I don’t know when it broke.
The error I get is:
The system cannot find the file specified.
I don’t know what file it’d be looking for. The Graph module is installed and PSU sees it. I tried explicitly importing Microsoft.Graph.Identity.DirectoryManagement, but that didn’t make a difference.
I have another script that uses a certificate to connect to SharePoint via Connect-PnPOnline and that works fine so it doesn’t appear to be anything related to the Secrets/Certificates
Anyone else have Connect-MgGraph working in 3.5.5?
Thanks!