Set up the Moodle LMS plugins
In this article, you'll learn how to install and configure the Moodle LMS plugins to incorporate Microsoft Teams with your Moodle experience.
Prerequisites
Here are the prerequisites to set up an installed Moodle to work with Microsoft Teams:
- Moodle administrator credentials.
- Microsoft Entra administrator credentials.
- An Azure subscription where you can create new resources.
1. Install the Microsoft 365 Moodle Plugins
Moodle integration with Microsoft Teams is powered by the open source Microsoft 365 Moodle plugins set.
Requisite applications and plugins
Download and install the following items:
A current stable version of Moodle.
Important
If you don't have an existing Moodle site, go to the Moodle on Azure repo, and quickly deploy a Moodle instance and customize it to your needs.
Download and save the Moodle OpenID Connect and the Microsoft 365 Integration plugins to your local computer.
Note
Installing the OpenID Connect and Microsoft 365 Integration plugins is required for the Teams integration.
Also, we recommend installing the Microsoft 365 Teams Theme plugin.
Install plugins
- Download the plugins, extract them, and upload to their corresponding folders.
- Extract the OpenID Connect plugin (auth_oidc) to a folder called oidc, and upload to the auth folder of your Moodle document root.
- Extract the Microsoft 365 Integration plugin (local_o365) to a folder called o365, and upload to the local folder of your Moodle document root.
- Sign in to your Moodle site as an administrator and select Site administration.
- Upon detection of new plugins to be installed, Moodle should redirect you to the install new plugins page. If this doesn't happen, in the Site administration page, select Notifications in the General tab, this action should trigger the installation of the plugins.
- After the new plugins are installed, Moodle will show you a page with all new configurations from the installed plugins. You can safely skip this page by applying the default settings. The plugins will be configured in the following steps.
2. Enable the OpenID Connect authentication plugin
In order for the Moodle plugins to communicate with Microsoft services, the OpenID Connect authentication plugin needs to be turned on and configured.
Navigate to Site Administration > Plugins > Authentication then select Manage Authentication.
Find the OpenID Connect authentication plugin and select the eye icon to turn it on.
Select Settings for the plugin to verify the Authorization and Token endpoints.
- The default values should be:
- Authorization endpoint:
https://login.microsoftonline.com/common/oauth2/authorize
. - Token endpoint:
https://login.microsoftonline.com/common/oauth2/token
.
- Authorization endpoint:
- The default values should be:
Record the Redirect URI for later use.
Note
It's not required for all Moodle users to the OpenID Connect authentication plugin as their authentication method; however, if they use other authentication methods, their Moodle accounts needs to be connected to their corresponding Microsoft accounts before they can use certain features in the Teams integration, such as syncing Teams ownership and membership.
3. Configure the connection between the Microsoft 365 plugins and Microsoft services
You must configure the connection between the Microsoft 365 plugins and Microsoft services before they can work together.
Note
While configuring the integration, keep your Microsoft 365 Moodle Integration configuration page open in a separate browser tab as you need to return to this set of pages throughout the process.
Create Azure app
Navigate to Site Administration > Plugins > Local plugins then select Microsoft 365 Integration. This will open the Microsoft 365 Integration configuration page.
From the Microsoft 365 Integration configuration page, select the Setup tab.
Select the Download PowerShell Script button and save it as a ZIP folder to your local computer.
Note
Running the script creates a new Microsoft Entra application in Microsoft 365 tenant, which sets up the required reply URLs and permissions, gives the required permissions, and returns the
AppID
andKey
.The PowerShell script only works on Windows operation systems.
Prepare the PowerShell script from the ZIP file as follows:
- Download and extract the
Moodle-AzureAD-Powershell.zip
file. - Open the extracted folder.
- Right-click on the
Moodle-AzureAD-Script.ps1
file and select Properties. - Under the General tab of the Properties window, select the
Unblock
checkbox next to the Security attribute located at the bottom of the window. - Select OK.
- Copy the directory path to the extracted folder.
- Download and extract the
Run PowerShell as an administrator:
- In Windows, select Start.
- Type
PowerShell
. - Right-click on Windows PowerShell.
- Select Run as Administrator.
Navigate to the unzipped directory by typing
cd .../.../Moodle-AzureAD-Powershell
where.../...
is the path to the directory.Execute the PowerShell script:
- Enter
./Moodle-AzureAD-Script.ps1
. - When asked, sign in to your Microsoft 365 administrator account in the pop-up window.
- When asked, enter the name of the Microsoft Entra Application, for example, Moodle or Moodle plugins.
- When asked, enter the URL for your Moodle server.
- When asked, enter the reply URL copied from the OpenID Connect authentication plugin configuration page. This is essentially the URL of your Moodle site, followed by
\auth\oidc\
. - You may be asked to sign in to your Microsoft 365 account again in a pop-up window in the process. This is to provide admin consent to the permissions added to the app for your organization.
- When the script finishes execution, copy the Application ID (
AppID
) and Application Key(Key
) generated by the script and save them.
- Enter
Set Azure app details in Moodle
- Return to the OpenID Connect authentication plugin configuration page.
- Paste the
AppID
value into the Application ID box and theKey
value into the Key box, and then select Save changes.
Configure connection between Microsoft plugins and Microsoft services
- From the Microsoft 365 Integration configuration page, select the Setup tab.
- In Choose connection method, select Application access, and then select Save changes again.
- After the page refreshes, you can see another new section Admin consent & additional information.
- Select Provide Admin Consent link, enter your Microsoft 365 Global Administrator credentials, then Accept to grant the permissions.
- Next to the Microsoft Entra tenant field, select the Detect button.
- Next to the OneDrive for Business URL, select the Detect button.
- After the fields populate, select the Save changes button again.
- Select the Update button to verify the installation. If no error is reported at this stage, it means the Microsoft plugins can communicate with Microsoft server via Microsoft Graph APIs.
Configure user and course synchronization
Synchronize users between your Moodle server and Microsoft Entra ID. Depending on your environment, you can select different options during this stage. To get started:
From the Microsoft 365 Integration configuration page, select the Sync Settings tab.
In the Sync users with Microsoft Entra ID setting, select the checkboxes that apply to your environment. You must select the following options:
✔ Create accounts in Moodle for users in Microsoft Entra ID. ✔ Update all accounts in Moodle for users in Microsoft Entra ID.In the User Creation Restriction section, you can set up a filter to limit the Microsoft Entra users that are synced to Moodle.
Note
It's not required to turn on user sync; however, it will make connecting Moodle users with Microsoft 365 accounts much easier.
User sync is performed by running the Sync users with Microsoft Entra ID scheduled task.
In the Course Sync section, you can select Course sync customization option to turn on the automatic creation of Teams for some or all of your existing Moodle courses.
Note
Course sync is performed by running the Sync Moodle courses to Microsoft Teams scheduled task.
Save changes.
To validate sync configuration, you'll need to run the scheduled tasks manually for the first time, navigate to Site administration > Server > Tasks > Scheduled tasks.
- Scroll down and find the task Sync users with Microsoft Entra ID and select Run now.
- This will sync Microsoft Entra users to your Moodle site according to the user sync options.
- Next, find the Sync Moodle courses to Microsoft Teams task and select Run now.
- This task will create Groups for all Moodle courses with sync option turn on, and also Teams if a Team owner can be found in the course.
- The task will also sync Moodle users enrolled in the course to Teams as owners or members.
- A Team owner is a Moodle user who
- is connected to a Microsoft 365 account, AND
- is enrolled in the course, AND
- has the
local/o365:teamowner
capability in the course context.
- Similarly, a Team member is a Moodle user who
- is connected to a Microsoft 365 account, AND
- is enrolled in the course, AND
- has the
local/o365:teamember
capability in the course context.
- The default Teacher role has the
local/o365:teamowner
capability, and the default Student role has thelocal/o365:teammember
capability.
- A Team owner is a Moodle user who
- Scroll down and find the task Sync users with Microsoft Entra ID and select Run now.
Note
The scheduled tasks are triggered by Moodle Cron, which needs to be configured to run frequently. Each scheduled task can have a default schedule, which can be customized.
- The default schedule of the Sync users with Microsoft Entra ID task is every minute.
- The default schedule of the Sync Moodle courses to Microsoft Teams task is daily at 1am in the Moodle server default time zone.
After the plugins are installed and configured, you can:
- Deploy Moodle Assistant Bot to Azure.
- Add Moodle tabs to Teams classes.
- Add Teams classes and meetings to the Moodle LMS.
Extra Moodle plugin documentation
If you would like to review Moodle's Microsoft 365 integration guides and release notes, see these resources: