Skip to content

Instantly share code, notes, and snippets.

@rytmis
Last active December 9, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rytmis/4340397 to your computer and use it in GitHub Desktop.
Save rytmis/4340397 to your computer and use it in GitHub Desktop.
Updates an Office 365 WAAD tenant to work with the Graph API
$adPrincipal = Get-MsolServicePrincipal -AppPrincipalId 00000002-0000-0000-c000-000000000000
$adPrincipal.ServicePrincipalNames.Add("00000002-0000-0000-c000-000000000000/Directoryapi.microsoftonline.com")
$adPrincipal.ServicePrincipalNames.Add("00000002-0000-0000-c000-000000000000/directory.windows.net")
$adPrincipal.ServicePrincipalNames.Add("00000002-0000-0000-c000-000000000000/directory_s1.windows.net")
$adPrincipal.ServicePrincipalNames.Add("00000002-0000-0000-c000-000000000000/directory_s2.windows.net")
$adPrincipal.ServicePrincipalNames.Add("00000002-0000-0000-c000-000000000000/directory_s3.windows.net")
$adPrincipal.ServicePrincipalNames.Add("00000002-0000-0000-c000-000000000000/directory_s4.windows.net")
$adPrincipal.ServicePrincipalNames.Add("00000002-0000-0000-c000-000000000000/directory_s5.windows.net")
$adPrincipal.ServicePrincipalNames.Add("00000002-0000-0000-c000-000000000000/graph.windows.net")
Set-MsolServicePrincipal -AppPrincipalId 00000002-0000-0000-c000-000000000000 -ServicePrincipalNames `
$adPrincipal.ServicePrincipalNames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment