PARTNERS - Please join us for our upcoming webinar:
Leveraging Intelligent Recommendations for Operational Transformation.
AMS Partners click HERE | EMEA/APJ Partners click HERE

MS Exchange REST connector_Unable to provision

jbaskaran
Regular Contributor
Regular Contributor

Hi All,

We are trying to Enable and Disable the Remote Exchange mailbox, but we are unable to succeed.

Initially it throws permission error "h1:Server Error, id:header], [div:[fieldset:[h2:403 - Forbidden: Access is denied., h3:You do not have permission to view this directory or page using the credentials that you supplied.], class:content-container], id:content]]]]]" 

We have received the updated script from client but now connection is getting failed "Some issues are preventing a successful connection and needs to be corrected. JSON Syntax error"

Please find the below JSON's

"CreateAccountJSON : 

{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "http://********.**************.com/SaviyntApp/PS/ExecutePSScript",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/x-www-form-urlencoded",
"httpMethod": "POST",
"httpParams": "{\"Script\": \\"$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'http://*********.*******.com/powershell';
-Authentication Kerberos
Import-PSSession \\$Session -AllowClobber -DisableNameChecking | Out-Null
Import-PSSession \\$session -CommandName Enable-RemoteMailbox -AllowClobber; Enable-RemoteMailbox -Identity '${user.systemUserName}@*******.com' -RemoteRoutingAddress '${user.systemUserName}@*******.mail.onmicrosoft.com' -Alias '${user.systemUserName}' -PrimarySmtpAddress '${user.systemUserName}@*******.com';
Import-PSSession \\$session -CommandName Set-RemoteMailbox -AllowClobber; Set-RemoteMailbox -Identity '${user.systemUserName}@*******.com' -EmailAddresses @{ Add='smtp:${user.systemUserName}@*******.com','smtp:${user.systemUserName}@*******.mail.onmicrosoft.com'}; Remove-PSSession \\$session\"}",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
},
"unsuccessResponses": {
"statusCode": [
500,
404,
403,
401
]
}
}
]
}

DisableAcountJSON:

{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "entAuth",
"url": "http://o365-exch.*******.com/SaviyntApp/PS/ExecutePSScript ",
"httpMethod": "POST",
"httpParams": "{\"script\": \"\\$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'http://o365-exch.*******.com/powershell '; -Authentication Kerberos
Import-PSSession $Session -AllowClobber -DisableNameChecking | Out-Null
Import-PSSession $session -CommandName Disable-RemoteMailbox -AllowClobber; Disable-RemoteMailbox -Identity '${user.systemUserName}@*******.com'; Remove-PSSession \\$Session\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"response[9].Objectreturned": [
"Success"
]
},
"unsuccessResponses": {
"response[9].Objectreturned": [
"Failure"
]
}
}
]
}

Connection JSON:

{

  "authentications": {

    "userAuth": {

      "authType": "Basic",

      "url": "http://o365-exch.************.com/SaviyntApp/PS/ExecutePSScript ",

      "httpMethod": "POST",

      "httpParams": {},

      "httpHeaders": {},

      "httpContentType": "text/html",

      "properties": {

        "userName": "********",

        "password": "*********"

      },

      "expiryError": "ExpiredAuthenticationToken",

      "authError": [

        "InvalidAuthenticationToken",

        "AuthenticationFailed"

      ],

      "timeOutError": "Read timed out",

      "errorPath": "error.code",

      "maxRefreshTryCount": 5,

      "tokenResponsePath": "access_token",

      "tokenType": "Basic",

      "accessToken": "Basic xxx",

      "testConnectionParams": {

        "http": {

          "url": "http://o365-exch.*************.com/SaviyntApp/PS/ExecutePSScript ",

          "httpMethod": "POST",

          "requestBody": "",

          "httpParams": {},

          "httpHeaders": {

            "contentType": "application/json",

            "Authorization": "${accessToken}"

          },

          "httpContentType": "application/json"

        },

        "successResponse": [],

        "successResponsePath": "responseText",

        "errors": [

          "fail",

          "error",

  "false"

        ],

        "errorPath": "responseText"

      }

    }

  }

}

Could you please help/assist in getting it resolved.

Regards

JB

[This message has been edited by moderator to disable URL hyperlink]

10 REPLIES 10

NM
Honored Contributor
Honored Contributor

Hi @jbaskaran , as per the error logs it seems to be permission, does your service account have all the required permissions?

jbaskaran
Regular Contributor
Regular Contributor

Hi @NM,

Initially we faced permission error but now the connector itself failing saying "Some issues are preventing a successful connection and needs to be corrected. JSON Syntax error""

NM
Honored Contributor
Honored Contributor

Share json?

jbaskaran
Regular Contributor
Regular Contributor

Already shared

jbaskaran
Regular Contributor
Regular Contributor

Fixed the syntax issue and test connection is successful but Task is not getting processed. So while checking the logs we could see that it throws error:

ot Webservice API Response: [headers:[Content-Type: text/html, Server: Null, X-Powered-By: Null, X-ASPNET-VERSION: Null, X-ASPNETMVC-VERSION: Null, Date: Fri, 02 Aug 2024 16:52:01 GMT, Content-Length: 1233], responseText:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.******">|<html xmlns="http://******">|<head>|<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>|<title>403 - Forbidden: Access is denied.</title>|<style type="text/css">|<!--|body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}|fieldset{padding:0 15px 10px 15px;} |h1{font-size:2.4em;margin:0;color:#FFF;}|h2{font-size:1.7em;margin:0;color:#CC0000;} |h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} |#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;|background-color:#555555;}|#content{margin:0 0 0 2%;position:relative;}|.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}|-->|</style>|</head>|<body>|<div id="header"><h1>Server Error</h1></div>|<div id="content">| <div class="content-container"><fieldset>| <h2>403 - Forbidden: Access is denied.</h2>| <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>| </fieldset></div>|</div>|</body>|</html>|, cookies:[], statusCode:403]

NM
Honored Contributor
Honored Contributor

Hi @jbaskaran , 403.. issue related to permission 

Is it working from postman @jbaskaran 

 

‼️‼️⚠️Keep company-specific private information masked on public forums, such as the name and URL & passwords.⚠️‼️‼️


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

jbaskaran
Regular Contributor
Regular Contributor

@rushikeshvartak , No it wasn't working from postman too. 

We have decided to use Win Ps connector and see if that resolves the issue.

  • You need first debug and fix postman issue 
  • work along with app team who provided access to service account

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Ok noted

Regards

JB