If you encounter the "Command invocation failed with exception" error, it typically indicates an issue during PowerShell execution in your environment. While this error can be broad, we have identified two primary scenarios that may affect you and their respective resolutions.
This message serves as a general notification that a common could not be completed. To resolve this, you must identify the specific inner exception details provided in the report or error log. The following scenarios may arise during deployment.
Multiple Recipients Match the Identity
When this error occurs, you will see a detail stating “There are multiple recipients matching the identity 'name@domain.com'. Please specify a unique value.”
This error occurs when the system attempts to create or reference a group with a name or email address that matches an existing group in your tenancy. To resolve this error, change the name of your selected Defend group to a value that does not currently exist in your environment.
Transport Rule Character Limit Exceeded
When this error occurs, you will see a detail stating “The transport rule can’t be created because you’ve exceeded the number of characters available. Your transport rules are using [X] characters, and the maximum is 20,480”.
This error occurs because Microsoft has a hard limit of 20,480 characters for word or pattern matching across all transport rules. To resolve this error, review your existing transport rules and reduce the character count by either:
- Removing unnecessary words or regular expressions from conditions
- Consolidating or deleting obsolete transport rules
For further details on this limitation, please refer to Microsoft's documentation on Transport Rule Limits Transport Rule Limits.