Applying Sensitivity Labels to files prior to Migration

%3CLINGO-SUB%20id%3D%22lingo-sub-1980160%22%20slang%3D%22en-US%22%3ERe%3A%20Applying%20Sensitivity%20Labels%20to%20files%20prior%20to%20Migration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1980160%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F4865%22%20target%3D%22_blank%22%3E%40Haniel%20Croitoru%3C%2FA%3E%26nbsp%3BIf%20your%20data%20is%20already%20migrated%2C%20you%20can%20use%20MCAS%20for%20automatic%20labeling.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcloud-app-security%2Fazip-integration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EIntegrate%20Azure%20Information%20Protection%20with%20Cloud%20App%20Security%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1969876%22%20slang%3D%22en-US%22%3EApplying%20Sensitivity%20Labels%20to%20files%20prior%20to%20Migration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1969876%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'm%20in%20the%20process%20of%20migrating%20a%20client%20from%20a%20file%20share%20to%20Microsoft%20365.%26nbsp%3B%20Part%20of%20the%20migration%20includes%20applying%20sensitivity%20labels.%26nbsp%3B%20So%20far%2C%20we%20did%20an%20inventory%20and%20know%20what%20labels%20should%20be%20applied%20to%20which%20file.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat%20is%20the%20best%20way%20to%20apply%20labels%20at%20such%20a%20granular%20level%3F%26nbsp%3B%20I%20tried%20using%20the%20%3CSTRONG%3ESet-AIPFileLabel%3C%2FSTRONG%3E%20PowerShell%20cmdlet%20in%20a%20loop%2C%20but%20found%20it%20to%20be%20very%20unstable.%26nbsp%3B%20It%20crashes%20over%2050%25%20of%20the%20time%2C%20taking%20down%20the%20entire%20PowerShell%20session.%26nbsp%3B%20When%20it%20doesn't%20crash%2C%20it%20uses%20up%20a%20very%20large%20amount%20of%20memory%20that%20is%20not%20being%20released%20until%20the%20entire%20script%20ends.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAny%20feedback%20is%20much%20appreciated.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1969876%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Information%20Protection%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMigration%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
MVP

Hi all,

 

I'm in the process of migrating a client from a file share to Microsoft 365.  Part of the migration includes applying sensitivity labels.  So far, we did an inventory and know what labels should be applied to which file.

 

What is the best way to apply labels at such a granular level?  I tried using the Set-AIPFileLabel PowerShell cmdlet in a loop, but found it to be very unstable.  It crashes over 50% of the time, taking down the entire PowerShell session.  When it doesn't crash, it uses up a very large amount of memory that is not being released until the entire script ends.

 

Any feedback is much appreciated.

6 Replies

@Haniel Croitoru If your data is already migrated, you can use MCAS for automatic labeling. 

 

Integrate Azure Information Protection with Cloud App Security | Microsoft Docs

I also have this problem!

Doesn't matter how simple the implementation is.. simply calling this function causes a hardcrash of powershell ide or command line. as you said around 50% of the time.
I also have this problem. Set-AIPFileLabel will crash a huge amount of the time either with a System.NullReferenceException: or sometimes even worse with a " System.AccessViolationException: Attempted to read or write protected memory."

Using MCAS is not really an replacement for powershell.

@Bill_Davis

 

Has anyone found anything from MS on this?

 

We too are receiving these random crashes. Initially we thought it was due to some complex hash tables we used to reset labels.

 

We made some minor mods but still randomly get these errors. 

 

TRY/CATCH did not help. Any fixes found on your end?

@StephenES  Its a known bug, MS will fix it in the next release :(

@StephenES 

 

We noticed this was worse when deleting files during the labeling process. Our workaround is to leave the files around until we've labeled them all, and then delete them. My guess is that there is some issue where the powershell commands are holding onto file handles and breaking if those files disappear.