SmartHotel360 deployed Azure digital Twins to control lights and temperature of the hotel rooms.
SmartHotel360 deployed Azure digital Twins to control lights and temperature of the hotel rooms.
During Connect(); 2017 event this year we presented beautiful app demos using Xamarin and many features of Azure. For //build/ 2018's keynote, we updated some components of the back-end API code to support Azure Kubernetes Service (AKS). This repository contains the setup instructions and sample code needed for the Internet of Things (IoT) Demo utilizing Digital Twins that was announced at Ignite 2018.
For this reference app scenario, we built several consumer and line-of-business apps and an Azure backend. You can find all SmartHotel360 repos in the following locations:
Welcome to the SmartHotel360 IoT repository. Here you'll find everything you need to run the website and backend for the IoT demo.
Check out our Channel9 IoT Show Video about the SmartHotel360 Demo Powered by Digital Twnis:
SmartHotel360 uses a microservice oriented architecture implemented using containers. For the IoT Demo, there are various services developed in different technologies: .NET Core 2, ASP.NET Core 2, and Angular. These services use different Azure Resources like Digital Twins, App Services, Cosmos DB, Event Hubs, Azure Functions, and IoT Hubs to name a few. The step by step walkthrough for creating and provisioning the demo can be found next in the Setup section.
End-to-end setup takes about an hour provided you have all of the development environment prerequisites met AND that your user has the required permissions in your Azure subscription.
You can find a demo scripts with a walkthroughs once you have finished the setup of this demo.
.NET desktop development and ASP.NET and web development workloads installed.az extension add -n azure-cli-iot-extNote: We have updated the deployment script to work with version 0.7.0 or higher.
Follow these instructions to create a service principal and register an Azure Active Directory application.
Web app / API as the Application TypeDuring the creation process you will need to take note of the following information:
To obtain the service principal Id, open a Powershell window and follow these steps:
Login-AzureRmAccount -SubscriptionId {subcription id}Get-AzureRmADServicePrincipal -ApplicationId {app Id}AzureRM is not installed you will receive errors saying that it needs to be installed. Run the following command in an Administrator Powershell: Install-Module -Force AzureRMClick settings --> Required Permissions
Add on the top leftAzure, then choose Azure Digital Twins (Azure Smart Spaces Service)Login-AzureRmAccount -SubscriptionId {subcription id}Register-AzureRmResourceProvider -ProviderNamespace 'Microsoft.IoTSpaces'Get-AzureRmResourceProvider -ProviderNamespace 'Microsoft.IoTSpaces'Add on the top leftAzure, then choose Azure Time Series InsightsLogin-AzureRmAccount -SubscriptionId {subcription id}Register-AzureRmResourceProvider -ProviderNamespace 'Microsoft.TimeSeriesInsights'Get-AzureRmResourceProvider -ProviderNamespace 'Microsoft.TimeSeriesInsights'Grant Permissions (right next to the Add button).To create a service principal for an AKS Cluster, open a Powershell/Command Prompt/Bash window and follow these steps:
az loginaz account set -s {subscription id}az ad sp create-for-rbac --skip-assignmentThe sp create-for-rbac command will return a json object that will have the information needed later in this process.
{
"appId": "{aks app id}",
"displayName": "{aks display name}",
"name": "{aks uri}",
"password": "{aks service principal password}",
"tenant": "{aks tenant id}"
}You need to create users having access to your AAD. These can either be users created in your AAD or guest users that you add. For all of these users, you need to collect the Object Id for them and update /Source/ARM/UserAADObjectIds.json with those values.
In /Source/ARM/ folder of this repository is the deployment script to create and stand up all of the resources to run this demo in Azure. To execute the deployment script, run the following in a Powershell window:
.\deploy.ps1 -subscriptionId {subscription id} -resourceGroupName {resource group name} -resourceGroupLocation {resource group location} -clientId {app id} -clientSecret {app key} -clientServicePrincipalId {service principal id} -aksServicePrincipalId {AKS Service Principal App Id} -aksServicePrincipalKey {AKS Service Principal password}The following information parameters are required for the deployment script:
{subscription id}: the Azure subscription id that has been used in this setup{resource group name}: the resource group name to add the created resource, if it doesn't exist it will be created{resource group location}: location for the resource group: (ie. 'westus2'){app id}: app id obtained from creating an AAD app{app key}: app key obtained from creating an AAD app{service principal id}: service principal id from above{AKS service principal app id}: AKS app id from above{AKS service principal password}: AKS service principal password from aboveThere is a collection of parameters that are used by the deployment script that determine properties like resource location, pricing tiers, and naming. If you wish to modify any of these parameters you can edit the values in parameters.json.
NOTE: In order to support the number of virtual devices required for the demo in the Kubernetes cluster, it will deploy 3 nodes. Please be aware that this can be a large cost.
The Resource Group should look like this:
Note: Due the amount of resources of this demo the consumption of Azure is around $200 approximately per month with three nodes on the AKS cluster. Depending on the Azure region with the default paramenters.
This demo only creates active devices in 1 hotel (SmartHotel360 -> SH360 Elite 1) to reduce the deployment time as well as cost in Azure.
If you want to have devices active in every hotel you will need to add the following parameters when executing the deployment script:
{digitalTwinsProvisioningTemplateFilePath}: This should be set to "DigitalTwinsProvisioning-Full/SmartHotel_Site_Provisioning.yaml"{numberOfAksNodes}: This should be set to 10NOTE: The full deployment can take well over an hour.
If you choose to modify any of the provis
No open issues yet, or sync has not completed.