Fortinet Connector doesn't authenticate - cannot create objects via playbook
Describe the bug When the logic app tries to post an address object to the fortigate firewall it receives an unauthorized request message back.
To Reproduce Steps to reproduce the behavior:
- Deploy playbook after installing function app and custom connector.
- Add fortigate API key to API connector
- Trigger logic app
- select to block the IP when prompted in teams.
- See error

errors from fortigate firewall:
[httpsd 6511 - 1629862516 warning] api_access_check_for_api_key[810] -- API Key request authorized for cyberonerestuser from 20.92.128.213. [httpsd 6511 - 1629862516 info] api_store_parameter[304] -- add API parameter 'filter' (type=string) [httpsd 6511 - 1629862516 info] api_store_parameter[304] -- add API parameter 'access_token' (type=string) [httpsd 6511 - 1629862516 info] api_cmdb_request_init_by_path[1565] -- new CMDB query (path='firewall',name='address') [httpsd 6511 - 1629862516 info] api_generate_and_add_etag[1897] -- Per VDOM ETags: [ "vdom: root, hash: 9fa4a327bca9d2f2dd166730059ef1dc" ] [httpsd 6511 - 1629862516 info] api_generate_and_add_etag[1900] -- New ETag: F2A009D968235CE752DACB3FA516BDD85E813D63B85095CD1787014A1A508037 [httpsd 6511 - 1629862516 info] handle_cli_req_v2[2977] -- new CMDB API request (vdom='root',user='cyberonerestuser') [httpsd 6511 - 1629862516 info] api_v2_parse_filter[286] -- parsing single filter "[email protected]" [httpsd 6511 - 1629862516 info] api_v2_parse_filter_segment[237] -- parsing filter segment "[email protected]" [httpsd 6511 - 1629862516 info] api_v2_parse_filter_segment[259] -- found filter (key='start-ip', operator='=@', pattern='208.91.112.63') [httpsd 6511 - 1629862516 info] api_cmdb_v2_object_select[1015] -- 14 entries filtered out [httpsd 6511 - 1629862516 info] handle_cli_req_v2[3006] -- returning to original vdom "root" [httpsd 6511 - 1629862516 info] fweb_debug_final[274] -- Completed GET request for "/api/v2/cmdb/firewall/address" (HTTP 200) [httpsd 6513 - 1629862516 info] fweb_debug_init[367] -- New GET request for "/api/v2/cmdb/firewall/addrgrp" from "20.92.128.213:37007" [httpsd 6513 - 1629862516 info] fweb_debug_init[368] -- User-Agent: "(null)" [httpsd 6513 - 1629862516 info] fweb_debug_init[370] -- Handler "api_cmdb_v2-handler" assigned to request [httpsd 6513 - 1629862516 warning] api_access_check_for_api_key[810] -- API Key request authorized for cyberonerestuser from 20.92.128.213. [httpsd 6513 - 1629862516 info] api_store_parameter[304] -- add API parameter 'filter' (type=string) [httpsd 6513 - 1629862516 info] api_store_parameter[304] -- add API parameter 'access_token' (type=string) [httpsd 6513 - 1629862516 info] api_cmdb_request_init_by_path[1565] -- new CMDB query (path='firewall',name='addrgrp') [httpsd 6513 - 1629862516 info] api_generate_and_add_etag[1897] -- Per VDOM ETags: [ "vdom: root, hash: a74e21ea8a0f6f909df95e2896f5a99b" ] [httpsd 6513 - 1629862516 info] api_generate_and_add_etag[1900] -- New ETag: 16F3CEEC99FDE8CB7B9A07FAA4C00175BCD80C61ED67891E09FB6796EA7681D0 [httpsd 6513 - 1629862516 info] api_generate_request_hash[1782] -- hash_str: { "uri": "/api/v2/cmdb/firewall/addrgrp", "params": { "filter": "name=@Sentinel IP Block", "path": "firewall", "name": "addrgrp", "authorized_admin": "cyberonerestuser" } } [httpsd 6513 - 1629862516 info] api_generate_request_hash[1783] -- revisions: [ "vdom: root, hash: a74e21ea8a0f6f909df95e2896f5a99b", "19959e5127a137ca369254d45e42ca4f" ] [httpsd 6513 - 1629862516 info] get_cache_lock[64] -- Cache: locking /tmp/api_cache/E9D3EE12E434BE8A02052707825042434CB25451D7C97612F807D0861B9BFF34-B6C4BD245D6D2C276D72BD5073892CADFF24A05AC9AA67AB3F650EB4581BE44 (write). [httpsd 6513 - 1629862516 info] get_cache_lock[80] -- Cache: locked /tmp/api_cache/E9D3EE12E434BE8A02052707825042434CB25451D7C97612F807D0861B9BFF34-B6C4BD245D6D2C276D72BD5073892CADFF24A05AC9AA67AB3F650EB4581BE44 (write) [httpsd 6513 - 1629862516 info] handle_cli_req_v2[2951] -- API cache miss. [httpsd 6513 - 1629862516 info] handle_cli_req_v2[2977] -- new CMDB API request (vdom='root',user='cyberonerestuser') [httpsd 6513 - 1629862516 info] api_v2_parse_filter[286] -- parsing single filter "name=@Sentinel IP Block" [httpsd 6513 - 1629862516 info] api_v2_parse_filter_segment[237] -- parsing filter segment "name=@Sentinel IP Block" [httpsd 6513 - 1629862516 info] api_v2_parse_filter_segment[259] -- found filter (key='name', operator='=@', pattern='Sentinel IP Block') [httpsd 6513 - 1629862516 info] api_cmdb_v2_object_select[1015] -- 2 entries filtered out [httpsd 6513 - 1629862516 info] handle_cli_req_v2[3006] -- returning to original vdom "root" [httpsd 6513 - 1629862516 info] api_cache_release_lock[116] -- Cache: released /tmp/api_cache/E9D3EE12E434BE8A02052707825042434CB25451D7C97612F807D0861B9BFF34-B6C4BD245D6D2C276D72BD5073892CADFF24A05AC9AA67AB3F650EB4581BE44 [httpsd 6513 - 1629862516 info] fweb_debug_final[274] -- Completed GET request for "/api/v2/cmdb/firewall/addrgrp" (HTTP 200) [httpsd 6498 - 1629862522 info] fweb_debug_init[367] -- New POST request for "/api/v2/cmdb/firewall/address" from "52.237.214.72:1536" <<<<<<< Post to firewall [httpsd 6498 - 1629862522 info] fweb_debug_init[368] -- User-Agent: "azure-logic-apps/1.0 (workflow abb5eab7bc274883beb9d6a669c8b1ff; version 08585717447491517460)" [httpsd 6498 - 1629862522 info] fweb_debug_init[370] -- Handler "api_cmdb_v2-handler" assigned to request [httpsd 6498 - 1629862522 info] fweb_debug_final[274] -- Completed POST request for "/api/v2/cmdb/firewall/address" (HTTP 401 Unauthorized) <<<<<< Unauthorized response [httpsd 6493 - 1629862524 info] fweb_debug_init[367] -- New GET request for "/api/v2/cmdb/firewall/address" from "20.92.128.213:37008" [httpsd 6493 - 1629862524 info] fweb_debug_init[368] -- User-Agent: "(null)" [httpsd 6493 - 1629862524 info] fweb_debug_init[370] -- Handler "api_cmdb_v2-handler" assigned to request
Expected behavior A post action to add the object to the fortigate firewall with a 200 OK response.
Additional context Can be reproduced if you create a new logic app and trigger the API to post an object to the fortigate too.
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.
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, Wanted to check in to see if there were any thoughts on this one?
Hi, is there any movement on this connector issue?
Hi, This issue is caused by the API connection not include "Bearer" in the authorization header.
The logic app sends the following information if you don't put Bearer into the API key field on the API connection and we receive the 401 error.
curl -X POST "https://'fwurl'/api/v2/cmdb/firewall/address" -H "accept: application/json" -H "Authorization: 'api key'" -H "Content-Type: application/json" -d "{ "name": "test", "type": "iprange", "start-ip": "20.1.1.11", "end-ip": "20.1.1.11"}"
Unauthorized
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Additionally, a 401 Unauthorized error was encountered while trying to use an ErrorDocument to handle the request.
when we include Bearer: curl -X POST "https://'fwurl'/api/v2/cmdb/firewall/address" -H "accept: application/json" -H "Authorization: Bearer 'api key'" -H "Content-Type: application/json" -d "{ "name": "test1000", \"type": "iprange", "start-ip": "20.1.1.12", "end-ip": "20.1.1.12"}" { "http_method":"POST", "revision":"e108e0c9053e3dc416fb850b60240b95", "revision_changed":true, "old_revision":"316fa11b0f753e0e789f62c3aac32955", "mkey":"ttest1000", "status":"success", "http_status":200, "vdom":"root", "path":"firewall", "name":"address", "serial":"FGTAZR4E260ALR36", "version":"v7.0.1", "build":157
It should be documented that Bearer needs to be included so that the API key is accepted in the header or the connection/connector should add it in so that users should be able to simply enter the API key into the connection.
We are working on this.
Hi @scottbrien01 this bug is address now. Shall we close this ? Bug fix: https://github.com/Azure/Azure-Sentinel/pull/3356
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.