AIP - GetAIPFileStatus and Set-AIP Labels cause Powershell to crash....any ideas?

Stephen Schuster 6 Reputation points
2021-08-04T14:59:58.297+00:00

So apparently the Powershell commands for Get AIPFileStatus and Setting a label are not working properly in bulk operations.

I have been testing this over the past two weeks and can consistently replicate this on both my personal machine and at work. My Personal Machine means my DEV Azure instance whereas work is using theirs.

From what I can tell there is no rhyme or reason to this and it may actually work from time to time, but it will ultimately fail with one of the two errors listed below:

An error has occurred that was not properly handled. Additional information is shown below. The Windows PowerShell process will exit.
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.

or...

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.InformationProtection.Internal.SdkWrapperPINVOKE.delete_Opaque(HandleRef jarg1)
at Microsoft.InformationProtection.Internal.Opaque.Dispose(Boolean disposing)
at Microsoft.InformationProtection.Internal.Opaque.Dispose()
at Microsoft.InformationProtection.Internal.ProtectionEngine.Observer.SwigDirectorMethodOnGetRightsForLabelIdSuccess(IntPtr rights, IntPtr context)

When this does happen it will also trigger an Event Viewer failure which is about as helpful as a poke in the eye:

ER1nTNoQB-pBihwE-t0SNeAB0RJOm6ekn8PtkU2Sw77qJQ

I have executed this via direct PowerShell, PowerShell ISE, and a Scheduled PowerShell Job. I do find that the scheduled job will continually run but when going through my log files I find that it does not apply the Labels properly or simply crashes when doping the initial get.

My final code looked something like this:

Get-ChildItem $strDestSource -File -Recurse | Get-AIPFileStatus | Where-Object {($_.SubLabelId -eq $aipExistingLabelId)}

I would use this for count purposes. Sometimes this fails ...

Then we would do the actual apply:

Get-ChildItem $strDestSource -File -Recurse | Get-AIPFileStatus | Where-Object {($_.SubLabelId -ne $aipExistingLabelId)} | Set-AIPFileLabel -LabelId $secID -PreserveFileDetails -JustificationMessage "Automated Labeling before migration"

...and again this would work sometimes but would eventually fail randomly.

To be fair I also grabbed the Get-ChildItem object and did a foreach loop and tried to update the files one by one, but again - random failure.

Function aip{
param([parameter(ValueFromPipeline)][object[]]$inclusionsFiles)
Write-Host "AIP Calculation for file: " $inclusionsFiles -ForegroundColor Green
Process{
foreach ($file in $inclusionsFiles){
try{
.....
Set-AIPFileLabel -Path $file.FullName -LabelId $aipSubLabelId -PreserveFileDetails -JustificationMessage "Automated Labeling before migration $startTime" | Out-Null
.....

Has ANYONE seen ANYTHING from MS on this bug. Is it confirmed, when is it going to be fixed????

Azure Information Protection
Azure Information Protection
An Azure service that is used to control and help secure email, documents, and sensitive data that are shared outside the company.
516 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,374 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Rich Matheisen 44,856 Reputation points
    2021-08-04T18:06:49.707+00:00

    You should report this problem at issues

    0 comments No comments