Background

Another week has passed, and the learning continues! I think it’s incredible how much you can learn and how much you take for granted.

I’ve realized during this series how many small things you catch every week that you immediately forget unless you write them down somewhere.

This week we focus on Powershell, Windows 365, and some Microsoft Intune tips and tricks.

How to get nested group members using Graph API

When you get group members with Graph, by default, you only get the group’s direct members. The results return a mix of users, groups, and devices.

I am building a solution where I want all the nested members for a specific group. I’m investigating possible methods and found a few ways of getting all the members.

You normally use something like this to get all the members of a group using Graph:

https://graph.microsoft.com/v1.0/groups/{group-id}/members

This returns a list of all members, whether users, groups, or devices.

But, if you instead use the transitiveMembers endpoint, you will get a flat list with all nested members.

https://graph.microsoft.com/v1.0/groups/{group-id}/transitiveMembers

This is very useful since you don’t have to build your own logic to parse the members!

You can also add the OData type you want to receive to make things more interesting.

For example, if you want all nested members but only return the users, you can use this example:

https://graph.microsoft.com/v1.0/groups/{group-id}/transitiveMembers/microsoft.graph.user

This time, you will only get the members that match the OData type, in this case, all the users.

I hope this helps!

List group transitive members – Microsoft Graph v1.0 | Microsoft Learn

Use a script block in PowerShell

I had no idea you could store entire scripts or code in a variable!

Apparently, they are called Powershell ScriptBlocks and look something like the one below.

$test = {
Get-Service
}
Invoke-Command $test

This is great to know if you are working on a script and have to execute the same code multiple times.

Since you store the code in a PowerShell scriptblock, you can call on the same code over and over again.

This is true even with many rows or just a single line.

To make it even more useful, you can use parameters with a PowerShell scriptblock, so in some cases, it can even replace functions if you don’t need all the functionality that those provide.

Very helpful!

about Script Blocks – PowerShell | Microsoft Learn

Send delayed messages in Microsoft Teams

Sometimes I think or read something interesting or important that I want to share with my colleagues, but it might be during a weekend.

I want to respect their free time, but I also don’t want to forget about the cool thing I just found.

There is a simple solution in Teams, as well as Outlook!

You can schedule the message by right-clicking on the Send button and selecting a date and time that fits better for the message you want to send.

Select a proper time and date and click Send at scheduled time!

This behaves similarly to how Outlook and will send your message for you! This means you can go about your business and know that it will be delivered in the future.

Microsoft Teams Adds Support for Scheduling Chat Messages (petri.com)

How to license a group in Azure DevOps

I was recently part of a discussion concerning the license model for Azure DevOps.

We went through the different licensing options available, and settled on the current free model.

This means that we have 5 Basic user licenses that we want to utilize for those who will access the Repos and work with code.

But how do you manage the licenses for them?

Instead of licensing them individually, you can create a group in Azure AD, and assign licenses to it, in a similar fashion to other Microsoft 365 licenses.

  • Create a new Azure AD group or use an existing one
  • Go to Azure DevOps and Organization Settings
  • Go to Users

Click the Group rules blade.

Click the Add a group rule button.

Select your group, Access level, Project and the Azure DevOps groups that apply in your case.

After saving this, you gan manage the ADO Access level and project access from Azure AD, as you are used to doing for other services.

Good luck with you Azure DevOps design!

Add group rule to assign access levels – Azure DevOps Services | Microsoft Learn

Summary

This week we learned new things that allow us to be more effective and efficient when working with code and communicating with our company.

  • How to get nested members with MS Graph and the transitiveMembers endpoint.
  • Using scriptblocks in a PowerShell script to re-use code and replace some functions.
  • How to send delayed messages in Microsoft Teams.
  • How to assign Azure DevOps licenses to simplify the management of Access levels and Projects.

Take care of yourself and keep your eyes out for next weeks post!

Resources

List group transitive members – Microsoft Graph v1.0 | Microsoft Learn

about Script Blocks – PowerShell | Microsoft Learn

Microsoft Teams Adds Support for Scheduling Chat Messages (petri.com)

Add group rule to assign access levels – Azure DevOps Services | Microsoft Learn

Leave a Reply