Fortinet-GetEntityDetails not authenticating against Fortigate
Describe the bug Receive error "Unexpected character encountered while parsing value: <. Path '', line 0, position 0." when running function app Fortinet-GetEntityDetails
To Reproduce Steps to reproduce the behavior:
- Assign Fortinet-FortiGate-ResponseOnIP playbook to analytics rule
- Trigger rule so that logic app fires
- Logic app will get to "check address object is already in firewall" and will hang.
- Check function app monitor to confirm that API is calling Fortinet-GetEntityDetails and that error is generated
Expected behavior API should run through so that logic app can complete.
Screenshots

Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.
Issue is due to the access_code not being appended to the request to the fortigate and reply has the following when unauthorised.
< ! DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN ">
Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.
Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.
Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.
I believe this issue has something to do with the keyvault/managed user identity. I have gotten this function to work by appending the &access_token=[access token] to the line of code here
var httpRequest = new HttpRequestMessage(HttpMethod.Get, new Uri(endpointURL + baseURL + entity + "?" + filter + "&access_token=[accesstoken]"));
and removing the following lines from the function. var key = Environment.GetEnvironmentVariable("Authorization", EnvironmentVariableTarget.Process); httpRequest.Headers.Add("Authorization", key.ToString());
Not sure where the error is occurring though
Hi, Wanted to check in to see if there were any thoughts on this one?
Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.
@lior-tamir : This looks to be related to Playbooks, can you please take a look.. Thanks !!!
Hi, Wanted to check in to see if there was anything we could look at on this one?
We are working on this one and will update once we have solution.
Hi @scottbrien01 Apologies for delay in responding. I have tried to reproduce the error but, we are not able to reproduce this. Can you please help us by checking below points
Have you authorized this function app to access key vault resource ?
- Open function app and go to Identify and capture the object ID Capture Object ID
- Add azure function app to key Vault access policy Add access policy
Can you try printing "key" and "httpRequest" value and see whether we have "key" appearing in httpRequest
- log.LogInformation(key);
- log.LogInformation(httpRequest.ToString()); - Try printing after appending the "key" to the request
Log is appearing like below -

Hi Anki,
We resolved this issue internally, the issue is with the authorization key. since it is being included in the http header you need to include the codeword bearer: "api key". so instead of just entering the API key in the keyvault you need to put "bearer: "api key""
I think it would be best to automatically include the bearer: so users can simply put the API key in the key vault.
From Fortinet development site:

Cheers, Scott
Hi Scott,
Thank you for the update. Really appreciate it. We will update the code accordingly.
Thanks, Anki
Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.
Hi @scottbrien01 this bug is addressed now. Shall we close this issue ?
We will close this issue, please reopen incase you still face any issues... Thanks!!!
Thank you for submitting an Issue to the Azure Sentinel GitHub repo! You should expect an initial response to your Issue from the team within 5 business days. Note that this response may be delayed during holiday periods. For urgent, production-affecting issues please raise a support ticket via the Azure Portal.
Hello,
I hope you are well :)
Please when I run this function , I received this error : The remote certificate is invalid according to the validation procedure.
What do you think ?
Thanks in advance