Powershell cmd to enable group and sites for sensitive label

J-3804 1,591 Reputation points
2024-08-16T03:57:46.9766667+00:00

Hello Team,

I am trying to create sensitivity labels for groups and sites, but we need to run some PowerShell commands. I am following the steps in this https://learn.microsoft.com/en-us/purview/sensitivity-labels-teams-groups-sites, but it is not clear to me. Could you please send me all the PowerShell commands I need to run in order to enable sensitivity labels for groups and sites?

Thank you.

Screenshot 2024-08-15 234751.png

Thanks for your help.

Microsoft Purview
Microsoft Purview
A Microsoft data governance service that helps manage and govern on-premises, multicloud, and software-as-a-service data. Previously known as Azure Purview.
1,133 questions
{count} votes

4 answers

Sort by: Most helpful
  1. J-3804 1,591 Reputation points
    2024-08-24T04:24:00.7366667+00:00

    Hello Phemanth,

    I did the following and it worked for me

    • connect to PowerShell ISE as admin
    • Install-Module Microsoft.Graph -Scope CurrentUser
    • Install-Module Microsoft.Graph.Beta -Scope CurrentUser
    • Connect-MgGraph -Scopes “Directory.ReadWrite.All”
    • Connect-AzureAD
    • Get-MgBetaDirectorySettingTemplate
    • $TemplateId = (Get-MgBetaDirectorySettingTemplate | where { $_.DisplayName -eq "Group.Unified" }).Id
    • $Template = Get-MgBetaDirectorySettingTemplate | where -Property Id -Value $TemplateId -EQ
    • $params = @{ templateId = "$TemplateId" values = @(
      @{
      
         name = "UsageGuidelinesUrl"
      
         value = "https://guideline.example.com"
      
      }
      
      @{
      
         name = "EnableMIPLabels"
      
         value = "True"
      
      }
      
      )

    }

    • New-MgBetaDirectorySetting -BodyParameter $params
    • $Setting = Get-MgBetaDirectorySetting | where { $_.DisplayName -eq "Group.Unified"}

    $Setting.Values


  2. phemanth 10,240 Reputation points Microsoft Vendor
    2024-08-26T10:41:56.9766667+00:00

    @J-3804

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer .

    Ask: I am trying to create sensitivity labels for groups and sites, but we need to run some PowerShell commands. I am following the steps in this https://learn.microsoft.com/en-us/purview/sensitivity-labels-teams-groups-sites, but it is not clear to me. Could you please send me all the PowerShell commands I need to run in order to enable sensitivity labels for groups and sites?

    Thank you.

    Screenshot 2024-08-15 234751.png

    Solution: I did the following and it worked for me

    • connect to PowerShell ISE as admin
    • Install-Module Microsoft.Graph -Scope CurrentUser
    • Install-Module Microsoft.Graph.Beta -Scope CurrentUser
    • Connect-MgGraph -Scopes “Directory.ReadWrite.All”
    • Connect-AzureAD
    • Get-MgBetaDirectorySettingTemplate
    • $TemplateId = (Get-MgBetaDirectorySettingTemplate | where { $_.DisplayName -eq "Group.Unified" }).Id
    • $Template = Get-MgBetaDirectorySettingTemplate | where -Property Id -Value $TemplateId -EQ
    • $params = @{ templateId = "$TemplateId" values = @(
        @{
           name = "UsageGuidelinesUrl"
           value = "https://guideline.example.com"
        }
        @{
           name = "EnableMIPLabels"
           value = "True"
        }
      
      )

    }

    • New-MgBetaDirectorySetting -BodyParameter $params
    • $Setting = Get-MgBetaDirectorySetting | where { $_.DisplayName -eq "Group.Unified"}

    $Setting.Values

    If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.

    If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.


  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.