Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.
🚀 Launch ToolkitWhen managing Microsoft 365 and Azure Active Directory, it's crucial to understand directory roles and how they translate into permissions and access. One useful tool in your Graph PowerShell toolkit is the Get-MgDirectoryRoleTemplate cmdlet. In this post, we'll walk you through what it is, why you should use it, and how to extract meaningful information from directory role templates.
Get-MgDirectoryRoleTemplate is a Microsoft Graph PowerShell cmdlet used to retrieve directory role templates within your Azure Active Directory (AAD) tenant.
A Directory Role Template defines a role that can be activated in AAD—such as Global Administrator, User Administrator, or Exchange Administrator. These templates represent the blueprint of the roles before they're enabled in a tenant.
Once a role based on the template is activated using New-MgDirectoryRole, it becomes a Directory Role that can be assigned to users.
Here are a few practical reasons why administrators rely on this cmdlet:
Get-MgDirectoryRoleTemplate
Get-MgDirectoryRoleTemplate
This lists all role templates present in your directory. It can be a long list, so consider piping the output to Select-Object or Format-Table for clarity.
Get-MgDirectoryRoleTemplate | Select-Object DisplayName, Description
This filters out only the most relevant details: the name of the role and what it does.
Get-MgDirectoryRoleTemplate | Where-Object { $_.DisplayName -like "*Global*" }
Use this if you want to locate specific roles such as “Global Administrator”.
$templateId = "62e90394-69f5-4237-9190-012177145e10"
Get-MgDirectoryRoleTemplate | Where-Object { $_.Id -eq $templateId }
This is useful when you already have a Role Template ID and want to fetch its details.
Get-MgDirectoryRoleTemplate | Select-Object Id, DisplayName, Description | Export-Csv -Path "RoleTemplates.csv" -NoTypeInformation
Perfect for audits or sharing the list with your team.
A role template is a predefined definition of a role. Once activated, it becomes an assignable directory role in your tenant.
No, you cannot create custom templates using this cmdlet. Custom roles must be created using Azure AD PIM or Azure role-based access control (RBAC).
You need appropriate Microsoft Graph permissions such as Directory.Read.All.
The Get-MgDirectoryRoleTemplate cmdlet is a simple but powerful way to explore what roles exist in Azure Active Directory—even before they are enabled. Whether you're auditing your environment, setting up automation, or just getting familiar with available permissions, this cmdlet helps you stay informed and in control.
Explore more Graph PowerShell articles and scripts to master M365 management effortlessly!
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© Your Site Name. All Rights Reserved. Design by HTML Codex