How to Assign sensitivity labels to Microsoft 365 groups in Microsoft Entra ID?

RoBiNLolo 5 Reputation points

Hi Team

I am trying to follow the instructions listed here:, which should allow us to enable publishing sensitivity labels to groups feature.

Steps taken so far from my Windows 11 device:

  • Run Powershell as Administrator
  Install-Module Microsoft.Graph
  Install-Module Microsoft.Graph.Beta
  Connect-MgGraph -Scopes "Directory.ReadWrite.All"

The next required script is: $grpUnifiedSetting = Get-MgBetaDirectorySetting -Search DisplayName:"Group.Unified"

but I am getting this error:

Get-MgBetaDirectorySetting : The term 'Get-MgBetaDirectorySetting' is not recognized as the name of a cmdlet,function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that thepath is correct and try again.

Any help would be appreciated.

Thank you

Mohamed Aly

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,951 questions
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
1,855 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
18,648 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Harpreet Singh Matharoo 7,376 Reputation points Microsoft Employee

    Hello @RoBiNLolo ,

    Thank you for reaching out to Microsoft QnA Platform. I tried to execute command and found this command is working without any issues.

    User's image

    The error message you’re seeing typically occurs when the PowerShell environment does not recognize the Get-MgBetaDirectorySetting cmdlet. This could be due to a few reasons: The Microsoft.Graph.Beta module may not have been installed correctly. You can verify this by running Get-Module -ListAvailable Microsoft.Graph.Beta in your PowerShell session. If the module is not listed, you may need to reinstall it. The Microsoft.Graph.Beta module may not have been imported into your PowerShell session. You can do this by running Import-Module Microsoft.Graph.Beta. There could be a conflict with another module that has a cmdlet of the same name. Try using the fully qualified cmdlet name: Microsoft.Graph.Beta\Get-MgBetaDirectorySetting.

    1. Your PowerShell Execution Policy might be restricting the execution of the script. You can check your execution policy settings by running Get-ExecutionPolicy. If it’s set to Restricted, you might need to change it to RemoteSigned or Unrestricted using the Set-ExecutionPolicy cmdlet.

    If you’ve checked all of these and you’re still experiencing the issue, it might be worth reaching out to Microsoft Support for further assistance. Please remember to replace any sensitive information in your scripts or error messages before sharing them.

    0 comments No comments

  2. Givary-MSFT 24,971 Reputation points Microsoft Employee

    @RoBiNLolo Thank you for reaching out to us, adding to the above answer, in order to use this cmdlet Get-MgBetaDirectorySetting , you need to import the module and the same has been documented here -

    Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement

    Let me know if this helps to bypass this error, once this error is resolved you can refer to this

    Let me know if you have any further questions, feel free to post back.

    Please remember to "Accept Answer" if answer helped, so that others in the community facing similar issues can easily find the solution.