Get-AzureADUser : ProvisioningErrors how to export to “normal readable format

Mali Stane 91 Reputation points
2020-10-29T14:59:44.883+00:00

Hi,
I know, that I can generate export of provisioning errors with command…
$errors = (Get-MsolUser -UserPrincipalName "User1@Xdomain.com").Errors
$errors | foreach-object {"`nService: "+ $.ErrorDetail.Name.split("/")[0]; "Error Message: "+ $.ErrorDetail.ObjectErrors.ErrorRecord.ErrorDescription}
But I DO NOT want to use Get-MsolUser. I would like to user command that I schedule as part of schedule report with azure automation and I use Get-AzureAD**** .
If I run command : Get-AzureADUser -ObjectId User1@Xdomain.com | select -expend ProvisioningErrors
I get following output…
ProvisioningErrors : {class ProvisioningError {
ErrorDetail:
Resolved: false
Service: exchange
Timestamp: 04.10.2020 11:32:05
}
, class ProvisioningError {
ErrorDetail:
Resolved: false
Service: exchange
Timestamp: 04.10.2020 11:32:05
}
, class ProvisioningError {
ErrorDetail:
Resolved: false
Service: exchange
Timestamp: 04.10.2020 11:32:05
}
, class ProvisioningError {
ErrorDetail: <ServiceInstance Name="exchange/EURP300-002-02" xmlns="http://schemas.microsoft.com/online/error/2010/07">
<ObjectErrors>
<ErrorRecord>
<ErrorCode>ExFEBFF0</ErrorCode>
<ErrorParameters>
<ErrorParameter>Disable-MailUser</ErrorParameter>
</ErrorParameters>
<ErrorDescription>The execution of cmdlet Disable-MailUser failed.</ErrorDescription>
</ErrorRecord>
<ErrorRecord>
<ErrorCode />
<ErrorParameters />
<ErrorDescription>Exchange can't disable the mailbox "User1" because it is on In-Place Hold. ComplianceTagHoldApplied: false, DelayHoldApplied: false, DelayReleaseHoldApplied: true, OrganizationPolicies Applied:
mbxcd5a22f0015a41e146378520433b12c1:2,mbx147fb234329154a27938a69f4a465ef7h:2, UserPolicies Applied: , restrictivePolicies Applied: . For more information, please see the PowerShell cmdlets, Get-OrganizationConfig
<></ErrorDescription>
</ErrorRecord>
</ObjectErrors>
<LinkErrors />
</ServiceInstance>
Resolved: false
Service: exchange
Timestamp: 04.10.2020 11:32:05
}
}
I try to export this to CSV each error is then split and put together under on column with delimiter.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,420 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. 2020-10-29T16:56:07.997+00:00

    Due the complex (non flat) schema I would export this as JSON.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.