You must be an admin in Azure and site admin in SharePoint to make the necessary setup
Create Azure Application
Create a new application inside your Azure.
Here you will find Client Id (App Id) and Tenant Id. These are needed later when adding SharePoint in Canvas.
Add API permission
Go to API permissions and press Add a permission
Choose Application permission, select SharePoint and choose the Sites.Selected permission
Finally, give the permission admin consent:
Create a client secret
Go to Certificates & Secrets
Press New client secret, enter a description and set expires to 24 months
Copy the Secret Value and save it somewhere safe in the meantime. This is also needed later.
Add application in SharePoint
This step must be done for all SharePoint sites you wish to give API access to, under you domain
Go to app invitation page
Open a new browser window and navigate to the following URL:
https://{SharePoint domain}/sites/{site}/_layouts/15/appinv.aspx
SharePoint domain is unique to your organization, for example: connectmyapps.sharepoint.com
Site is the Sharepoint site you wish to give API access to.
Example of full url: https://connectmyapps.sharepoint.com/sites/Sales/_layouts/15/appinv.aspx
Add and trust the Azure application
Enter the Azure Client Id (App Id) from earlier and press Lookup. Title should be automatically populated
Set App Domain to "localhost" and Redirect URL to "https://localhost".
Populate Permission Request XML with the following XML.
<AppPermissionRequests AllowAppOnlyPolicy="true"> <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" /> </AppPermissionRequests>
Feel free to alter the AppPermissionRequest in the XML, for more information: https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint
Press Create. This will redirect you to a site where you have to Trust the application.
Choose Trust It
Add SharePoint as an application in Canvas
Go to the add SharePoint application page in Canvas
Enter Tenant Id, Client Id, Client Secret Value from Azure
Enter your unique SharePoint domain, for example: connectmyapps.sharepoint.com
Press Save & Authenticate