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.

clip_image002[4]


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

clip_image004[4]

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

clip_image006[4]

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

clip_image008[4]

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

  clip_image010[4]

clip_image012[4]

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

clip_image014[4]

More information about computer groups can be found here:

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

Happy testing!

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 for IT.

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 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.

follow us in feedly
Categories

Follow on SoMe