question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

azure.mgmt.securityinsight.watchlists.create_or_update() doesn't create the watchlist items

See original GitHub issue
  • Package Name: azure.mgmt.securityinsight
  • Package Version: Latest
  • Operating System: Linux
  • Python Version: 3.9.12 Describe the bug This package is using the REST API version: 2022-07-01-preview. When I use azure.mgmt.securityinsight.watchlists.create_or_update(), it will create the watchlist, return with 200 response, but it ignores the watchlist items set in raw_content.

I tried to set the api version to the stable version 2021-10-01 with instance_name.watchlists.api_version = "2021-10-01" but it doesn’t work.

To Reproduce This is a REST API bug, you can reproduce it by issuing the HTTP api request Steps to reproduce the behavior: 1.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}?api-version=2022-07-01-preview

{
  "etag": "\"0300bf09-0000-0000-0000-5c37296e0000\"",
  "properties": {
    "displayName": "High Value Assets Watchlist",
    "source": "Local file",
    "provider": "Microsoft",
    "description": "Watchlist from CSV content",
    "numberOfLinesToSkip": 1,
    "rawContent": "This line will be skipped\nheader1,header2\nvalue1,value2",
    "itemsSearchKey": "header1",
    "contentType": "text/csv"
  }
}

This will create the watchlist but the items in the rawContent will be ignored.

  1. Change the api-version to 2021-10-01
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/watchlists/{watchlistAlias}?api-version=2021-10-01

{
  "etag": "\"0300bf09-0000-0000-0000-5c37296e0000\"",
  "properties": {
    "displayName": "High Value Assets Watchlist",
    "source": "Local file",
    "provider": "Microsoft",
    "description": "Watchlist from CSV content",
    "numberOfLinesToSkip": 1,
    "rawContent": "This line will be skipped\nheader1,header2\nvalue1,value2",
    "itemsSearchKey": "header1",
    "contentType": "text/csv"
  }
}

This will create the watchlist and bulk create the watchlist items

Expected behavior

  • when using the method azure.mgmt.securityinsight.watchlists.create_or_update() with a watchlist that contains the watchlist items data in raw_content, it should create/update the watchlist with the watchlist items.
  • when manually set the api version with instance_name.watchlists.api_version = "2021-10-01", it should use the set api version instead of the default version, which is currently set to 2022-07-01-preview

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Wzb123456789commented, Jul 22, 2022

Hi @wanpeng-cds

We will release a new package about azure.mgmt.securityinsight 2021-10-01

1reaction
wanpeng-cdscommented, Aug 3, 2022

Hi @SaurabhSharma-MSFT and @Wzb123456789, thank you so much for the hard work. I can confirm that the new version works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Watchlist Items - Create Or Update - REST API (Azure Sentinel ...
Learn more about Sentinel service - Create or update a watchlist item. ... A flag that indicates if the watchlist item is deleted...
Read more >
Watchlist Items - Create Or Update - REST API (Azure Sentinel)
Learn more about Sentinel service - Creates or updates a watchlist item.
Read more >
Watchlists - Create Or Update - REST API (Azure Sentinel)
Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type).
Read more >
Watchlists - Create Or Update - REST API (Azure Sentinel)
Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type).
Read more >
WatchlistsOperations Class - Microsoft Learn
Create or update a Watchlist and its Watchlist Items (bulk creation, e.g. through text/csv content type). To create a Watchlist and its Items,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found