I am looking to create a flow somewhere in the Azure stack to allow me to get M2M authentication between Azure Synapse and NetSuite. The goal is to be able to drop the use of the ODBC connector and switch to making REST calls for pulling data from NetSuite into Synapse.
I have followed the documentation as best as I can from Oracles Help. The integration record is created, so the only thing I am missing is what needs to happen on the Azure side to get the two systems to authenticate with each other.
I have reviewed this post but this looks like it would be a setup for an API to access Azure resources, where I want Azure Synapse to get the data from NetSuite.
UPDATE: I was able to get M2M to work within NetSuite using Postman by following this video. I am still trying to figure out how to get this created in Azure to allow me to create a JWT to call NetSuite from Synapse.
UPDATE 2: I am now using a spark pool to sign the JWT and when it is run locally I am able to authenticate and get an access token returned.
import time import jwt import http.client sec = '-----BEGIN PRIVATE KEY-----\nMIIG/gIBADANBgkqhkiG9w0BAQEFAASCBugwggbkAgEAAoIBgQDkW+cE7G05KETS\n#################################################################################\n-----END PRIVATE KEY-----' jwtheader = {"alg": "RS256","typ": "JWT","kid": "rn9dnIL###############" } iat = round(time.time(),3) payload_data = {"iss": "6477f8bea7f####################","scope": ["restlets", "rest_webservices", "suite_analytics"],"aud": "https://#######.suitetalk.api.netsuite.com/services/rest/auth/oauth2/v1/token","exp": iat + 3600,"iat": iat } token = jwt.encode(payload=payload_data,key=sec,headers = jwtheader) conn = http.client.HTTPSConnection("#######.suitetalk.api.netsuite.com") payload = 'grant_type=client_credentials&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&client_assertion='+token headers = {'Content-Type': 'application/x-www-form-urlencoded' } conn.request("POST", "/services/rest/auth/oauth2/v1/token", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
However when I use a spark pool in Azure Synapse I am returned with {"error":"invalid_grant"}. With no change in code. I have tried both the requests library as well as the http.client(shown above).