If I resync or re-migrate an already provisioned user with a custom license into O365, then the logic tries to reassign the license.
This results in an error from O365 (which is not very useful)



DirXML: [01.19.16 09:35:21.264]: TRACE: Remote Loader: Calling SubscriptionShim.execute()
DirXML: [01.19.16 09:35:21.264]: TRACE:
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product edition="Advanced" version="4.0.2.7">DirXML</product>
<contact>Novell, Inc.</contact>
</source>
<input>
<modify class-name="MSolUser" event-id="ACME001p-NDS#20160119083518#3#1:feae8917-648f-4120-a92c-d21bab6d6673" from-merge="true" qualified-src-dn="O=acme\OU=Loc1\OU=People\CN=u12345" src-dn="\TREE\acme\Loc1\People\u12345" src-entry-id="12345">
<association>5cad65a1-17c3-40a4-8d32-c390c4c0cd0e</association>
<modify-attr attr-name="BlockCredential">
<remove-all-values />
<add-value>
<value type="state">False</value>
</add-value>
<remove-all-values />
</modify-attr>
<modify-attr attr-name="LicenseAssignment">
<add-value>
<value type="string">acme:ENTERPRISEPACK(Exchange)</value>
</add-value>
</modify-attr>
<modify-attr attr-name="UsageLocation">
<add-value>
<value type="string">NO</value>
</add-value>
<remove-all-values />
<remove-all-values />
</modify-attr>
</modify>
</input>
</nds>

DirXML: [01.19.16 09:35:21.357]: TRACE: SUB: get-pssession
DirXML: [01.19.16 09:35:21.357]: TRACE: : Set-MailBox -Identity '5cad65a1-17c3-40a4-8d32-c390c4c0cd0e'
DirXML: [01.19.16 09:35:22.231]: TRACE: SUB: get-pssession
DirXML: [01.19.16 09:35:22.247]: TRACE: : Set-MSolUser -BlockCredential $False -UsageLocation 'NO' -ObjectID '5cad65a1-17c3-40a4-8d32-c390c4c0cd0e'
DirXML: [01.19.16 09:35:22.418]: TRACE: SUB: get-pssession
DirXML: [01.19.16 09:35:22.418]: TRACE: : Set-MSolUserLicense -UserPrincipalName 'u12345@acme.com' -AddLicenses 'acme:ENTERPRISEPACK' -LicenseOptions $acme_ENTERPRISEPACK_Exchange
DirXML: [01.19.16 09:35:22.793]: TRACE: : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.

The shim or policy should check first if there is a need to add the license and optimize this out.