
Azure Sentinel allows you to create automation based on Azure Logic Apps, which used within Azure Sentinel are called Playbooks. This situation means that we have access to a very broad spectrum of elements from which we can build automation activities. At the same time, for the Azure Sentinel administrator, most often not DEVOPS on a daily basis. This richness and the dynamics of development and change of Azure Sentinel as well as Azure Logic Apps, makes it sometimes quite difficult to find help in solving the described problem.
My goal was to expansion of automation o use one of the latest features that have recently been made available in Azure Sentinel - the Watchlist. It is a dictionary that is defined and editable after creation, allowing to avoid "hardcoding"
in analytics queries of quasi static data such as: lists of IP addresses, sensitive account names, etc. The Watchlist is stored as a component of the Log Analytics workspace where Azure Sentinel has been added (enabled).

Despite the wealth of features, Azure Logic Apps module with elements dedicated to Azure Sentinel, until recently, did not offer management functionality Watchlist. W Azure Portal Watchlist could be added or deleted, editing its contents was not possible,
as well as Azure Logic Apps did not provide this capability (at the time of writing this text - these capabilities are already significantly expanded). The only mechanism supporting the automation of activities in this area was the Azure REST API and I decided to use it. Since I had no previous experience in using the REST API
As part of Logic Apps, I decided to enlist the help of communities Azure Sentinel.
To make life easier for those dealing with Azure Sentinel and allow for the exchange of experience, Microsoft has created a community on GitHub. A lost administrator looking for a solution to his problem can very often find it here. The community portal can be accessed from the Azure Sentinel menu or by going to the https://github.com/Azure/Azure-Sentinel


Within the list of available playbooks, I found this one fulfilling current needs
- Check if there is a Watchlist with the given name and if it does not exist create one.
- Add an element to the Watchlist according to its structure, in this case a pair: address_IP_server and name_server.
Playbook address:
https://github.com/Azure/Azure-Sentinel/tree/master/Playbooks/Watchlist-Add-IPToWatchList
I imported the playbook directly from the page using the "Deploy to Azure" button, specifying the necessary import parameters required by the playbook. Then, according to
with the requirementsand Azure Logic Apps I configured API calls for the playbook elements requiring it. The problem occurred with the elements performing the main playbook tasks, and using the REST API, because they required the use of do Managed Identity authentication.

As recommended by the author of the playbook for the Azure Logic App, a Managed Identity was created correctly in Azure AD from within the Logic App and verified in Azure AD.

Despite this, the item still did not execute correctly, there was an authentication error in Azure AD.

I verified both Tenant ID, as well as resource principal, but everything seemingly matched. Managed Identity was registered correctly, the playbook was visible in Azure AD, and it had the necessary permissions granted on the Resource Group, which included the Log Analytics workspace from Azure Sentinel. I found a few blog posts about my problem to some extent, but either were outdated due to changes in Azure. Changes made on the basis of these posts had no effect. The only, but very important, knowledge I gained from reading these blogs was the following.
about the need to focus on the field Audience. Audience is a value that identifies an "application" in Azure against which the Azure Logic App is authenticated in AD
and authorized. I started looking for how to specify the identifier to be entered in the Audience field. In blogs, each time it was an identifier of type GUID. Unfortunately, this was a misleading lead, as it was not an application registered in, for example, the Enterprise Applications,
a system's REST API Azure service Accessible via the system ID.

Watchlist is an element stored in an Azure resource, which is the Log Analytics workspace, accessible via Resource Manager, referencing it via the REST API just creates an Audience for our playbook from Resource Manager.
On the https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities#azure-services-that-support-azure-ad-authentication you will find a list of Azure services supporting authentication with Managed Identity.
On the other hand, on the https://docs.microsoft.com/en-us/azure/logic-apps/create-managed-service-identity#authenticate-access-with-managed-identity you will find additional resources for defining authentication in Azure Logic Apps using Managed Identity.
Finally, the Azure Logic Apps component of the Log Analytics query containing Watchlist:

Summarizing all the measures taken, one can come to a conclusion:
- When working with Azure Sentinel, there must be close cooperation between the security engineers configuring the product and those with DevOps expertise,
- The very dynamic changes that are taking place in Azure, intended, of course, according to Microsoft, to develop the platform, can be your friends or your greatest enemies. If you are up to date with Azure, following newsletters and information about changes - you will rather manage, if not - tips found on the web can lead you astray,
- Use Managed Identities because you give applications specific rights to specific resources and minimize the need to keep an eye on changing passwords for accounts, which is always a problem. Azure Sentinel does a very good job of tracking such application logins in Azure after recent changes to the Azure AD Connector, so it's easy to detect anomalies that could be a threat. And you'll probably be able to read about the Azure AD Connector and other elements in future ISCG blog posts.
Author: Mariusz Orkisz
- Support and development of Microsoft and Nintex based applications
- Application design and development including digital processes
- Invoice management
- Requisition management
- Contract management
- Modern Intranet
ISCG sp. z o.o.
Al. Jerozolimskie 178, 02-486 Warsaw
NIP: 5262798378
KRS: 0000220621
Phone