Export fails due to MSCloudLoginAssistant variable complain
Description of the issue
Update from 1.26.520.1 to 1.26.527.1 on the same machine
Trying to export various workloads fails. Narrowing down to export of one single resource gives me a empty variable with underlying MSCloudLoginAssistant parameters
I'm using the CertificateThumbprint, ApplicationID, TenantID tuple,
Did something change?
Microsoft 365 DSC Version
1.26.527.1
Which workloads are affected
Azure Active Directory (Entra ID)
The DSC configuration
N/A
Verbose logs showing the problem
Export-M365DSCConfiguration -Path . -Components @('AADConditionalAccessPolicy') @creds_M365DSC
Exporting Microsoft 365 configuration for Components: AADConditionalAccessPolicy
Authentication methods specified:
- Service Principal with Certificate Thumbprint
Starting export in sequential mode...
Connect-MgGraph : ClientCertificateCredential authentication failed: Keyset does not exist
At C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.1.66\Workloads\MicrosoftGraph.ps1:96
char:25
+ ... Connect-MgGraph -ClientId $Script:MSCloudLoginConnectionP ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-MgGraph], AuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Authentication.Cmdlets.ConnectMgGraph
Error Log created at {file://D:/Users/Dimitri/AppData/Local/Temp/2/11528-M365DSC-ErrorLog.log}
[1/1] Extracting [AADConditionalAccessPolicy] using {CertificateThumbprint}...❌
An error occurred while exporting resource {AADConditionalAccessPolicy}: Authentication needed. Please call Connect-MgGraph.
⌛ Export took {1 seconds} for {0 instances}
Successful exports: {0}
Failed exports: {1}
❌ Export completed with errors.
Environment Information + PowerShell Version
We didn‘t change anything in our logic for certificate authentication. Keyset does not exist is something I haven‘t seen before and I don‘t think it‘s related to M365DSC. Can you check with suggestions from this link?
https://forums.powershell.org/t/connect-mggraph-keyset-does-not-exist-error-when-trying-to-authenticate-with-certificate/24052/3
Okay this one is on me :| Since the introduction of the DLL, I have a script to kill powershell sessions since otherwise the uninstallation of an older version during upgrading doesn't work. Under a mix of PWSH / Powershell running processes, one of the session is not relaunched as administrator, thus no access to the certificate's private key, thus the error message.
Got it, thank you.