MSGraphPermissions: Difference between revisions

From UmsWiki
Jump to navigation Jump to search
Sva (talk | contribs)
Tenant name, bold font
 
(85 intermediate revisions by 9 users not shown)
Line 1: Line 1:
Setting MSGraph Permissions a long with Azure active directory, OneNote and SharePoint permissions is necessary for UMS to obtain access to the functions needed to create OneNote Class Notebooks and upcoming Teams integration.
'''MS graph permissions are required by these UMS modules'''


== Creating App Registration ==
*'''LiveAtEdu'''
Go to [http://portal.azure.com Azure Portal] and login with you admin account( the same UMS uses).
*'''OneNote'''
*'''SharePoint'''
*'''Office 365 Time blocks'''
*'''MS Teams'''
 
==Creating App Registration==
Go to [http://portal.azure.com Azure Portal] and login with you admin account.
 
When logged in go to Azure Active Directory:[[File:Graph1.jpg|left|thumb|832x832px]]


When logged in goto Azure Active Directory:
[[File:MSGraph1.png|thumb|none|900x900px]]


Go to App registrations
Go to App registrations
[[File:MSGraph2.png|thumb|none|900x900px]]
[[File:Graph2.jpg|none|thumb|831x831px]]
 


Click on New application registration
Click on New application registration
[[File:MSGraph3.png|thumb|none|900x900px]]
[[File:Graph3.jpg|none|thumb|909x909px]]
 


Give the new App a name ex. "UMSGraph", Choose "Web app / API" in Application type, set "Sign-on URL" to "http://localhost". After setting Application Permission values click "Create"
Give the new App a name ex. "UMSGraph", Choose "Web app / API" in Application type, set "Sign-on URL" to "http://localhost". After setting Application Permission values click "Create"
[[File:MSGraph4.png|thumb|none|900x900px]]
[[File:Graph43.jpg|none|thumb|913x913px]]


You will return to previous screen, here click "your new app"
You will return to previous screen, here click "your new app"
[[File:MSGraph5.png|thumb|none|900x900px]]
[[File:Grahp5.jpg|none|thumb|905x905px]]
 
 
 
Click "Certificates & secrets"
 
Click "New Client Secret"


Click "Required permissions"
Enter a "Description" and set "Expires" to the interval that suits your needs.
[[File:MSGraph6.png|thumb|none|900x900px]]


Click "Add"
Click "Add"
[[File:MSGraph7.png|thumb|none|900x900px]]
[[File:Graph6.jpg|none|thumb|908x908px]]


Click "Select an API"
[[File:MSGraph8.png|thumb|none|900x900px]]


Click "Microsoft Graph"
[[File:MSGraph9.png|thumb|none|900x900px]]


Click "Select"
Copy "Value ID"   We will use this later
[[File:MSGraph10.png|thumb|none|900x900px]]


Click the left topmost checkbox next to "APPLICATION PERMISSIONS", and scroll down to next section.
'''!!! ATTENTION !!! the key value will never be visible again so ensure to copy it.''' [[File:Graph7.png|none|thumb|790x790px]]
[[File:MSGraph11.png|thumb|none|900x900px]]


Click the checkbox next to "DELEGATED PERMISSIONS"
[[File:MSGraph13.png|thumb|none|900x900px]]


Click "Select"
[[File:MSGraph15.png|thumb|none|900x900px]]


Click "Done"
Copy the "VALUE Key into "UMS Configurator" field Client Secret
[[File:MSGraph16.png|thumb|none|900x900px]]


Click "Add" again
[[File:Tewxddf.png|frameless|566x566px]]


Click "Select an API"


Click "Office 365 SharePoint Online"
Copy the "Directory Tenant ID " into "UMS Configurator" Field Tenant ID
[[File:MSGraph17.png|thumb|none|900x900px]]


Click "Select", as before - click the checkbox next to "APPLICATION PERMISSIONS" and "DELEGATED PERMISSIONS" and click Select.
Copy the "Appplication Client ID " into "UMS Configurator" Field Client ID
[[File:Id.jpg|none|thumb|1120x1120px]]


Click "Done"


Click "Add" again and "Select an API"
Click "Api permissions"


Click "OneNote"
Click "Add a permission"
[[File:MSGraph18.png|thumb|none|900x900px]]
[[File:Graph8.png|none|thumb|780x780px]]


Click "Select", as before - click the checkbox next to "APPLICATION PERMISSIONS" and "DELEGATED PERMISSIONS" and click Select.
==Setup SharePoint, OneNote Class Notebook or Onedrive provisioning==
'''You do not need to fill out the settings in UMS (This was done in the above text) when using OneDrive provisioning.''' Only the "Add SharePoint App permissions" chapter.


Click "Done"
In the UMS Configurator go to Modules->Office 365 and click "SharePoint organization settings"
[[File:UMSConfiguratorSharepointOrganizationSettings.png|none|thumb|600x600px]]
Choose your SharePoint organization setting and click "Edit..."
[[File:UMSConfiguratorSharepointOrganizationSettingsEdit.png|none|thumb|600x600px]]
<span id="SharePointOrganizationSettings">Input</span> your "Tenant Name" ex. "cortenso'''.onmicrosoft.com'''", insert Application ID into "Client ID" field, insert "Client secret" and "Tenant ID" and click "Ok"
[[File:SharepointOrganization SettingsEdit.jpg|none|thumb|585x585px]]


Click "Windows Azure Active Directory" Permission.
===Add SharePoint App permissions===


Click the checkbox next to "APPLICATION PERMISSIONS" and "DELEGATED PERMISSIONS" and click "Save"
*Go to https://'''<tenantname>'''-admin.sharepoint.com/_layouts/15/appinv.aspx
*Enter app Id (AKA Client Id) and press lookup.
*Copy paste the below text in Permission Request XML and save


Select "Windows Azure Active Directory"  
<AppPermissionRequests AllowAppOnlyPolicy="true">
  <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
  <AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="FullControl" />
</AppPermissionRequests>


Click the checkbox next to "APPLICATION PERMISSIONS" and "DELEGATED PERMISSIONS" and click "Save"
[[File:SharePoint Organization Settings App permission.jpg|none|thumb|389x389px|Enter anything you like into Title]]


[[File:Azure Active Directory.png|thumb|899x899px|none]]
====Open newest installed Powershell on the server running the program====
'''Must use Powershell 5'''
#Enable TLS 1.2 for Powershell commands
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 
$NugetPackageProvider = Get-PackageProvider -ListAvailable -Name NuGet -ErrorAction SilentlyContinue
if (!$NugetPackageProvider) {Install-PackageProvider -Name NuGet -Scope AllUsers -Force}
Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force
Import-Module Microsoft.Online.SharePoint.PowerShell
Connect-SPOService -Url https://'''<tenantname>'''-admin.sharepoint.com
Set-SPOTenant -DisableCustomAppAuthentication $false


Now click "Grant Permissions"
===Remove SharePoint App permissions===
[[File:MSGraph19.png|none|thumb|900x900px]]
If you want to remove existing app permission use this link. Maybe you are not using the module anymore.
Click "Yes"
https://'''<tenantname>'''-admin.sharepoint.com/_layouts/15/TA_AllAppPrincipals.aspx
[[File:MSGraph20.png|none|thumb|900x900px]]
Permissions are now set.


Click "Properties"
==Permissions overview==
[[File:MSGraph21.png|none|thumb|900x900px]]
Copy "Application ID" into Configurator ([[#SharePointOrganizationSettings|see last Picture]]) .
[[File:MSGraph22.png|none|thumb|900x900px]]
Click "Keys"
[[File:MSGraph23.png|none|thumb|900x900px]]
Set "DESCRIPTION" to ex. "UMS1" and choose "Never expires" in the "EXPIRES" Setup dropdown
[[File:MSGraph24.png|none|thumb|900x900px]]
Click "Save"
[[File:MSGraph25.png|none|thumb|900x900px]]
Copy the Key in the "VALUE" into Configurator ([[MSGraphPermissions#SharePointOrganizationSettings|see last Picture]]) !!! ATTENTION !!! the key value will never be visible again so ensure to copy it.
[[File:MSGraph26.png|none|thumb|900x900px]]


== Setup UMS to use Application just Created ==
===Microsoft Graph===
In the UMS Configurator go to Modules->Office 365 and click "SharePoint organization settings"
{| class="wikitable sortable"
[[File:UMSConfiguratorSharepointOrganizationSettings.png|none|thumb|600x600px]]
|+Default permissions
Choose your SharePoint organization setting and click "Edit..."
!Permission name
[[File:UMSConfiguratorSharepointOrganizationSettingsEdit.png|none|thumb|600x600px]]
!Permission type
<span id="SharePointOrganizationSettings">Input</span> your "Tenant Name" ex. "cortenso'''.onmicrosoft.com'''", paste the previously copied Application ID into "Client ID" field and paste previously copied KEY into "Client secret" and click "Ok"
!API
[[File:UMSConfiguratorSharepointOrganizationSettingsEditWindow.png|none|thumb|600x600px]]
!Used for
You are now all set to use the new MS Graph integration.
!Used by
|-
|Mail.Send
|Application
|Microsoft Graph
|Send mail from UMS programs
|All programs if selected under mail accounts
|-
|User.ReadWrite.All
|Application
|Microsoft Graph
|Setting attributes on the user in Office 365
|Live_at_edu.exe
|-
|Group.ReadWrite.All
|Application
|Microsoft Graph
|Setting group attributes on Office 365 groups
|Live_at_edu.exe
|-
|GroupMember.ReadWrite.All
|Application
|Microsoft Graph
|Manage GroupMembers in Office 365
|Live_at_edu.exe
|-
|Directory.ReadWrite.All
|Application
|Microsoft Graph
|Setting attributes on the user in Azure Active Directory
|Live_at_edu.exe
|-
|MailboxSettings.ReadWrite
|Application
|Microsoft Graph
|Used to set mailbox settings in Office 365.
Used to get/create categories
|Live_at_edu.exe
Skemabrikker.exe
|-
|Calendars.ReadWrite
|Application
|Microsoft Graph
|Used to allow UMS to sync calendar events to Office 365
|Skemabrikker.exe
|-
|Files.ReadWrite.All
|Application
|Microsoft Graph
|Used to provision OneDrive for users
|Live_at_edu.exe
|-
|Mail.Send
|Application
|Microsoft Graph
|Used when sending mail from All UMS programs. If this is selected under service accounts and mail accounts
|
|-
|User.EnableDisableAccount.All
|Application
|Microsoft Graph
|Used for enabling and disabling users. Only applicable if not using Azure/Entra AD Sync
|Live_at_edu.exe
|}
 
===Teams sync permissions===
{| class="wikitable sortable"
|+
!Permission name
!Permission type
!API
!Used for
!Used by
|-
|EduRoster.ReadWrite.All
|Application
|Microsoft Graph
|Allows the UMS to handle users on roster
|Live_at_edu.exe
|-
|Member.Read.Hidden
|Application
|Microsoft Graph
|Allows the UMS to handle users on roster
|Live_at_edu.exe
|-
|TeamMember.ReadWrite.All
|Application
|Microsoft Graph
|Used to add or remove users from Team
|Live_at_edu.exe
|-
|TeamsTab.ReadWrite.All
|Application
|Microsoft Graph
|Used to create tabs in teams
|Live_at_edu.exe
|-
|TeamsAppInstallation.ReadForTeam.All
|Application
|Microsoft Graph
|Used to install app in teams
|Live_at_edu.exe
|-
|Team.Create
|Application
|Microsoft Graph
|Used to create Teams
|Live_at_edu.exe
|-
|Team.ReadBasic.All
|Application
|Microsoft Graph
|Used to read teams
|Live_at_edu.exe
|}
 
===Change Password when using Azure AD as login===
{| class="wikitable sortable"
|+
!Permission name
!Permission type
!API
!Used for
!Used by
|-
|Directory.AccessAsUser.All
|Delegated
|Microsoft Graph
|
|UMS Web
|-
|User.Read
|Delegated
|Microsoft Graph
|
|UMS Web
|}
See also [[Password Change Azure AD]]
 
===Password Sync===
Go to "Microsoft Entra ID" -> "Roles and Administrators"
 
Note that this is not a graph permission.
{| class="wikitable"
|+
!Rolename
!Permission type
!API
!Used for
!Used by
|-
|Password Administrator
|ServicePrincipal
|Microsoft Graph
|Reset password for Users
|Password_Sync
|}
 
===SharePoint===
{| class="wikitable sortable"
|+
!Permission name
!Permission type
!API
!Used for
!Used by
|-
|Sites.FullControl.All
|Application
|Microsoft Graph
|Have full control of all site collections
|Office365_SP_OneNote.exe
|-
|User.ReadWrite.All
|Application
|Microsoft Graph
|Read and write user profiles
|Office365_SP_OneNote.exe
|}
 
===OneNote===
{| class="wikitable sortable"
|+
!Permission name
!Permission type
!API
!Used for
!Used by
|-
|Notes.ReadWrite.All
|Application
|Microsoft Graph
|
|Office365_SP_OneNote.exe
|}<br />
===Password Administrator===
 
 
To Add Password administrator roles. Click '''Roles and administrator'''
[[File:Passwordd.png|thumb|1167x1167px|none]]
 
*Click Add Assignments and Search for App Registrations name and Click Add.
 
[[File:Password1.png|1167x1167px|thumb|none]]
<br />
 
==FAQ :==
If you get this message when trying to reset password in Office365 using MS Graph Api. This is because user is global Admin and therefore MS graph can not Reset password
[[File:Passwordsync.png|none|thumb|1245x1245px]]The error message below, could indicate a user has roles in Azure/Entra meaning Graph cannot disable them, if the error still persists after removing all roles, it may be the result of Graph not having sufficient permissions, please make sure Graph has the User.EnableDisableAccount.All permission.


__FORCETOC__
(DisableUsers) Error. Could not disable user - User - The user could have roles that does not allow this action. Insufficient privileges to complete the operation.

Latest revision as of 08:32, 5 November 2024

MS graph permissions are required by these UMS modules

  • LiveAtEdu
  • OneNote
  • SharePoint
  • Office 365 Time blocks
  • MS Teams

Creating App Registration

Go to Azure Portal and login with you admin account.

When logged in go to Azure Active Directory:


Go to App registrations


Click on New application registration


Give the new App a name ex. "UMSGraph", Choose "Web app / API" in Application type, set "Sign-on URL" to "http://localhost". After setting Application Permission values click "Create"

You will return to previous screen, here click "your new app"


Click "Certificates & secrets"

Click "New Client Secret"

Enter a "Description" and set "Expires" to the interval that suits your needs.

Click "Add"


Copy "Value ID" We will use this later

!!! ATTENTION !!! the key value will never be visible again so ensure to copy it.


Copy the "VALUE Key into "UMS Configurator" field Client Secret


Copy the "Directory Tenant ID " into "UMS Configurator" Field Tenant ID

Copy the "Appplication Client ID " into "UMS Configurator" Field Client ID


Click "Api permissions"

Click "Add a permission"

Setup SharePoint, OneNote Class Notebook or Onedrive provisioning

You do not need to fill out the settings in UMS (This was done in the above text) when using OneDrive provisioning. Only the "Add SharePoint App permissions" chapter.

In the UMS Configurator go to Modules->Office 365 and click "SharePoint organization settings"

Choose your SharePoint organization setting and click "Edit..."

Input your "Tenant Name" ex. "cortenso.onmicrosoft.com", insert Application ID into "Client ID" field, insert "Client secret" and "Tenant ID" and click "Ok"

Add SharePoint App permissions

  • Go to https://<tenantname>-admin.sharepoint.com/_layouts/15/appinv.aspx
  • Enter app Id (AKA Client Id) and press lookup.
  • Copy paste the below text in Permission Request XML and save
<AppPermissionRequests AllowAppOnlyPolicy="true">
 <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
 <AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="FullControl" />
</AppPermissionRequests>
Enter anything you like into Title

Open newest installed Powershell on the server running the program

Must use Powershell 5

#Enable TLS 1.2 for Powershell commands
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12  

$NugetPackageProvider = Get-PackageProvider -ListAvailable -Name NuGet -ErrorAction SilentlyContinue
if (!$NugetPackageProvider) {Install-PackageProvider -Name NuGet -Scope AllUsers -Force}

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force
Import-Module Microsoft.Online.SharePoint.PowerShell
Connect-SPOService -Url https://<tenantname>-admin.sharepoint.com
Set-SPOTenant -DisableCustomAppAuthentication $false

Remove SharePoint App permissions

If you want to remove existing app permission use this link. Maybe you are not using the module anymore.

https://<tenantname>-admin.sharepoint.com/_layouts/15/TA_AllAppPrincipals.aspx

Permissions overview

Microsoft Graph

Default permissions
Permission name Permission type API Used for Used by
Mail.Send Application Microsoft Graph Send mail from UMS programs All programs if selected under mail accounts
User.ReadWrite.All Application Microsoft Graph Setting attributes on the user in Office 365 Live_at_edu.exe
Group.ReadWrite.All Application Microsoft Graph Setting group attributes on Office 365 groups Live_at_edu.exe
GroupMember.ReadWrite.All Application Microsoft Graph Manage GroupMembers in Office 365 Live_at_edu.exe
Directory.ReadWrite.All Application Microsoft Graph Setting attributes on the user in Azure Active Directory Live_at_edu.exe
MailboxSettings.ReadWrite Application Microsoft Graph Used to set mailbox settings in Office 365.

Used to get/create categories

Live_at_edu.exe

Skemabrikker.exe

Calendars.ReadWrite Application Microsoft Graph Used to allow UMS to sync calendar events to Office 365 Skemabrikker.exe
Files.ReadWrite.All Application Microsoft Graph Used to provision OneDrive for users Live_at_edu.exe
Mail.Send Application Microsoft Graph Used when sending mail from All UMS programs. If this is selected under service accounts and mail accounts
User.EnableDisableAccount.All Application Microsoft Graph Used for enabling and disabling users. Only applicable if not using Azure/Entra AD Sync Live_at_edu.exe

Teams sync permissions

Permission name Permission type API Used for Used by
EduRoster.ReadWrite.All Application Microsoft Graph Allows the UMS to handle users on roster Live_at_edu.exe
Member.Read.Hidden Application Microsoft Graph Allows the UMS to handle users on roster Live_at_edu.exe
TeamMember.ReadWrite.All Application Microsoft Graph Used to add or remove users from Team Live_at_edu.exe
TeamsTab.ReadWrite.All Application Microsoft Graph Used to create tabs in teams Live_at_edu.exe
TeamsAppInstallation.ReadForTeam.All Application Microsoft Graph Used to install app in teams Live_at_edu.exe
Team.Create Application Microsoft Graph Used to create Teams Live_at_edu.exe
Team.ReadBasic.All Application Microsoft Graph Used to read teams Live_at_edu.exe

Change Password when using Azure AD as login

Permission name Permission type API Used for Used by
Directory.AccessAsUser.All Delegated Microsoft Graph UMS Web
User.Read Delegated Microsoft Graph UMS Web

See also Password Change Azure AD

Password Sync

Go to "Microsoft Entra ID" -> "Roles and Administrators"

Note that this is not a graph permission.

Rolename Permission type API Used for Used by
Password Administrator ServicePrincipal Microsoft Graph Reset password for Users Password_Sync

SharePoint

Permission name Permission type API Used for Used by
Sites.FullControl.All Application Microsoft Graph Have full control of all site collections Office365_SP_OneNote.exe
User.ReadWrite.All Application Microsoft Graph Read and write user profiles Office365_SP_OneNote.exe

OneNote

Permission name Permission type API Used for Used by
Notes.ReadWrite.All Application Microsoft Graph Office365_SP_OneNote.exe


Password Administrator

To Add Password administrator roles. Click Roles and administrator

  • Click Add Assignments and Search for App Registrations name and Click Add.


FAQ :

If you get this message when trying to reset password in Office365 using MS Graph Api. This is because user is global Admin and therefore MS graph can not Reset password

The error message below, could indicate a user has roles in Azure/Entra meaning Graph cannot disable them, if the error still persists after removing all roles, it may be the result of Graph not having sufficient permissions, please make sure Graph has the User.EnableDisableAccount.All permission.

(DisableUsers) Error. Could not disable user - User - The user could have roles that does not allow this action. Insufficient privileges to complete the operation.