Installation and setup

Completed

To install Connected Customer Service, you need:

  • Dynamics 365 Customer Service with system administrator credentials.

  • Access to a Microsoft Azure subscription.

An organization might decide to use multiple ways to add Connected Customer Service as part of their IoT device management strategy. Which deployment strategy you decide to use depends on factors such as the size and scale of your deployment, your types of devices, and resources that support the deployment.

The two most common scenarios you're likely to encounter are:

  • Microsoft Azure IoT Hub - A platform as a service (PaaS) managed service, hosted in the cloud, that acts as a central message hub for bidirectional communication between an IoT application and the devices that it manages.

  • Custom IoT provider - Allows different IoT vendors to seamlessly integrate their device capabilities within Dynamics 365 Field Service experience.

In this module, we examine the process of deploying Connected Customer Service with an Azure IoT Hub.

Deploying Connected Customer Service to an Azure IoT hub provides an organization with the most flexibility because they can control and build almost every aspect of how to manage and interact with devices. The ensuing sections examine what is needed, from a Microsoft Azure and Microsoft Dynamics 365 standpoint, to move forward.

Deploying Connected Customer Service to an Azure IoT hub is a multi-step process:

  1. Deploy Connected Customer Service and Azure resources from an ARM template.

  2. Create new IoT Provider Instance

  3. Set up IoT endpoint

  4. Authorize an Azure app connection

  5. Update devicerules.json

  6. Start Azure Stream Analytics job

  7. Update Azure Time Series Insights connection

  8. Set up the simulator (optional)

Install or upgrade Field Service

Connected Customer Service is included with Dynamics 365 Customer Service. It becomes available in the user interface for any organization that is running Field Service v8.3 or greater. If you don't see the Connected Customer Service features, you might need to update your Field Service environment.

Connected Customer Service works with the Asset Servicing capabilities for Field Service. In Dynamics 365 Field Service, the customer asset record is used to represent pieces of equipment that a customer owns and are at their locations. An asset can be anything such as a large piece of manufacturing equipment, technology, an appliance, or an air conditioner.

Once in the application, you should see an Assets grouping in the left navigation pane. The grouping includes the following Connected Customer Service items:

  • Assets - Represent customer assets.

  • IoT Alerts - Display alerts that have been received from IoT connected devices.

Screenshot of Customer Service workspace with the IoT Alerts and Customer Assets options highlighted.

Deploy Connected Customer Service and Azure resources

Initially, the Connected Customer Service items that you see in the application navigation aren't connected to any type of IoT management application. Because you want to use Connected Customer Service with an Azure IoT hub, the next thing that you need to do is deploy and connect an Azure IoT hub to your Field Service environment.

To deploy Connected Customer Service, go to the Deployment steps section on https://github.com/microsoft/Dynamics-365-Connected-Field-Service-Deployment#deploy-the-arm-template and deploy the Azure Resource Manager (ARM) template. Select the Deploy to Azure button to initiate the deployment.

Screenshot of Deploy the ARM template with the Deploy to Azure button highlighted.

