Creating a computer group as a function

Creating a computer group as a function

Introduction

To use Machine Groups in our Automation Account inventory we must first create a group by saving a kql query as a function.

 

Requirements

– Azure Subscription – if you do not already have a subscription, you can get a free trial here.

– Log Analytics workspace configured (See here).

– Automation Account configured (See here).

In this example we will create a computer group based on Active Directory group membership.

 

 

Preparation

To be able to query for Active Directory group membership we must make sure we collect the information. To do so we enable import of “Active Directory group membership from computer” under Computer groups in our Log Analytics workspace.

 

Create Computer group query

To create our query, we click the log icon, and this will take us to a predefined query that we can edit or built on

 The default query looks as follows and shows us the groups we have in Active Directory

Now we can modify it slightly and we can get all the machines in a particular group:

Once we have the right query we save it as a function

NOTE: To be able to save the function as a computer group the distinct operator must be set to computer

 Once the query is saved, we are done.

  

Summary

We should now be able to see our new computer group available under Machine Groups in the Automation Account inventory

More information about computer groups can be found here:

https://docs.microsoft.com/en-us/azure/azure-monitor/logs/computer-groups

Happy testing!

+ posts

Table of Contents

Share this post
Search blog posts
Search
Authors
Modern Workplace consultant and a Microsoft MVP in Enterprise Mobility.

Modern Workplace consultant and a Microsoft MVP in Windows and Devices.

Infrastructure architect with focus on Modern Workplace and Microsoft 365 security.

Cloud & security specialist with focus on Microsoft backend products and cloud technologies.

Cloud & security specialist with focus on Microsoft 365.

Cloud & Security Specialist, with a passion for all things Cybersecurity

Cloud and infrastructure security specialist with background in networking.

Infrastructure architect with focus on design, implementation, migration and consolidation.

Infrastructure consultant with focus on cloud solutions in Office365 and Azure.

Modern workplace and infrastructure architect with a focus on Microsoft 365 and security.

follow us in feedly
Categories

Follow on SoMe