Close Menu
Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    Facebook X (Twitter) Instagram
    Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    • Home
    • Intune
    • Windows
      • Modern Workplace
    • macOS
    • Android
    • iOS
    • Automation
      • Logic Apps
      • Intune Monitoring
      • GitHub
    • Security
      • Passwordless
      • Security
    • Speaking
    • About me
    Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    Home»Automation»MEM Monitoring: Monitor Security baselines in Endpoint Security
    Automation

    MEM Monitoring: Monitor Security baselines in Endpoint Security

    Peter KlapwijkBy Peter KlapwijkAugust 16, 2022Updated:February 14, 20256 Mins Read

    As Sander Rozemuller and I join forces at the Experts Live event later this year on the topic Monitor Intune with API from different perspectives I read his approach to monitoring the Security Baselines which are part of the Endpoint Security part of Microsoft Intune.

    If you are using the security baselines, it is important to keep track of new versions of the baselines. If a new version is available, you want to review the (new/ changed) baseline settings and apply these to your devices. But out of the box, there is no notification for this.

    Besides that, if you want to keep your environment clean up, you might also want to get notified when you gave baseline profiles that are not assigned.

    Sander uses PowerShell scripting to get the job done, of course, I will use a Logic Apps flow to get the job done.

    This blog post is part of the MEM (Intune) Monitoring series. An article with a short explanation of every MEM Monitoring flow I shared and links to the related articles can be found here.

    Let’s see what this (small) Logic Apps flow looks like.

    The solution in short

    I used a Logic Apps flow in Azure which runs on an occurrence base (once a week in this example). The flow has two branches. Branch one retrieves via a Graph API query the available Intune Security baselines. In case the published data is from the last 7 days and the baseline is used, it sends a notification. Because this means the security baseline is released since we last run the flow and this is a new baseline.

    The second branch checks if the security baseline profiles are (still assigned). If we have a profile that is not assigned, a notification is sent.

    The solution can be easily deployed with Bicep files, which can be found on my GitHub repo.

    Requirements

    We don’t have many requirements for this simple flow, we only need an Azure Managed Identity. The managed identity should have enough permissions to query Microsoft Graph for the required information.
    The required Graph (application) permissions needed are DeviceManagementConfiguration.Read.All.

    More information on creating a Managed identity can be found here.

    Setup the first part of the Logic App flow

    When the Managed identity is created, we can start creating the first part the flow.

    Sign in to the Azure portal and open the Logic App service. I created a blank Logic App of type Consumption.

    When the flow is created, click on the name of the flow at the top of the screen, open the Identity section, and on the tab User assigned add your Managed Identity.

    Open the Overview tab, which shows a few templates, and choose Recurrence.

    Change the interval settings to your needs.

    We now add our first HTTP action.
    As Method select GET.
    As URI enter:

    https://graph.microsoft.com/beta/deviceManagement/templates?$filter=(templateType%20eq%20'securityBaseline')%20or%20(templateType%20eq%20'advancedThreatProtectionSecurityBaseline')%20or%20(templateType%20eq%20'microsoftEdgeSecurityBaseline')%20or%20(templateType%20eq%20'cloudPC')

    Choose Add Parameter and select Authentication.
    As Authentication type select Managed identity.
    Select your Managed identity from the list.
    And add https://graph.microsoft.com as Audience.

    Next, we need to add a new Parse JSON action. We parse the output of the HTTP action, to be able to use the values later on in the flow.
    As Content, we select Body from the Dynamic content list that is from our HTTP action.
    As Schema, we can run the current flow and grab the body from the HTTP action and add it via the Use sample payload option. We can also grab the body when we run the same query via Graph Explorer.

    This is the schema:

    {
        "properties": {
            "@@odata.context": {
                "type": "string"
            },
            "value": {
                "items": {
                    "properties": {
                        "@@odata.type": {
                            "type": "string"
                        },
                        "description": {
                            "type": "string"
                        },
                        "displayName": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "intentCount": {
                            "type": "integer"
                        },
                        "isDeprecated": {
                            "type": "boolean"
                        },
                        "platformType": {
                            "type": "string"
                        },
                        "publishedDateTime": {
                            "type": "string"
                        },
                        "templateSubtype": {
                            "type": "string"
                        },
                        "templateType": {
                            "type": "string"
                        },
                        "versionInfo": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "@@odata.type",
                        "id",
                        "displayName",
                        "description",
                        "versionInfo",
                        "isDeprecated",
                        "intentCount",
                        "templateType",
                        "platformType",
                        "templateSubtype",
                        "publishedDateTime"
                    ],
                    "type": "object"
                },
                "type": "array"
            }
        },
        "type": "object"
    }

    Now we add a Condition action which is a Control action.
    In the Condition action, we check if the Baseline does have at least one profile under it (using the intentCount) and check if the baseline is recently released (using the publishedDateTime).

    In the left box, add intentCount found via Dynamic content, this adds the condition in a new For each action. Choose is greater than from the drop-down en enter 0 to the right box.

    Click Add, to add a new Row.
    in the left box add publishedDateTime and choose is great than. In the right box we need to enter the current date minus 7 days (if the flow runs once a week). This is done using an Expression:

    adddays(utcNow(‘yyyy-MM-ddTHH:mm:ssZ’),-7)

    This is our condition action.

    If both conditions are met, we want to receive a notification. This can be an email for example, or a message in a Teams channel, like the below example via a Teams webhook.

    Enter an HTTP Action under True and as Method choose POST.
    Enter your Teams webhook URL in the URI field. In the Body field we enter the text we like to send to the Teams channel. We can use dynamic content (variables) from the previous PARSE JSON action and enter our own text.
    Use \n\n in the text to create new lines in the text message, otherwise, the message consists of one long line of text.
    And I used ** to get some text in bold.

    This is our first part of the flow.

    Setup the second part of the Logic App flow

    Now we add another branch to our flow, to check if the Security baseline contains profiles and if these are assigned. If the profile is not assigned, a notification is sent so we can clean up the unused profile.

    Between the Recurrence and HTTP action, click on the Plus sign and choose Add a parallel branch.

    We add an HTTP action.
    As Method select GET.
    As URI enter:

    https://graph.microsoft.com/beta/deviceManagement/intents?$filter=contains(displayName,'baseline')%20or%20contains(displayName,'Baseline')

    Don’t forget to add the authentication information.

    We need to Parse the information, so add a Parse JSON action.
    In the Content, field add Body from the HTTP action and enter the schema.

    My used schema:

    {
        "properties": {
            "@@odata.context": {
                "type": "string"
            },
            "value": {
                "items": {
                    "properties": {
                        "description": {
                            "type": "string"
                        },
                        "displayName": {
                            "type": "string"
                        },
                        "id": {
                            "type": "string"
                        },
                        "isAssigned": {
                            "type": "boolean"
                        },
                        "lastModifiedDateTime": {
                            "type": "string"
                        },
                        "roleScopeTagIds": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "templateId": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "id",
                        "displayName",
                        "description",
                        "isAssigned",
                        "lastModifiedDateTime",
                        "templateId",
                        "roleScopeTagIds"
                    ],
                    "type": "object"
                },
                "type": "array"
            }
        },
        "type": "object"
    }

    We add a Condition to our flow. We filter on the value isAssigned. If the profile is not assigned, the value is false.
    Add isAssigned to the left box, choose is equal to from the drop-down, and enter false to the right box.

    Like in the first branch, add an HTTP action under True.

    And this is our complete Logic Apps flow.

    Which notifies on new Security baselines or security baseline profiles that are not assigned!

    Thanks for reading.
    And don’t forget to also read the other MEM Monitoring posts.

    Intune Intune Monitoring Logic Apps MEM MEMMonitoring Power Automate
    Share. Facebook Twitter LinkedIn Email WhatsApp
    Peter Klapwijk
    • Website
    • X (Twitter)
    • LinkedIn

    Peter is a Security (Intune) MVP since 2020 and is working as Modern Workplace Engineer at Wortell in The Netherlands. He has more than 15 years of experience in IT, with a strong focus on Microsoft technologies like Microsoft Intune, Windows, and (low-code) automation.

    Related Posts

    MEM Monitoring: Assignment monitoring to keep your tenant cleaned up

    August 24, 2022

    Re-import Autopilot information from Azure Storage on-demand with a Logic Apps flow

    July 9, 2022

    MEM Monitoring: Get your Windows Autopilot deployment events in a Teams channel with Logic Apps – Part 1

    April 16, 2021
    Add A Comment
    Leave A Reply Cancel Reply

    Peter Klapwijk

    Hi! Welcome to my blog post.
    I hope you enjoy reading my articles.

    Hit the About Me button to get in contact with me or leave a comment.

    Awards
    Sponsor
    Latest Posts

    Managing Windows 365 Link devices with Intune

    October 24, 2025

    Hard drive and partitions are not shown while installing Windows

    October 14, 2025

    Intune compliance for Windows 365 Cloud PCs

    September 12, 2025

    Intune connector for Active Directory configuration error

    August 29, 2025
    follow me
    • Twitter 4.8K
    • LinkedIn 6.1K
    • YouTube
    • Bluesky 1.5K
    Tags
    Administrative Templates Android Automation Autopilot Azure Azure AD Browser Conditional Access Edge EMS Exchange Online Feitian FIDO2 Flow Graph Graph API Identity Management Intune Intune Monitoring iOS KIOSK Logic Apps macOS MEM MEMMonitoring Microsoft 365 Microsoft Defender Microsoft Edge Microsoft Endpoint Manager Modern Workplace Office 365 OneDrive for Business Outlook Passwordless PowerApps Power Automate Security SharePoint Online Windows Windows 10 Windows10 Windows 11 Windows 365 Windows Autopilot Windows Update
    Awards
    Sponsor
    Follow me on Twitter
    Tweets by inthecloud_247
    Tags
    Administrative Templates Android Automation Autopilot Azure Azure AD Browser Conditional Access Edge EMS Exchange Online Feitian FIDO2 Flow Graph Graph API Identity Management Intune Intune Monitoring iOS KIOSK Logic Apps macOS MEM MEMMonitoring Microsoft 365 Microsoft Defender Microsoft Edge Microsoft Endpoint Manager Modern Workplace Office 365 OneDrive for Business Outlook Passwordless PowerApps Power Automate Security SharePoint Online Windows Windows 10 Windows10 Windows 11 Windows 365 Windows Autopilot Windows Update
    Archives
    Peter Klapwijk

    Hi! Welcome to my blog post.
    I hope you enjoy reading my articles.

    Hit the About Me button to get in contact with me or leave a comment.

    Copy right

    This information is provided “AS IS” with no warranties, confers no rights and is not supported by the authors, or In The Cloud 24-7.

     

    Copyright © 2025 by In The Cloud 24-7/ Peter Klapwijk. All rights reserved, No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

    Shorthand; Don’t pass off my work as yours, it’s not nice.

    Recent Comments
    • Luis on Application installation issues; Download pending
    • AndrewWak on Issues syncing SharePoint Online libraries with OneDrive for Mac
    • Peter Klapwijk on Deploy Microsoft Defender updates in deployment rings
    • Magnus on Deploy Microsoft Defender updates in deployment rings
    • Gertjan Jongeneel on Add an Azure AD group to the local administrators group with Microsoft Intune
    most popular

    Application installation issues; Download pending

    October 1, 2024

    How to change the Windows 11 language with Intune

    November 11, 2022

    Restrict which users can logon into a Windows 10 device with Microsoft Intune

    April 11, 2020

    How I solved a strange Kerberos issue

    December 12, 2024
    Recent Comments
    • Luis on Application installation issues; Download pending
    • AndrewWak on Issues syncing SharePoint Online libraries with OneDrive for Mac
    • Peter Klapwijk on Deploy Microsoft Defender updates in deployment rings
    • Magnus on Deploy Microsoft Defender updates in deployment rings
    • Gertjan Jongeneel on Add an Azure AD group to the local administrators group with Microsoft Intune
    Copy right

    This information is provided “AS IS” with no warranties, confers no rights and is not supported by the authors, or In The Cloud 24-7.

    Copyright © 2023 by In The Cloud 24-7/ Peter Klapwijk. All rights reserved. No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

    Shorthand: Don’t pass off my work as yours, it’s not nice.

    Peter Klapwijk – In The Cloud 24-7
    X (Twitter) LinkedIn YouTube RSS Bluesky
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.

    Manage Cookie Consent
    To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
    View preferences
    {title} {title} {title}