You need to Choose an existing Azure subscription. Choose a resource group or create one in the selected subscription. Configure the deployment as follows:

  • Subscription: Select a valid Azure subscription.

  • Resource Group: Select Create New (Provide a valid name. Ex. CFSDEP23)

  • CRM Organization Unique Name: Find your organization name

  • Region: Select the region that is closest to your geographical location.

  • CRM Organization URL: The URL of your organization. (Available in the address bar of your web browser when you are in the application. For example: https://org4841####.crm.dynamics.com/)

  • Deploy Simulator (Optional): Deploys a thermostat simulator that you can use to test Field Service Functionality. Set this to YES.

  • Deploy Azure Time Series Insights (Optional): Includes Azure Time Series Insights in your deployment to provide you with IoT device insights and analytics. Set this to NO.

  • Deploy SQL Server for Power BI (Optional): Includes Power BI can help you analyze aggregate data across all your IoT devices in a single view. Deploying Power BI also deploys two other resources: Azure Stream Analytics and SQL Server database. Set this to NO.

Screenshot of Custom deployment filled in with the Review + create button highlighted.

Important

For the purposes of this course, we are going to set the Deploy Simulator to Yes. If we do not set this to yes, you can't test functionality later.

Once you have reviewed the connection, you can create it.

Note

It can take up to 20 minutes for the all the necessary resources to be created.

For step-by-step instructions on deploying from an ARM template, see: Deploy Connected Customer Service and Azure resources for an ARM template.

Create new IoT Provider instance

Once you have deployed the Azure resources to your Resource group, you're going to need to create an IoT instance Provider record in Dynamics 365. The IoT Instance Provider record provides Dynamics 365 with connection information details, so it knows where the necessary IoT resources are stored in Azure.

You create an IoT Provider instance in the Connected Customer Service application. Go to Settings > Providers > New.

You need to provide the following details:

  • Name: Set this to the name of the resource group in Azure where you deployed IoT resources.

  • IoT ProviderChoose or create the IoT provider for IoT Hub.

  • Provider Instance Id: Enter the name of the IoT Hub resource that was deployed to your resource group in Azure.

  • URL: Enter the URL of the overview for the resource group in the Azure portal. Example: https://portal.azure.com/[tenant_id]/subscriptions/[subscription_id]/resourceGroups/[resource_group_name]/overview.

Screenshot of the IoT provider instance filled in.

For more information on locating your Tenant and subscriptions IDs, see:

Once your IoT provider record is created, you set it as the default IoT Provider in this instance. To do this, go to Settings > IoTSettings > IoT Provider Settings. Set the Default IoT Provider Instance field to the provider instance you created.

Screenshot of IoT settings on the IoT Provider Settings tab with Default IoT provider instance highlighted.

For step-by-step instructions on creating an IoT Provider record, see: Create new IoT Provider Instance.

Set up IoT endpoint

In order for Dynamics 365 Connected Customer Service to correctly talk to your Azure IoT hub, you need to configure an IoT endpoint. This provides the connection information for the Service Bus Namespace that is used to interface with your device. To do this, you need to use the Plug-in Registration tool.

Screenshot of the Plugin Registration Tool with the Service Endpoint Registration dialog open and filled in.

For detailed step-by-step instructions on how to configure an IoT end-point using the Plugin registration tool, see: Set up IoT endpoint

Authorize Azure app connection

When you created your IoT Hub resources earlier, there were multiple resources that were created. One of those resources was an API connection resource called commondataservice. This connection is what is used to talk to your Dynamics 365 Field Service instance. For information like registration information and alerts to be communicated and displayed, you need to authorize the API connector with your Dynamics 365 credentials.

You authorize the connection in your Azure portal. Once in your Azure portal, open the resource group you recently deployed IoT Hub to. Open the commondataservice API connection. Select Edit API Connection and select the Authorize button. Sign in with your Dynamics 365 credentials that you use to sign into your Connected Customer Service environment.

Note

These might be different than your Azure credentials to the Azure portal. Select Save to apply your changes.

Screenshot of Edit API connection with commondataservice highlighted.

For more information, see: Authorize Azure app Connection

Update devicerules.json

When you deployed the IoT Hub, there was an Azure Stream Analytics job that was also deployed. This job is used to monitor IoT traffic and help generate Alerts as needed. The Stream Analytics job deployed to your resource group has a reference to a devicerules.json file. This file defines a rule that is used to create IoT Alerts when using the optional device simulator. To use the rule, upload the devicerules.json file and reproduce the directory structure. To receive alerts in Dynamics 365, the exact structure is needed for the sample alert to work.

You need to download the devicerules.json file from the GitHub repo. At any time, you can see the Azure IoT Hub subscription that is connected as an IoT provider.

Open the resource group in the Azure admin portal and select the storage account (The type is Storage account) deployed to your resource group. Select Containers and create a container called devicerules.

Once your device rules container is created, open the devicerules container and select Upload. Select Browse for files and select devicerules.json. Expand the Advanced section, enter 2016-05-30 in the Upload to folder field, then select the Upload button.

Screenshot of devicerules with the Upload blob dialog open and filled in.

Open the newly created folder 2016-05-30 and select Upload. Select Browse for files and select devicerules.json. Expand the Advanced section, enter 22-40 in the Upload to folder field, then select Upload.

Screenshot of devicerules with devicerules.json added and the Upload blob dialog open and filled in.

For complete instructions on updating the devicerules.json file, see: Update devicerules.json.

Start Azure Stream Analytics job

Now that you have configured everything, you need to ensure that each Stream Analytic Job is started. For each Stream Analytics job that was deployed and, from the Overview tab, select Start.

For more information, see: Start Azure Stream Analytics job.

At any time, you can see the Azure IoT Hub subscription that is connected as an IoT provider. This subscription is available from within Dynamics 365 Field Service by selecting the Settings area and then selecting Providers.

Screenshot of Field Service on the Providers page.

Multiple settings and items can be configured from within the Settings area. Other settings are discussed in more detail later.

Many different types of resources are deployed when you use the IoT Deployment app to create your IoT hub. While explaining how to work with the items that are deployed is beyond the scope of this training, it's a good idea to be familiar with the components and resources that are deployed.

At a high level, the deployed items include:

  • Microsoft Azure Service Bus queue - Provides a queue for inbound and outbound messages (commands) that are flowing between Dynamics 365 apps and Azure. When an IoT alert is sent to Dynamics 365 apps, or when a command is sent from Dynamics 365 apps to IoT Hub, it is queued in this location. Send messages to and receive messages from Azure Service Bus queues

  • Microsoft Azure Logic Apps - Provides an orchestration service that uses a Dynamics 365 apps connector and a queue connector. Dynamics 365 app connectors are used to construct entities that are specific to Dynamics 365 apps, and queue connectors are used for polling the queue. Logic Apps

  • Microsoft Azure Stream Analytics - Provides a fully managed, real-time event processing engine that helps to unlock deep insights from data. Stream Analytics helps make it easier for you to set up real-time analytic computations on data that is streaming from devices, sensors, websites, social media, applications, infrastructure systems, and more. It's functioning as a funnel to send selective IoT alerts to Dynamics 365 apps. Stream Analytics

  • IoT Hub - Connected Customer Service uses IoT Hub to manage the state of registered devices and assets. In addition, IoT Hub sends commands and notifications to connected devices and tracks message delivery with acknowledgment receipts. Device messages are sent in a durable way to accommodate intermittently connected devices.

  • Simulator - A test web app to emulate the device that is sending commands or receiving commands from IoT Hub. IoT Hub

  • Microsoft Azure SQL Database - Connected Customer Service uses Azure SQL to store device heartbeat messages for later use by Power BI to show the status of devices in Dynamics 365 apps. Azure SQL Database

  • Microsoft Azure Blob Storage - Queries that Stream Analytics uses are stored to Azure Blob Storage. Storage

  • Connected Customer Service device readings (preview) - Uses Azure Time Series Insights to store, process, and query IoT device measurements from IoT Hub. Visualizing device readings