Monday, March 6, 2017

Enable usage policy for Office 365 Groups using the AAD V2 PowerShell module

A quick note, at the time of this writing you have to use the preview commandlets as the released one is missing the settings commands needed.

First off you have to install the AAD Preview V2 PowerShell module.

Find-Module AzureADPreview #to ensure it's in the list when doing install
Install-Module AzureADPreview

Next up load the module into your PowerShell session and connect to Azure AD

Import-Module AzureADPreview
$credentials = Get-Credential
Connect-AzureAD -Credential $credentials

Once connected we get a copy of the template for Unified Groups, and use this to create and set new settings. If you already have settings in place for Group.Unified to for example disable group creation, you need to load and modify this setting object instead.

$policyTemplate = Get-AzureADDirectorySettingTemplate |? Id -eq 62375ab9-6b52-47ed-826b-58e47e0e304b
$setting = $policyTemplate.CreateDirectorySetting()
$setting["UsageGuidelinesUrl"] = "https://www.contoso.com/guidelines"
$setting["ClassificationList"] = "Low,Medium,High"
$setting["DefaultClassification] = "Low"
$policySetting = New-AzureADDirectorySetting -DirectorySetting $setting

You might have to wait a little bit before it’s all working, but once all set, if you edit a groups’ settings, you will see a dropdown for classification, and a hyperlink to usage guidelines.

image

The setting is also visible on the group site.

image