Goal of this sample is to acceleratre deployment of Industrial IoT Transparency Patterns. There is no one size fits all solution, as there are many considerations, please review them before moving your workload to production.
- You have Operational Visibility sample working.
-
Create a Single SQL Database using the following az cli commands:
- Create a SQL server:
az sql server create --name iiotsamplesqlserver --resource-group iiotsample --location "West US 2" --admin-user azureuser --admin-password <your password>
- Configure the firewall
az sql server firewall-rule create --resource-group iiosample --server iiotsamplesqlserver -n AllowYourIp --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0
- Create the database
az sql db create --resource-group iiotsample --server iiotsamplesqlserver --name iiotsamplesqldb --sample-name AdventureWorksLT --edition GeneralPurpose --compute-model Serverless --family Gen5 --capacity 2
- Create a SQL server:
-
Run the sqldb/mes-reporting.sql script to create the MES and OEE Reporting tables, along with some sample data
-
Create a Synapse Workspace with default settings:
- Create a Data Lake Storage account
az storage account create --name iiotsamplestaccount --resource-group iiotsample --location westus2 --sku Standard_RAGRS --kind StorageV2
- Create a container
az storage container create --name iiotsamplefs --account-name iiotsamplestaccount --auth-mode login
- Create the Synapse workspace
az synapse workspace create --name iiotsamplesynapsews --resource-group iiotsample --storage-account iiotsamplestaccount --file-system iiotsamplefs --sql-admin-login-user sqladminuser --sql-admin-login-password <ypur password> --location westus2
- Create a Data Lake Storage account
-
Create 2 Linked Services in Synapse Workspace:
- Download synapse/sqlLinkedService.json and add your SQL password
- Download synapse/adxLinkedService.json and add tenantId, servicePrincipalId and servicePrincipalKey related to the Azure Data Explorer created in the prerequisites
- Link the SQL Database created above:
az synapse linked-service create --workspace-name iiotsamplesynapse --name sqllinkedservice --file @"./sqlLinkedService.json"
- Link Azure Data Explorer created in the prerequisites:
az synapse linked-service create --workspace-name iiotsamplessynapse --name adxlinkedservice --file @"./adxLinkedService.json"
-
Upload new Workspace package package/dist/manufacturingmetrics-0.1.0-py3-none-any.whl
-
Create a new Apache Spark Pool:
az synapse spark pool create --name devtestspark --workspace-name iiotsamplesynapse --resource-group iiotsample --spark-version 2.4 --node-count 3 --node-size Small
-
Upload the package/requirements.txt file, select the workspace package created above and click
Apply
. Wait until the packages are deployed.
-
Open
Develop
tab, click on+
and Import the notebook/CalculateOEE.ipynb -
Attach the notebook to the spark cluster created above.
-
In first cell, update the values for
sqldbLinkedServiceName
andkustolinkedServiceName
as created above -
In second cell, update the
oeeDate
to a date which has telemetry data in Data Explorer. -
Run both the cells
-
Open SQL Database created above and verify the data in
OEE
table
-
Open powerbi/oee.pbix file and change the
Data Source settings
to connect with the SQL Database created above.
- Update and ReBuild package
cd package
pip install wheel setuptools
python setup.py bdist_wheel