
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Exception occurred while executing operation Cloud REST - add response to context. Custom operation Failed to run script due to the following error: JAVASCRIPT_CODE_FAILURE: Exception occurred when making http call to the provider. Cause: Remote host terminated the handshake
Is this a timeout issue?
How can I make sure this is the Credentials are right? and authentication is OK between SN and Azure?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Mariano Lemus ,
This usually indicates a TLS/SSL handshake termination, not a simple timeout. In the context of Azure Cloud Discovery in ServiceNow, the issue can come from
* Invalid or expired Azure credentials (client secret, certificate, or token).
* TLS version mismatch (Azure endpoints require TLS 1.2+).
* Firewall / proxy / MID Server connectivity issue blocking outbound HTTPS.
* Wrong resource endpoint or scope in the ServiceNow Cloud Account definition.
Steps to Troubleshoot & Fix
1. Validate Credentials in ServiceNow
* Navigate to Cloud Management → Cloud Accounts.
* Test the Azure account connection by clicking Validate.
* If validation fails → check if the client_id, tenant_id, subscription_id, and client_secret/cert are correct.
2. Check Authentication Flow
* Try to fetch an Azure token manually using your credentials
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<SECRET>&resource=https://management.azure.com/" \
https://login.microsoftonline.com/<TENANT_ID>/oauth2/token
* If you don’t get a valid token → credentials are wrong or expired.
3. TLS & Handshake
* Ensure the MID Server JVM is configured for TLS 1.2+.
* On the MID Server host → run:
openssl s_client -connect management.azure.com:443
* Check if the handshake succeeds.
* If it fails → network or certificate trust issue.
4. Firewall / Proxy Check
* Make sure the MID Server can reach:
* https://management.azure.com
* https://login.microsoftonline.com
* If your network uses a proxy, ensure the MID Server is configured with proxy settings.
5. Timeout vs Handshake
* This is not a simple timeout (otherwise you’d see a socket timeout error).
* “Remote host terminated handshake” = Azure rejected the SSL negotiation (often bad cert, protocol, or blocked request).
Next Steps for You
1. Run Validate Connection in Cloud Accounts.
2. Confirm Azure credentials by fetching a token manually.
3. Run an openssl test from the MID Server host.
4. If it’s still failing → enable MID Server debug logs for AzureApiCommand and check if it’s failing on TLS or authentication.
Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
Thank You
AJ - TechTrek with AJ - ITOM Trainer
LinkedIn:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
Topmate:- https://topmate.io/aj_techtrekwithaj (Connect for 1-1 Session)
ServiceNow Community MVP 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Mariano Lemus ,
This usually indicates a TLS/SSL handshake termination, not a simple timeout. In the context of Azure Cloud Discovery in ServiceNow, the issue can come from
* Invalid or expired Azure credentials (client secret, certificate, or token).
* TLS version mismatch (Azure endpoints require TLS 1.2+).
* Firewall / proxy / MID Server connectivity issue blocking outbound HTTPS.
* Wrong resource endpoint or scope in the ServiceNow Cloud Account definition.
Steps to Troubleshoot & Fix
1. Validate Credentials in ServiceNow
* Navigate to Cloud Management → Cloud Accounts.
* Test the Azure account connection by clicking Validate.
* If validation fails → check if the client_id, tenant_id, subscription_id, and client_secret/cert are correct.
2. Check Authentication Flow
* Try to fetch an Azure token manually using your credentials
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<SECRET>&resource=https://management.azure.com/" \
https://login.microsoftonline.com/<TENANT_ID>/oauth2/token
* If you don’t get a valid token → credentials are wrong or expired.
3. TLS & Handshake
* Ensure the MID Server JVM is configured for TLS 1.2+.
* On the MID Server host → run:
openssl s_client -connect management.azure.com:443
* Check if the handshake succeeds.
* If it fails → network or certificate trust issue.
4. Firewall / Proxy Check
* Make sure the MID Server can reach:
* https://management.azure.com
* https://login.microsoftonline.com
* If your network uses a proxy, ensure the MID Server is configured with proxy settings.
5. Timeout vs Handshake
* This is not a simple timeout (otherwise you’d see a socket timeout error).
* “Remote host terminated handshake” = Azure rejected the SSL negotiation (often bad cert, protocol, or blocked request).
Next Steps for You
1. Run Validate Connection in Cloud Accounts.
2. Confirm Azure credentials by fetching a token manually.
3. Run an openssl test from the MID Server host.
4. If it’s still failing → enable MID Server debug logs for AzureApiCommand and check if it’s failing on TLS or authentication.
Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
Thank You
AJ - TechTrek with AJ - ITOM Trainer
LinkedIn:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
Topmate:- https://topmate.io/aj_techtrekwithaj (Connect for 1-1 Session)
ServiceNow Community MVP 2025

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Step 4 did the trick, thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @Mariano Lemus ,
If you issue has been resolved, You can marked the solution as Accepted and Helpful so that will be reference in future by others.
Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
Thank You
AJ - TechTrek with AJ - ITOM Trainer
LinkedIn:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
Topmate:- https://topmate.io/aj_techtrekwithaj (Connect for 1-1 Session)
ServiceNow Community MVP 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Mariano Lemus There are different causes of it like
1.Certificate issue
2. Network firewall issue
3.End point issue
4. Invalid Credentials configure
and for Troubleshoot already @AJ-TechTrek have share the steps. If my answer helps you mark helpful and accept solution .