Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

Exporting configuration regularly fails from ADO pipeline with internal server error

Open MarzelLaning42 opened this issue 1 year ago • 7 comments

When updating Conditional Access Policies we almost always have to do this in 2 or more tries with the same configuration and Azure DevOps pipeline in M365DSC.

[Internal Server Error] : There was an internal server error while processing the request. Error ID: 
05a00c03-fd54-4471-9bb5-00bb32762dac
At D:\a\_temp\6502cc94-e479-4f68-aa9d-962413ddc8bb.ps1:29 char:3
Start-DSCConfiguration M365TenantConfig-Prodtenant -Wait -Force

CategoryInfo          : InvalidOperation: ({ Top = , Skip ... , Headers =  }:) [], CimException
FullyQualifiedErrorId : Internal Server Error,Microsoft.Graph.Beta.PowerShell.Cmdlets.GetMgBetaIdentityConditionalAccessPolicy_List
PSComputerName        : localhost
 
##[error]PowerShell exited with code '1'.

How can we troubleshoot this? Is it possible that the reason is that M365DSC uses the Beta-modules?

MarzelLaning42 avatar Oct 14 '25 14:10 MarzelLaning42

@MarzelLaning42 Hard to say what is causing the issue. Since it's already failing at the Get request (not even POST, which I was expecting at first), there is probably nothing we can do at all. We are simply calling the default beta endpoint, which the Entra portal is doing as well:

Image

What you can try and do is run the Get-MgBetaIdentityConditionalAccessPolicy manually and try to force it to fail. Either by running with a filter by display name, multiple times in a row, using delegated / application credentials etc.

FabienTschanz avatar Oct 15 '25 06:10 FabienTschanz

@FabienTschanz Do you know if it is unusual to manage (currently) 60+ Conditional Access policies with Microsoft365DSC?

MarzelLaning42 avatar Oct 15 '25 12:10 MarzelLaning42

I don't, but in my opinion this is not an unreasonable number of CA policies. Management of them should be easily possible. In one of my tenants, I have about 50 or 60 of them as well, and they do work without issues (but I'm not using an ADO pipeline for them, just manual since it's only testing). The internal server error suggests a hickup in the backend and not an issue with the code

FabienTschanz avatar Oct 15 '25 12:10 FabienTschanz

@MarzelLaning42 Do you still encounter the issue or did the situation improve?

FabienTschanz avatar Nov 19 '25 09:11 FabienTschanz

Hi Fabian, Thank you for inquiring. It appears to have improved. Several conditional access policies in my configuration had issues deploying because of missing objects (groups not found), which may be one of the causes. I noticed these errors when I reviewed the logs from the export-configuration. I will render some more policies to active in production later this week or next week, so I may have a better feeling if the deployment has indeed improved.

MarzelLaning42 avatar Nov 19 '25 11:11 MarzelLaning42

Awesome, thanks for the update. I'll leave the issue open and am curious how the situation behaves the next time you deploy the policies.

FabienTschanz avatar Nov 19 '25 12:11 FabienTschanz

I have run the pipelines with M365DSC debug option in Production again en modied/created multiple policies. There were no errors applying the policies anymore, so either the issue is fixed in M365DSC generic, or the errors in policy settings while applying the policies disturbed the complete run, or the debug function slows down the execution and thereby fixing the issue. So, please close for now.

MarzelLaning42 avatar Nov 24 '25 10:11 MarzelLaning42