You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ActionLogs.Add('Added Service Principal to Exchange Online')
96
96
} catch {
97
97
$SpError=$_.Exception.Message
98
-
if ($SpError-match'already exist') {
99
-
$ActionLogs.Add('Service Principal already added to Exchange Online')
100
-
} else {
101
-
$ActionLogs.Add("Failed to add Service Principal to Exchange Online: $SpError")
102
-
$HasFailures=$true
98
+
switch ($SpError) {
99
+
{ $_-match'already exist' } { $ActionLogs.Add('Service Principal already added to Compliance Center') }
100
+
{ $_-match'Response status code does not indicate success' } { $ActionLogs.Add('Could not connect to Exchange, we received an access denied. This is expected if you do not have an exchange license.'); $HasFailures=$true }
101
+
default { $ActionLogs.Add("Failed to add Service Principal to Compliance Center: $SpError"); $HasFailures=$true }
0 commit comments