Click HERE to see how Saviynt Intelligence is transforming the industry. |
09/27/2022 07:43 AM
Hi!
Can i use CreateAccountJSON to initiate Powershell in Target Windows Server, which is only writing one word in Notepad in Windows Server?
{
"accountIdPath":"accountName",
"responseColsToPropsMap":{
},
"call":[
{
"name":"call",
"connection":"auth",
"url":"https://xx.xx.xx.x:443/SaviyntApp/PS/ExecutePSScript",
"httpMethod":"POST",
"httpParams":"{\"Script\":\"cd C:\\\\\\\\IDM;.\\\\\\\\test.ps1\"}",
"httpHeaders":{
"Authorization":"${access_token}"
},
"httpContentType":"application/x-www-form-urlencoded",
"SuccessResponses":{
"":["Success"]
},
"unsuccessResponses":{
"":["Failed"]
}
}
]
}
I tried to do testing in Connection JSON, but Connection Test is failing when i have testConnectionParam included into it?
{
"authentications":{
"auth":{
"authType":"basic",
"maxRefreshTryCount":5,
"properties":{
"userName":">username<",
"password":">password<"},
"authError":["InvalidAuthenticationToken","AuthenticationFailed"],
"retryFailureStatusCode":[401],
"testConnectionParams": {
"http": {
"url":"https://>ComputerName<.com/SaviyntApp/PS/ExecutePSScript",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType":"application/x-www-form-urlencoded",
"httpMethod": "POST",
"httpParams": "{\"Script\":\"C:\\\\\\\\IDM;.\\\\\\\\test.ps1\"}"
}
}
}
}
}
09/27/2022 09:31 AM
https://saviynt.freshdesk.com/support/solutions/articles/43000521736-rest-connector-guide%C2%A0
Refer Example 6
09/27/2022 10:07 AM
Hi! So this file in Example 6 >PSScript.ps1 can have any content e.g. it executes Powershell script that writes something in file? I am not trying to create Account in this example, but only testing if REST call will initiate powershell script in Windows Server?
09/27/2022 12:32 PM
You can have any script in powershell .ps1
09/27/2022 11:12 AM
Hi!
When i run CreateAccountJSON
{
"accountIdPath":"accountName",
"responseColsToPropsMap":{
},
"call":[
{
"name":"call",
"connection":"auth",
"url":"https://xx.xx.xx.x:443/SaviyntApp/PS/ExecutePSScript",
"httpMethod":"POST",
"httpParams":"{\"Script\":\"cd C:\\\\\\\\IDM;.\\\\\\\\test.ps1\"}",
"httpHeaders":{
"Authorization":"${access_token}"
},
"httpContentType":"application/x-www-form-urlencoded",
"SuccessResponses":{
"":["Success"]
},
"unsuccessResponses":{
"":["Failed"]
}
}
]
}
I get this as response
"call":{"headers":{"Server":"Microsoft-HTTPAPI/2.0","Connection":"close","Content-Length":"315","Date":"Tue, 27 Sep 2022 18:09:03 GMT","Content-Type":"text/html; charset=us-ascii"},"statusCode":404,"description":null,"status":"Failed"}}
Does it mean that it can not find file from location?
09/27/2022 12:32 PM
Try hardcoding of Authorization token
09/27/2022 10:03 PM
Hi!
I got SSL certificate as Public in base64 format .cer. in Developers handbook it is said that it should be enough to make API calls.
09/28/2022 04:25 AM
Are you able to make api call from postman, if yes share screenshot
09/29/2022 12:00 AM
Hi! I can not access Production Win Server with Postman.
But i am getting error of this ConnectionJSON, issue might be that we do not have connectivity from SC 2.0 towards Windows server via port 443, i have a ticket about this.
{
"authentications": {
"auth": {
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed"
],
"authType": "basic",
"maxRefreshTryCount": 1,
"properties": {
"password": "xxxxxxxxxxxxxxxxxxx",
"userName": "domain\username"
},
"retryFailureStatusCode": [
401
],
"testConnectionParams": {
"http": {
"url": "https://xx.xx.xx.x/SaviyntApp/PS/ExecutePSScript",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType":"application/x-www-form-urlencoded",
"httpMethod": "POST",
"httpParams": "{\"Script\":\"SCRIPT=Test-NetConnection xx.xx.xx.x -Port 443\"}"
}
}
}
}
}
Error While Test connection: JSON syntax exception found in the following connection parameters - ConnectionJSON
i thing this might be causing it: "userName": "domain\username"
i know that this works(userName": "domain\username) in upper Saviynt versions that we have
for some other customers, why it does not work here?
We have version: Release-2021.0.4.7
Best Regards,Päivi