Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The type initializer for 'Microsoft.Graph.PowerShell.Authentication.Common.ProtectedFileProvider' threw an exception. #4491

Open
adhodgson1 opened this issue Mar 25, 2024 · 6 comments
Labels
DevOps Issues related to using M365DSC in DevOps Pending Information

Comments

@adhodgson1
Copy link
Contributor

I'm doing lots of exports through Azure Devops pipeline runs and these fail intermittently with the above error. I can't work out what is going on, think it may be related to subsequent export runs on the same Windows build agent.

Module version: 1.24.313.1
Command: Export-M365DSCConfiguration -MaxProcesses 8 -Components AADAdministrativeUnit -Path Output/AAD -FileName AADAdministrativeUnit.ps1 -CertificateThumbprint $($certificate.Thumbprint) -TenantId $TenantName -ApplicationId $ApplicationID

Output:
Exporting Microsoft 365 configuration for Components: AADAdministrativeUnit
Authentication methods specified:

  • Service Principal with Certificate Thumbprint
    Partial Export file was saved at: C:\Users\AzDevOps\AppData\Local\Temp\5802d33c-e961-486f-a9d1-9dda01982199.partial.ps1
    ##[error]The type initializer for 'Microsoft.Graph.PowerShell.Authentication.Common.ProtectedFileProvider' threw an exception.

I've tried running with verbose but it doesn't show anything extra in that stage.

@andikrueger
Copy link
Collaborator

Did you include the following steps in your pipeline:

Update-M365DSCDependencies
Uninstall-M365DSCOutdatedDependencies

This error looks like an issue with the preinstalled versions in the pipeline host.

@andikrueger andikrueger added Pending Information DevOps Issues related to using M365DSC in DevOps labels Mar 27, 2024
@adhodgson1
Copy link
Contributor Author

Yes those commands are being issued on pipeline runs. The host we are using is a private ADO build agent. I actually resolved this by getting the team that runs these agents to recycle the agent after every run, so its something going on with the agent after an export. Still not sure what is causing it, seems also to be intermittent. Prefer recycled build agents anyway.

@jadamones
Copy link

I'm having the exact same issue. Have you made any progress on this or you have stuck to recycling the agents? #4622

@adhodgson1
Copy link
Contributor Author

adhodgson1 commented Apr 30, 2024 via email

@jadamones
Copy link

@adhodgson1 Thanks for the response and, yeah, same issue here. I'm attempting to run an export job task in the same pipeline that I'm running the compliance check script from the whitepaper. I've discovered that running it in a completely separate pipeline works just fine, but I want this task to run after the compliance test fails. When you say that you are recycling agents, does that mean that you are destroying the VMs and creating new ones just for the one job or are you doing something different like agent maintenance?

@adhodgson1
Copy link
Contributor Author

adhodgson1 commented May 2, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DevOps Issues related to using M365DSC in DevOps Pending Information
Projects
None yet
Development

No branches or pull requests

3 participants