Dynamics 365 Commerce is integrated with Microsoft Teams to help customers and their employees improve productivity by synchronizing task management between the two applications. Seamless integration between D365 Commerce and Microsoft Teams simplifies task management, and it enables store managers and employees create task lists, assign tasks to multiple stores, and track the status of tasks across stores, from either application.
- D365 Commerce
- Microsoft Teams - Microsoft 365 Business Standard License
D365 Commerce and Microsoft Teams Integration key features.
-
Provision Teams by taking advantage of well-defined information from Commerce, such as the organizational structure and information about stores, workers, permissions, and business context.
-
Easily synchronize ongoing changes (for example, the addition of new stores or hiring of new employees) between Commerce and Teams, but keep Commerce as the master source of organizational structure data.
-
Integrate task management between Commerce and Teams to help store workers, store managers, regional managers, and communications managers handle task management from either application.
The functional flow for the Teams for Frontline Workers scenario can be observed as below:
The suggested physical architecture for the implementation of the Teams for Frontline Workers scenario is as following:
This deployment guide provides detailed steps on how to setup the Microsoft Teams Integration with D365 Commerce. First you it will require a App registration with Azure Active Directory and the required set of permissions that will allow enabling the integration between D365 Commerce and Teams Task Management App.
- Azure Active Directory App Registration
- App Registration with Azure Active Directory
-
In the Azure Portal search bar, search for “Active Directory”, the Azure Active Directory will show up in the services. Choose it to Open Azure Active Directory.
-
In the Azure Active Directory, Click on App registrations
-
In the App registrations, click on add New registration.
-
Name the App registration as “Microsoft Teams Commerce”
-
Under Supported account types: Choose “Accounts in this organizational directory only” (Microsoft only – Single tenant)
-
Under Redirect URI: Select Web and provide the Commerce Finance and Operations URL and add the “oath” suffix. The full URL should look like
https://fabrikam.sandbox.operations.dynamics.com/oath
-
Click in Register to complete.
-
Save the Application (client) ID in the text editor of your preference. It will be used in later steps.
-
In the Microsoft Teams Commerce registered App. Click in Certificates & Secrets
-
Click Add New Client Secret.
-
In the Description, provide a name of your choice for the client secret and click Add.
-
Copy the key value generated for the client secret and save it in and text editor of your choice. The client secret value will be used in future steps. After closing this window, it will not be possible to retrieve the key again and it will require generating a new client secret.
1.Click on API permissions in the left tab, then click on + Add a permission
![Registered App Permissions](./media/registeredapp-permissions.png)
-
In the Request API permissions pop-up and select Microsoft Graph.
-
Select Delegated permissions, then in Select permission type Group to filter results.
-
Under Group and check Group.ReadWrite.All, then click Add permissions button.
-
Click on + Add permission again to add additional permissions.
-
In the Request API permissions pop-up and choose Microsoft Graph.
-
Select Application permissions
-
With Application permissions selected, then in Select permissions search field type Group to filter results.
-
Click in Group to expand and check Group.ReadWrite.All, then click Add permissions button.
-
In API permissions, click + Add Permission.
-
In the Request API permissions pop-up, select APIs my organization uses tab, then search for Microsoft Teams Retail Service and click on it.
-
Select Delegated permissions
-
Click on TaskPublishing to expand, check TaskPublishing.ReadWrite.All, then click Add permissions button.
-
In Azure Portal go to Azure Active Directory
-
App registrations, and then select your APIs app registration.
-
You can use the default value provided, which is in the form api://
<application-client-id>
, or specify a more readable URI likehttps://contoso.com/api
. -
Click save and Continue
-
In Add a Scope page fill the form with the following values:
-
Add another scope by clicking in Add Scope and use the following values.
Property | Value |
---|---|
Scope name | Employees.Write.All |
Who can consent | Admins only |
Admin consent display name | Write access to records |
Admin consent description | Allow the application to have write access to all Employee data. |
-
Leave the remaining fields empty and make sure the state is set to Enabled.
-
Click Add Scope
-
The final result should be similar to the picture below.
![Owned Applications](./media/final-scopes.png)
-
In Azure Portal go to Azure Active Directory
-
App registrations, and then select your APIs app registration.
-
Select API permissions, Add a permission, and then My APIs.
- In My APIs select the Application ID registered in the previous step.
-
Under Select permissions, expand the resource whose scopes you defined for your web API, and select the permissions.
-
If you used the example scope names specified in the previous quickstart, you should see Employees.Read.All and Employees.Write.All.
- Click Add Permissions
-
In Azure Portal go to Azure Active Directory
-
App registrations, and then select your APIs app registration.
- Select API permissions, Add a permission, and then Microsoft Graph
- Choose Microsoft Graph.
- Select Delegated permissions.
-
In Select Permissions search for email
-
Under Permission, check email
-
In Select Permissions search for offline_access
-
Under Permission, check offline_access
-
In Select Permissions search for openid
-
Under Permission, check openid
-
In Select Permissions search for profile
-
Under Permission, check profile
- Select Add permissions to complete the process.
-
In Azure Portal go to Azure Active Directory
-
App registrations, and then select your APIs app registration.
- Select API permissions, Add a permission, and then Microsoft Graph
-
Choose Microsoft Graph.
-
Under Request API permissions Select Application Permissions
-
In Select Permissions search for files
-
Under Permission, check Files.Read.All
-
Select Add permissions to complete the process.
In this deployment guide, covers how to enable Microsoft Dynamics 365 Commerce and Microsoft Teams integration.
• Create an external identity for the worker in Commerce Finance and Operations.
• Add store manager to the Publisher Task Manager
• Provision Teams in Commerce Finance and Operations
• Validate Teams provisioning in the Teams admin center.
• Download Commerce organizational hierarchy to Teams.
• Install Microsoft Teams PowerShell module.
• Upload organization hierarchy to Teams
• Publish a test task list in Teams
-
Log into Commerce Finance and Operations
-
On the left side menu click in Modules
-
Scroll down in the list of options until you find Retail and Commerce.
-
On the right side expand Channels, Stores, and click in All Stores.
- Click on the Retail Channel id for the first store on the list.
- On the top menu, click in Set up and then Workers.
- Find the employee who is the store manager. You can find the role details by clicking on the employee’s name.
- After identifying the store manager, create an Azure Active Directory identity for the employee to be able to log in to Microsoft Teams. Click in Commerce and then Create new identity.
-
In Alias, define a unique alias that is based on the worker’s name. First letter of first name and last name is the naming conventions used in the example below.
-
The UP will be filled automatically.
-
In the password field, define a strong password for the new identity.
-
In the password field, define a strong password for the new identity.
-
Repeat the same steps for all the stores you want to integrate with Microsoft Teams.
- Navigate to Retail and Commerce > Employees > Users
- Select the User ID of Store Manager.
- Select +Assign Roles.
- Select Retail Task Manager and then select OK button.
-
On the Enable Microsoft Teams Integration under settings, change to Yes.
-
Provide the Application ID sometimes referred to as Client ID, generated during the Application registration process.
-
Provide the Application Key. Application Key sometimes referred to as App Password, it is the value generated from the Application Secret key generated in the previous steps.
-
Click Save once you update all the values.
- On the Action Pane, select Provision teams. A batch job that is named Teams provision is created.
- Go to System administration, Inquiries and then Batch jobs, and find the most recent job that has the description Teams provision.
- Wait until this job has finished running.
-
Go to the Teams admin center, and sign in as the administrator of your e-commerce tenant.
-
In the left navigation pane, select Teams to expand it, and then select Manage teams.
-
Confirm that one team has been created for each Commerce retail store.
- Select a team and confirm that store workers have been added to it as members.
- In Commerce Finance and Operations, go to Retail and Commerce, Channel setup and then Microsoft Teams Integration Configuration.
-
Select Download targeting hierarchy, and then select Retail Stores by Region to download a comma-separated values (CSV) file of the organizational hierarchy.
-
Click in Download to save to a local folder in your computer.
Microsoft Teams PowerShell module requires PowerShell 5.1 or higher on all platforms. Install the latest version of PowerShell available for your operating system.
- Check your PowerShell version. To check your PowerShell version, run the following command from within a PowerShell session
PSVersionTable.PSVersion
- Installing using the PowerShellGallery
- Install-Module -Name PowerShellGet -Force -AllowClobber
- Install the Teams PowerShell Module.
- Install-Module -Name MicrosoftTeams -Force -AllowClobber
- To start working with Microsoft Teams PowerShell module, sign in with your Azure credentials.
- Run the following command in PowerShell to authenticate.
- Connect-MicrosoftTeams
-
Upload the TargetingHierarchy.csv to Microsoft Teams. You will use Microsoft Teams PowerShell module and cmdlet Set-TeamTargetingHierarchy installed in the previous steps.
-
Set-TeamTargetingHierarchy -FilePath "C:\TargetingHierarchy.csv"
- Run the following command to check the status of your hierarchy upload.
- Get-TeamTargetingHierarchyStatus
- The command will return the following fields:
Field | Description |
---|---|
Id | The unique ID for the upload. |
Status | Upload status. Values include Starting, Validating, Successful, and Failed |
ErrorDetails | Details if there's an upload error. For more information about the error details, see the Troubleshooting section. If there's no error, this field is blank. |
LastUpdatedAt | Timestamp and date of when the file was last updated. |
LastModifiedBy | The ID of the last user who modified the file. |
FileName | The filename of the CSV. |
- Go to Retail and Commerce, Task management, and Tasks integration with Microsoft Teams.
-
Flip the Enable Task Management Integration to Yes
-
On the Action Pane, select Setup task management. You should receive a notification that indicates that a batch job that is named Teams provision is being created.
-
Provide your credentials if ask for authentication. Click close to continue
-
Go to System administration, Inquiries, and then Batch jobs, and find the most recent job that has the description Teams provision. Wait until this job has finished running.
-
Run the CDX job 1070 to publish the plan ID and store references to Retail Server.
The Dynamics 365 Commerce POS application has task management features that let store managers and workers manage tasks and update task status. Store workers can access tasks either by selecting the Tasks tile on the POS home page or by selecting task notifications.
By default, store workers are taken to the My tasks tab, where they can view the tasks that are assigned to them. However, they can easily switch to the Overdue tasks, Open tasks, and Task lists tabs.
-
Sign into Teams as a communications manager. Typically, communications managers are users who have the Regional manager role in Commerce.
-
In the left navigation pane, select Tasks by Planner. If it does not show-up in your Teams click on the three dots located lower in the left navigation pane.
-
On the Published lists tab, select Create list in the lower right. Important - If there are existing tasks, the Create a List button will be located on the left lower corner.
-
Name the new list Test task list from Retail Communication and Click Create.
- Under Task title, give the first task the title Testing Teams integration. Then select Enter or Click on the check mark on the right.
- In the Drafts list, select the task list. Then select Publish in the upper-right corner.
- In the Select who to publish to dialog box, Click on Select the teams from hierarchy.
- Expand Retail Communication, check the Contoso Retail USA box on the left side, and then click Next.
-
On Take One last look, notice the Test Task List created in the step below is ready to be published to 33 Teams.
-
Check Ready, everything looks good here, and click Publish.
- The Test Task List has been published to all 33 Teams. It is now possible to see under Received that all the Teams for each stores has received the published task.
In this task, you will login into D365 Commerce POS store, view unassigned tasks and assign it to the store employees.
- Log into Commerce POS and Select a Store to Manage and Assign Tasks.
- Once logged into Commerce POS Click on Task Management.
-
In Task Management, click on All Tasks. The Test Task created in Teams completed in previous exercise should show-up in the All Tasks list.
-
Select the Test Task
- Click on Assign a Task at the right lower corner of the screen.
- On the Task List Assigned to field, confirm the task has been assigned to Emma Harris
In this task, you will act as employee and review the assigned tasks in Teams and mark them as complete once the assigned task is completed.
- Log into Teams and navigate to the assigned store
- View the assigned tasks, click on New Test Task
- Mark the New Test Task as complete