Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

AADAccessReviewDefinition - Fails to export when "No access to review" is in the portal

Open FabienTschanz opened this issue 5 months ago • 9 comments

Sounds good, before I'll let you go, I just found (perhaps) a bug with AADAccessReviewDefinition. I have extracted 85 instances but the last 2 gave me issues. It's most likely because there are warnings in Entra itself. The warning in Entra says: ([Triangle with exclamation mark] No access to review. Probably some ref. to a hard deleted object. However, in DSC it just fails to export with error message: An error occured while exporting resource {AADAccessReviewDefinition}: Response status code does not indicate success: BadRequest (Bad Request).

Originally posted by @artorro in #7273

Do you perhaps have a screenshot of that and do you know if the target of the review is a group that was deleted? I'd like to try and reproduce the scenario. What is the error from Export-M365DSCConfiguration in the console?

FabienTschanz avatar Jul 03 '26 09:07 FabienTschanz

The group is not deleted, it's just empty. Image In Export-M365DSCConfiguratio it just says: An error occured while exporting resource {AADAccessReviewDefinition}: Response status code does not indicate success: BadRequest (Bad Request).

artorro avatar Jul 07 '26 09:07 artorro

Does it show which line is affected? If an error occurs, it usually creates a error log file with some more details. These details would be great to have, or otherwise using $error[0] | Select-Object -Property * in the PowerShell window should show more information as well.

I have two access reviews in my tenant which also say that there is no access to review and I can export them without issues. Can you tell me how it is configured? If it's something private, hit me up on LinkedIn, I'd appreciate as many details as possible to help you get them exported. Thanks.

FabienTschanz avatar Jul 09 '26 21:07 FabienTschanz

It seems like when a resource has e.g. 10 objects and one of them fails then it doesn't export 9 of them but just skips the entire resource. I think that's what has happened... Here is another example where it processes correctly 3/5 but then doesn't export the entire resource: [7/11] Extracting [AADEntitlementManagementAccessPackageCatalogResource] using {CertificateThumbprint}... |---[1/5] B2B Host approver |---[1/5] Guest Onboarding✅ |---[2/5] Guest Onboarding App✅ Error Log created at {file://C:/Users/xxxx/AppData/Local/Temp/25068-M365DSC-ErrorLog.log} Error Log created at {file://C:/Users/xxxx/AppData/Local/Temp/25068-M365DSC-ErrorLog.log} |---[3/5] Host - PowerApp V2❌ An error occurred while exporting resource {AADEntitlementManagementAccessPackageCatalogResource}: Response status code does not indicate success: NotFound (Not Found).

artorro avatar Jul 17 '26 12:07 artorro

Understood. I'll check the code and try to come up with a way where the export can continue if one instance fails. The way it's structured right now it's unfortunately not easy to achieve. Trying to get there however.

FabienTschanz avatar Jul 23 '26 14:07 FabienTschanz

@artorro Does it create any error log file? If yes, can you share the line where the issue occurred? There's pretty much no place possible where the error message can come from and I'm a bit lost there. For AADEntitlementManagementAccessPackageCatalogResource, I think I have it, see #7369.

FabienTschanz avatar Jul 27 '26 11:07 FabienTschanz

This is how the log looks like: |---[80/82] [REDACTED]✅ Error Log created at {file://C:/Users/RUNNER~1/AppData/Local/Temp/7032-M365DSC-ErrorLog.log} Error Log created at {file://C:/Users/RUNNER~1/AppData/Local/Temp/7032-M365DSC-ErrorLog.log} |---[81/82] [REDACTED]❌ An error occurred while exporting resource {AADAccessReviewDefinition}: Response status code does not indicate success: BadRequest (Bad Request). [2/2] Extracting [AADAccessReviewPolicy] using {AccessTokens}...

artorro avatar Jul 28 '26 08:07 artorro

Do you happen to have access to that ErrorLog.log and can share the contents of it?

FabienTschanz avatar Jul 28 '26 09:07 FabienTschanz

@artorro Any updates from your side?

FabienTschanz avatar Aug 18 '26 21:08 FabienTschanz

Closing it. If it still appears, let me know.

FabienTschanz avatar Sep 17 '26 18:09 FabienTschanz