Azure-Sentinel: Logic App 'Create a new watchlist with data (Raw content)' returns 400
Describe the bug The create/update Watchlist API endpoint returns a 400 (invalid CSV content) when trying to create a new Sentinel Watchlist using the built-in Logic Apps connector. The error returned is:
"Content": "{\"error\":{\"code\":\"400\",\"message\":\"Invalid csv content : no watchlist items found in the provided rawContent <rawContent>!\"}}",
To Reproduce Steps to reproduce the behavior:
- Create a new Logic App
- Add a ‘Watchlist - Create a new watchlist with data (Raw content)’ task
- Fill in the necessary subscription, workspace etc
- In the ‘Specify Watchlist fields’, fill in the default API example body (https://docs.microsoft.com/nl-nl/rest/api/securityinsights/preview/watchlists/create-or-update):
{
"contentType": "text/csv",
"description": "Watchlist from CSV content",
"displayName": "High Value Assets Watchlist",
"itemsSearchKey": "header1",
"numberOfLinesToSkip": 1,
"provider": "Microsoft",
"rawContent": "This line will be skipped\nheader1,header2\nvalue1,value2",
"source": "Local file"
}
Expected behavior
A new watchlist should be created with the sample content. Replacing the rawContent newline with \r\n produces the same error.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 32 (9 by maintainers)
@napieram, @d3vzer0 - I got the same yesterday and we are working in background to find out more. @pagoudjo will keep us updated.
{ "contentType": "Text/Csv", "description": "Watchlist API Upload Test", "displayName": "uploadtest", "itemsSearchKey": "INSERTSEARCHKEYHERE", "provider": "Microsoft", "rawContent": "INSERTSEARCHKEYHERE,SampleColumn1,SampleColumn2\r\nSamplevalue1,samplevalue2,samplevalue3\r\nsamplevalue4,samplevalue5,samplevalue6\r\n", "source": "test.csv" }This is the example body block I am using in the app.
And that produces a 400 error
{ "StatusCode": "BadRequest", "ReasonPhrase": "Bad Request", "Content": "{\"error\":{\"code\":\"400\",\"message\":\"Invalid csv content : no watchlist items found in the provided rawContent <rawContent>!\"}}", "Headers": {Edit: I should note that I was having a similar issue while trying to upload a watchlist using the python sdk. The watchlist would get created but the csv contents would not be added. I did some troubleshooting by using the REST api and it turned out that the python sdk was hard coded to using 2022-01-01-preview as the api version. By changing that to 2021-10-01-preview, my code worked. I tested all the versions after 2022-01-01-preview, and they all behave the same way, they create the watchlist but not the content.