%3CLINGO-SUB%20id%3D%22lingo-sub-1086750%22%20slang%3D%22en-US%22%3EIntegrate%20Azure%20Sphere%20with%20Azure%20IoT%20Central%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1086750%22%20slang%3D%22en-US%22%3E%3CH1%20id%3D%22integrate-azure-sphere-with-azure-iot-central%22%20id%3D%22toc-hId-359429620%22%20id%3D%22toc-hId-359429656%22%3EIntegrate%20Azure%20Sphere%20with%20Azure%20IoT%20Central%3C%2FH1%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fazure-sphere-iot-central-banner.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CP%3EFollow%20me%20on%20Twitter%20%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2Fdglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%40dglover%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%3E%0A%3CTHEAD%3E%0A%3CTR%3E%0A%3CTH%20align%3D%22left%22%3EAuthor%3C%2FTH%3E%0A%3CTH%20align%3D%22left%22%3E%3CA%20href%3D%22https%3A%2F%2Fdeveloper.microsoft.com%2Fen-us%2Fadvocates%2Fdave-glover%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDave%20Glover%3C%2FA%3E%2C%20Microsoft%20Cloud%20Developer%20Advocate%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3C%2FTHEAD%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3ETarget%20Platform%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3ESeeed%20Studio%20Azure%20Sphere%20MT3620%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3ETarget%20Service%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fiot-central%2F%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Central%3C%2FA%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3EDeveloper%20Platform%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3EWindows%2010%20or%20Ubuntu%2018.04%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3EAzure%20SDK%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3EAzure%20Sphere%20SDK%2019.11%20or%20better%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3EDeveloper%20Tools%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3E%3CA%20href%3D%22https%3A%2F%2Fvisualstudio.microsoft.com%2Fvs%2F%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EVisual%20Studio%20(The%20free%20Community%20Edition%20or%20better)%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fcode.visualstudio.com%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EVisual%20Studio%20Code%20(Free%20OSS)%3C%2FA%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3EHardware%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3E%3CA%20href%3D%22https%3A%2F%2Fwww.seeedstudio.com%2FMT3620-Grove-Shield.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3ESeeed%20Studio%20Grove%20Shield%3C%2FA%3E%2C%20and%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.seeedstudio.com%2FGrove-Temperature-Humidity-Sensor-SHT31.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EGrove%20Temperature%20and%20Humidity%20Sensor%20(SHT31)%3C%2FA%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3ESource%20Code%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%3C%2FA%3E%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3ELanguage%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3EC%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20align%3D%22left%22%3EDate%3C%2FTD%3E%0A%3CTD%20align%3D%22left%22%3EAs%20of%20January%2C%202020%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CH2%20id%3D%22toc-hId-1049991094%22%20id%3D%22toc-hId-1049991130%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22introduction-to-azure-sphere-development%22%20id%3D%22toc-hId--757463369%22%20id%3D%22toc-hId--757463333%22%3EIntroduction%20to%20Azure%20Sphere%20Development%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-1730049464%22%20id%3D%22toc-hId-1730049500%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22what-you-will-learn%22%20id%3D%22toc-hId--77404999%22%20id%3D%22toc-hId--77404963%22%3EWhat%20you%20will%20learn%3C%2FH2%3E%0A%3CP%3EYou%20will%20learn%20how%20to%20build%20an%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fazure-sphere%2F%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Sphere%3C%2FA%3E%20application%20that%20integrates%20with%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fiot-central%2F%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Central%3C%2FA%3E.%20This%20includes%20support%20for%20displaying%20telemetry%2C%20controlling%20the%20device%20state%20using%20IoT%20Central%20%3CEM%3ESettings%3C%2FEM%3E%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-hub%2Fiot-hub-devguide-device-twins%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Hub%20Device%20Twins%3C%2FA%3E)%20and%20%3CEM%3ECommands%3C%2FEM%3E%20(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-hub%2Fiot-hub-devguide-direct-methods%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Hub%20Direct%20Methods%3C%2FA%3E)%2C%20defining%20rules%20to%20trigger%20workflows%2C%20and%20a%20custom%20dashboard.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20unfamiliar%20with%20Azure%20Sphere%20development%20then%20review%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fgloveboxes%2FCreate-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20a%20Secure%20Azure%20Sphere%20App%20using%20the%20Grove%20Shield%20Sensor%20Kit%3C%2FA%3E%20tutorial%20before%20starting%20this%20tutorial.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1884859462%22%20id%3D%22toc-hId--1884859426%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22what-is-azure-sphere%22%20id%3D%22toc-hId-602653371%22%20id%3D%22toc-hId-602653407%22%3EWhat%20is%20Azure%20Sphere%3C%2FH2%3E%0A%3CP%3EAzure%20Sphere%20is%20a%20secured%2C%20high-level%20application%20platform%20with%20built-in%20communication%20and%20security%20features%20for%20internet-connected%20devices.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20comprises%20a%20secured%2C%20connected%2C%20crossover%20microcontroller%20unit%20(MCU)%2C%20a%20custom%20high-level%20Linux-based%20operating%20system%20(OS)%2C%20and%20a%20cloud-based%20security%20service%20that%20provides%20continuous%2C%20renewable%20security.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fazure-sphere.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1204801092%22%20id%3D%22toc-hId--1204801056%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22why-azure-sphere%22%20id%3D%22toc-hId-1282711741%22%20id%3D%22toc-hId-1282711777%22%3EWhy%20Azure%20Sphere%3C%2FH2%3E%0A%3CP%3EAs%20billions%20of%20new%20devices%20are%20connected%2C%20organizations%20need%20to%20secure%20them%20to%20help%20protect%20data%2C%20privacy%2C%20physical%20safety%2C%20and%20infrastructure.%20Azure%20Sphere%20builds%20on%20decades%20of%20Microsoft%20experience%20in%20hardware%2C%20software%2C%20and%20cloud%20to%20provide%20a%20turnkey%20solution%20for%20IoT%20devices.%20Get%20defense%20in%20depth%20to%20embrace%20IoT%20innovation%20with%20confidence.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1973273215%22%20id%3D%22toc-hId-1973273251%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22what-is-azure-iot-central%22%20id%3D%22toc-hId--529344727%22%20id%3D%22toc-hId--529344691%22%3EWhat%20is%20Azure%20IoT%20Central%3C%2FH3%3E%0A%3CP%3EAzure%20IoT%20Central%20provides%20an%20easy%20way%20to%20connect%2C%20monitor%20and%20manage%20your%20Internet%20of%20Things%20(IoT)%20assets%20at%20scale.%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-in%2Fservices%2Fiot-central%2F%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Central%3C%2FA%3E%20is%20a%20hosted%2C%20extensible%20software%20as%20a%20service%20(SaaS)%20platform%20that%20simplifies%20the%20setup%20of%20your%20IoT%20solution%20and%20helps%20reduce%20the%20burden%20and%20costs%20of%20IoT%20management%2C%20operations%2C%20and%20development.%20Provide%20customers%20superior%20products%20and%20services%20while%20expanding%20your%20business%20possibilities.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fazure-iot.png%22%20border%3D%220%22%20alt%3D%22Azure%20IoT%20Central%22%20%2F%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1829085387%22%20id%3D%22toc-hId-1829085423%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22tutorial-overview%22%20id%3D%22toc-hId-21630924%22%20id%3D%22toc-hId-21630960%22%3ETutorial%20Overview%3C%2FH2%3E%0A%3COL%3E%0A%3CLI%3ECreate%20an%20Azure%20IoT%20Central%20Application%20(Free%20trial)%3C%2FLI%3E%0A%3CLI%3ESet%20up%20Azure%20IoT%20Central%20to%20work%20with%20Azure%20Sphere%3C%2FLI%3E%0A%3CLI%3EDeploy%20an%20Azure%20IoT%20Central%20application%20to%20Azure%20Sphere%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22toc-hId--1785823539%22%20id%3D%22toc-hId--1785823503%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22clone-the-following-github-repositories%22%20id%3D%22toc-hId-701689294%22%20id%3D%22toc-hId-701689330%22%3EClone%20the%20following%20GitHub%20Repositories%3C%2FH2%3E%0A%3COL%3E%0A%3CLI%3E%3CP%3EThe%20Azure%20Sphere%20Samples%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Egit%20clone%20https%3A%2F%2Fgithub.com%2FAzure%2Fazure-sphere-samples.git%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EThis%20tutorial%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Egit%20clone%20https%3A%2F%2Fgithub.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central.git%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22toc-hId--1105765169%22%20id%3D%22toc-hId--1105765133%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22create-an-azure-iot-central-application%22%20id%3D%22toc-hId-1381747664%22%20id%3D%22toc-hId-1381747700%22%3ECreate%20an%20Azure%20IoT%20Central%20Application%3C%2FH2%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fazure_iot_central.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CP%3EWe%20are%20going%20to%20create%20an%20Azure%20IoT%20Central%20application%2C%20connect%20Azure%20IoT%20Central%20to%20an%20Azure%20Sphere%20Tenant%2C%20and%20finally%20create%20a%20device.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3EOpen%20the%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-au%2Fservices%2Fiot-central%2F%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Central%3C%2FA%3E%20in%20a%20new%20browser%20tab%2C%20then%20click%20%3CSTRONG%3EGetting%20started%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ENext%2C%20you%20will%20need%20to%20sign%20with%20your%20%3CSTRONG%3EMicrosoft%3C%2FSTRONG%3E%20Personal%2C%20or%20Work%2C%20or%20School%20account.%20If%20you%20do%20not%20have%20a%20Microsoft%20account%2C%20then%20you%20can%20create%20one%20for%20free%20using%20the%20%3CSTRONG%3ECreate%20one!%3C%2FSTRONG%3E%20link.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-login.png%22%20border%3D%220%22%20alt%3D%22iot%20central%22%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ECreate%20a%20new%20Azure%20IoT%20Central%20application.%20Scroll%20to%20the%20bottom%20of%20the%20screen%2C%20select%20%3CSTRONG%3ECreate%20a%20custom%20app%3C%2FSTRONG%3E.%20This%20takes%20you%20to%20the%20%3CSTRONG%3ECreate%20Application%3C%2FSTRONG%3E%20page.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C!--%204.%20Select%20**Build%20as%20app**%0A%0A%20%20%20%20!%5B%5D(https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-build-first-app.png)%0A%0A5.%20Select%20**Custom%20app**%0A%0A%20%20%20%20!%5B%5D(https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-custom-app.png)%20--%3E%0A%3CH3%20id%3D%22toc-hId--296624080%22%20id%3D%22toc-hId--296624044%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22create-a-new-application%22%20id%3D%22toc-hId--2104078543%22%20id%3D%22toc-hId--2104078507%22%3ECreate%20a%20%3CSTRONG%3ENew%20application%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3ESpecify%20%3CSTRONG%3EApplication%20name%3C%2FSTRONG%3E%2C%20%3CSTRONG%3EURL%3C%2FSTRONG%3E%2C%20enable%20%3CSTRONG%3E7-day%20free%20trial%3C%2FSTRONG%3E%2C%20and%20complete%20the%20registration%20form.%20Then%20click%20%3CSTRONG%3ECreate%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-new-application.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3EAdd%20new%20Device%20Template%3C%2FP%3E%0A%3CP%3EClick%20%3CSTRONG%3EDevice%20templates%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-device-template.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ESelect%20%3CSTRONG%3EIoT%20device%3C%2FSTRONG%3E%20template%20type%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-new-iot-device-template.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ECreate%20an%20%3CSTRONG%3EIoT%20Device%3C%2FSTRONG%3E%20Template%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESelect%20%3CSTRONG%3EIoT%20device%3C%2FSTRONG%3E%2C%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3ENext%3ACustomise%3C%2FSTRONG%3E%2C%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3ENext%3A%20Review%3C%2FSTRONG%3E%2C%3C%2FLI%3E%0A%3CLI%3EClick%20Create.%3C%2FLI%3E%0A%3CLI%3EName%20your%20template%20and%20press%20%3CSTRONG%3EEnter%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId-383434290%22%20id%3D%22toc-hId-383434326%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22create-a-capability-model%22%20id%3D%22toc-hId--725858232%22%20id%3D%22toc-hId--725858196%22%3ECreate%20a%20Capability%20Model%3C%2FH3%3E%0A%3CH4%20id%3D%22add-an-interface%22%20id%3D%22toc-hId-1890737320%22%20id%3D%22toc-hId-1890737356%22%3EAdd%20an%20Interface%3C%2FH4%3E%0A%3COL%3E%0A%3CLI%3EClick%20%3CSTRONG%3ECustom%3C%2FSTRONG%3E%2C%20%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-create-custom.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FLI%3E%0A%3CLI%3EClick%20the%20%3CSTRONG%3E%2B%20Add%20interface%3C%2FSTRONG%3E%20to%20add%20an%20%3CSTRONG%3EInterface%3C%2FSTRONG%3E.%20%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-add-interface.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FLI%3E%0A%3CLI%3EChoose%20%3CSTRONG%3ECustom%3C%2FSTRONG%3E%20interface.%20%3C!--%20%3Cimg%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-capability-model.png%22%20alt%3D%22%22%20%2F%3E%20--%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH4%20id%3D%22toc-hId-83282857%22%20id%3D%22toc-hId-83282893%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22add-capabilities%22%20id%3D%22toc-hId--1724171606%22%20id%3D%22toc-hId--1724171570%22%3EAdd%20Capabilities%3C%2FH4%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-add-capability.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CP%3EClick%20%3CSTRONG%3E%26lt%3B%3C%2FSTRONG%3E%20(Collapse)%20to%20create%20more%20working%20space.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3EAdd%20%3CSTRONG%3EHumidity%3C%2FSTRONG%3E%20Capability%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EClick%20%3CSTRONG%3E%2B%3C%2FSTRONG%3E%20to%20Add%20capability.%3C%2FLI%3E%0A%3CLI%3EAdd%20%3CSTRONG%3EHumidity%3C%2FSTRONG%3E%20Telemetry%20Capability%3C%2FLI%3E%0A%3CLI%3ESet%20the%20Unit%20to%20%3CSTRONG%3E%25%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-add-capability-humidity.png%22%20border%3D%220%22%20alt%3D%22add%20capability%22%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EClick%20%3CSTRONG%3EAdd%20Capability%3C%2FSTRONG%3E%20and%20add%20%3CSTRONG%3ETemperature%3C%2FSTRONG%3E%20Capabilities%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EDisplay%20name%3A%20Temperature%3C%2FLI%3E%0A%3CLI%3EName%3A%20Temperature%3C%2FLI%3E%0A%3CLI%3ESemantic%20type%3A%20Temperature%3C%2FLI%3E%0A%3CLI%3EUnits%3A%20C%3C%2FLI%3E%0A%3CLI%3EDisplay%20Unit%3A%20C%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EClick%20%3CSTRONG%3ESave%3C%2FSTRONG%3E%20to%20save%20the%20capabilities%20model.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-save-capabilities.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH4%20id%3D%22toc-hId-763341227%22%20id%3D%22toc-hId-763341263%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22create-a-device-template-view%22%20id%3D%22toc-hId--1044113236%22%20id%3D%22toc-hId--1044113200%22%3ECreate%20a%20Device%20Template%20View%3C%2FH4%3E%0A%3COL%3E%0A%3CLI%3EClick%20%3CSTRONG%3EViews%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EGenerate%20default%20views%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EGenerate%20default%20dashboard%20view(s)%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EYou%20can%20customize%20the%20default%20view%20later.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-create-view.png%22%20border%3D%220%22%20alt%3D%22create%20view%22%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH4%20id%3D%22toc-hId-1443399597%22%20id%3D%22toc-hId-1443399633%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22publish-the-template%22%20id%3D%22toc-hId--364054866%22%20id%3D%22toc-hId--364054830%22%3EPublish%20the%20Template%3C%2FH4%3E%0A%3CP%3EClick%20%3CSTRONG%3EPublish%3C%2FSTRONG%3E%20to%20activate%20the%20template%2C%20then%20click%20%3CSTRONG%3EPublish%3C%2FSTRONG%3E.%20%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-publish-view.png%22%20border%3D%220%22%20alt%3D%22publish%20view%22%20%2F%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1865292529%22%20id%3D%22toc-hId-1865292565%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22connect-azure-iot-central-to-an-azure-azure-sphere-tenant%22%20id%3D%22toc-hId-57838066%22%20id%3D%22toc-hId-57838102%22%3EConnect%20Azure%20IoT%20Central%20to%20an%20Azure%20Azure%20Sphere%20Tenant%3C%2FH2%3E%0A%3CP%3EThe%20Azure%20Sphere%20includes%20out%20of%20the%20box%20support%20for%20Azure%20IoT%20Hub%20and%20IoT%20Central.%3C%2FP%3E%0A%3CP%3EFollow%20the%20complete%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure-sphere%2Fapp-development%2Fsetup-iot-central%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESet%20up%20Azure%20IoT%20Central%20to%20work%20with%20Azure%20Sphere%3C%2FA%3E%20guide.%3C%2FP%3E%0A%3CP%3EIn%20summary%2C%20you%20need%20to%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EOpen%20an%20Azure%20Sphere%20Developer%20Command%20Prompt%3C%2FLI%3E%0A%3CLI%3EAuthenticate%20%3CCODE%3Eazsphere%20login%3C%2FCODE%3E%3C%2FLI%3E%0A%3CLI%3EDownload%20the%20Certificate%20Authority%20(CA)%20certificate%20for%20your%20Azure%20Sphere%20tenant%20%3CCODE%3Eazsphere%20tenant%20download-CA-certificate%20--output%20CAcertificate.cer%3C%2FCODE%3E%3C%2FLI%3E%0A%3CLI%3EUpload%20the%20tenant%20CA%20certificate%20to%20Azure%20IoT%20Central%20and%20generate%20a%20verification%20code%3C%2FLI%3E%0A%3CLI%3EVerify%20the%20tenant%20CA%20certificate%3C%2FLI%3E%0A%3CLI%3EUse%20the%20validation%20certificate%20to%20verify%20the%20tenant%20identity%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--922371737%22%20id%3D%22toc-hId--922371701%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22create-an-azure-device-in-azure-iot-central%22%20id%3D%22toc-hId-1565141096%22%20id%3D%22toc-hId-1565141132%22%3ECreate%20an%20Azure%20Device%20in%20Azure%20IoT%20Central%3C%2FH3%3E%0A%3CP%3EFrom%20the%20Azure%20Sphere%20Developer%20Command%20Prompt%2C%20type%20the%20following%20command.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Eazsphere%20device%20show-attached%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ENote%3A%20The%20Create%20New%20Device%20dialog%20box%20in%20Azure%20IoT%20Central%20requires%20that%20the%20device%20ID%20be%20in%20lowercase%20characters.%20From%20the%20Azure%20Sphere%20Developer%20Command%20Prompt%2C%20enter%20the%20following%20command%2C%20which%20gets%20the%20ID%20of%20the%20attached%20device%20and%20converts%20it%20to%20lowercase%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Epowershell%20-Command%20((azsphere%20device%20show-attached)%5B0%5D%20-split%20'%3A%20')%5B1%5D.ToLower()%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CH4%20id%3D%22switch-back-to-azure-iot-central-web-portal%22%20id%3D%22toc-hId--113230648%22%20id%3D%22toc-hId--113230612%22%3ESwitch%20back%20to%20Azure%20IoT%20Central%20Web%20Portal%3C%2FH4%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3ESelect%20Devices%20from%20the%20side%20menu%2C%20then%20the%20Device%20Template%20previously%20created.%20%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-create-device.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EClick%20%3CSTRONG%3E%2B%20New%3C%2FSTRONG%3E%20to%20add%20a%20new%20device%3C%2FP%3E%0A%3CP%3EPaste%20in%20the%20%3CSTRONG%3Edevice%20ID%3C%2FSTRONG%3E%20you%20generated%20with%20the%20PowerShell%20command%20into%20the%20%3CSTRONG%3EDevice%20ID%3C%2FSTRONG%3E%20field%20and%20give%20your%20device%20a%20friendly%20name.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-create-new-device.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EClick%20%3CSTRONG%3ECreate%3C%2FSTRONG%3E%20to%20create%20the%20new%20device.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22toc-hId-2116116747%22%20id%3D%22toc-hId-2116116783%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22configure-the-azure-sphere-application-for-azure-iot-central%22%20id%3D%22toc-hId-308662284%22%20id%3D%22toc-hId-308662320%22%3EConfigure%20the%20Azure%20Sphere%20Application%20for%20Azure%20IoT%20Central%3C%2FH2%3E%0A%3CP%3EReview%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fazure-sphere-samples%2Fblob%2Fmaster%2FSamples%2FAzureIoT%2FIoTCentral.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Central%20Sample%20%3C%2FA%3E%20guide.%3C%2FP%3E%0A%3CH3%20id%3D%22config-the-azure-sphere-application%22%20id%3D%22toc-hId--1369709460%22%20id%3D%22toc-hId--1369709424%22%3EConfig%20the%20Azure%20Sphere%20Application%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3EOpen%20the%20%3CEM%3ECreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%3C%2FEM%3E%20solution%20you%20cloned%20with%20Visual%20Studio%3C%2FLI%3E%0A%3CLI%3EOpen%20the%20app_manifest.json%20file%3C%2FLI%3E%0A%3CLI%3ESet%20the%20default%20Azure%20Sphere%20Tenant%20You%20may%20need%20to%20select%20the%20default%20Azure%20Sphere%20Tenant.%20Use%20the%20%3CCODE%3Eazsphere%20tenant%20list%3C%2FCODE%3E%20command%20to%20list%20available%20tenants%2C%20use%20the%20%3CCODE%3Eazsphere%20tenant%20select%20-i%20%3CGUID%3E%3C%2FGUID%3E%3C%2FCODE%3E%20to%20select%20the%20default%20tenant.%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EFrom%20the%20Azure%20Sphere%20Developer%20Command%20Prompt%2C%20issue%20the%20following%20command%20to%20get%20the%20tenant%20ID.%20Copy%20the%20returned%20value%20and%20paste%20it%20into%20the%20DeviceAuthentication%20field%20of%20the%20app_manifest.json%20file%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Eazsphere%20tenant%20show-selected%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EFrom%20the%20Azure%20Sphere%20Developer%20Command%20Prompt%2C%20change%20to%20the%20%3CEM%3Eazure-sphere-samples%5CSamples%5CAzureIoT%5CTools%3C%2FEM%3E%20folder%20you%20previously%20cloned%2C%20and%20run%20%3CEM%3EShowIoTCentralConfig.exe%3C%2FEM%3E.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3EShowIoTCentralConfig%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWhen%20prompted%2C%20log%20in%20with%20the%20credentials%20you%20use%20for%20Azure%20IoT%20Central.%3C%2FP%3E%0A%3CP%3EThe%20output%20of%20this%20command%20will%20be%20similar%20as%20follows%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3EAre%20you%20using%20a%20Work%2FSchool%20account%20to%20sign%20in%20to%20your%20IoT%20Central%20Application%20(Y%2FN)%20%3F%0A%0AGetting%20your%20IoT%20Central%20applications%0AYou%20have%20one%20IoT%20Central%20application%20'yourappname-iot-central'.%0AGetting%20the%20Device%20Provisioning%20Service%20(DPS)%20information.%0AGetting%20a%20list%20of%20IoT%20Central%20devices.%0A%0AFind%20and%20modify%20the%20following%20lines%20in%20your%20app_manifest.json%3A%0A%22CmdArgs%22%3A%20%5B%20%220ne9992KK6D%22%20%5D%2C%0A%22AllowedConnections%22%3A%20%5B%20%22global.azure-devices-provisioning.net%22%2C%20%22saas-iothub-9999999-f33a-4002-4444-7ca8989898989.azure-devices.net%22%20%5D%2C%0A%22DeviceAuthentication%22%3A%20%22---%20YOUR%20AZURE%20SPHERE%20TENANT%20ID---%20%22%2C%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3ECopy%20the%20information%20from%20the%20output%20into%20the%20app%3CEM%3Emanifest.json%20file%20in%20Visual%20Studio.%20You%20*app%3C%2FEM%3Emanifest.json*%20file%20will%20look%20similar%20to%20the%20following%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3E%7B%0A%22SchemaVersion%22%3A%201%2C%0A%22Name%22%3A%20%22AzureSphereBlink1%22%2C%0A%22ComponentId%22%3A%20%22a3ca0929-5f46-42b0-91ba-d5de1222da86%22%2C%0A%22EntryPoint%22%3A%20%22%2Fbin%2Fapp%22%2C%0A%22CmdArgs%22%3A%20%5B%20%220ne9992KK6D%22%20%5D%2C%0A%22Capabilities%22%3A%20%7B%0A%20%20%20%20%22Gpio%22%3A%20%5B%209%20%5D%2C%0A%20%20%20%20%22Uart%22%3A%20%5B%20%22ISU0%22%20%5D%2C%0A%20%20%20%20%22AllowedConnections%22%3A%20%5B%20%22global.azure-devices-provisioning.net%22%2C%20%22saas-iothub-9999999-f33a-4002-4444-7ca8989898989.azure-devices.net%22%20%5D%2C%0A%20%20%20%20%22DeviceAuthentication%22%3A%20%22999x999xeb-e021-43ce-8gh8-8k9lp888494%22%0A%7D%2C%0A%22ApplicationType%22%3A%20%22Default%22%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId-1117803373%22%20id%3D%22toc-hId-1117803409%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22configure-visual-studio-app-deployment-settings%22%20id%3D%22toc-hId--689651090%22%20id%3D%22toc-hId--689651054%22%3EConfigure%20Visual%20Studio%20App%20Deployment%20Settings%3C%2FH3%3E%0A%3CP%3EBefore%20building%20the%20application%20with%20Visual%20Studio%20ensure%20ARM-Debug%20and%20GDB%20Debugger%20(HLCore)%20options%20are%20selected.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fvisual-studio-start-config.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1797861743%22%20id%3D%22toc-hId-1797861779%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22build-deploy-and-start-debugging%22%20id%3D%22toc-hId--9592720%22%20id%3D%22toc-hId--9592684%22%3EBuild%2C%20Deploy%2C%20and%20start%20Debugging%3C%2FH3%3E%0A%3CP%3ETo%20start%20the%20build%2C%20deploy%2C%20debug%20process%20either%20click%20the%20Visual%20Studio%20%3CSTRONG%3EStart%20Selected%20Item%3C%2FSTRONG%3E%20icon%20or%20press%20%3CSTRONG%3EF5%3C%2FSTRONG%3E.%20To%20Build%20and%20deploy%20without%20attaching%20the%20debugger%2C%20simply%20press%20%3CSTRONG%3ECtrl%2BF5%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fvisual-studio-start-debug.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1247967961%22%20id%3D%22toc-hId--1247967925%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22azure-iot-central-integration%22%20id%3D%22toc-hId-1239544872%22%20id%3D%22toc-hId-1239544908%22%3EAzure%20IoT%20Central%20Integration%3C%2FH2%3E%0A%3CP%3ENow%20the%20application%20is%20running%20on%20the%20Azure%20Sphere%20switch%20across%20to%20Azure%20IoT%20Central%2C%20select%20the%20%3CSTRONG%3EDevices%3C%2FSTRONG%3E%20tab%2C%20the%20device%20template%20you%20created%2C%20then%20the%20actual%20device.%20You%20may%20have%20to%20wait%20a%20moment%20before%20the%20telemetry%20is%20displayed%20in%20the%20%3CSTRONG%3EMeasurements%3C%2FSTRONG%3E%20panel.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-display-measurements.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--438826872%22%20id%3D%22toc-hId--438826836%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22azure-iot-central-settings%22%20id%3D%22toc-hId-2048685961%22%20id%3D%22toc-hId-2048685997%22%3EAzure%20IoT%20Central%20Settings%3C%2FH3%3E%0A%3CP%3ETo%20work%20with%20settings%20you%20will%20need%20to%20update%20the%20Device%20Template%20and%20add%20settings%20for%20%3CSTRONG%3ELight%3C%2FSTRONG%3E%20and%20%3CSTRONG%3ERelay%3C%2FSTRONG%3E.%20See%20the%20Appendix.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESwitch%20to%20the%20settings%20tab%20on%20Azure%20IoT%20Central%20and%20change%20the%20toggle%20state%20and%20click%20update%20and%20observe%20an%20LED%20on%20the%20Azure%20Sphere%20will%20toggle%20between%20on%20and%20off.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-display-settings.png%22%20border%3D%220%22%20alt%3D%22iot%20central%20device%20settings%22%20%2F%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-112148779%22%20id%3D%22toc-hId-112148815%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22finished-fertig-finito-terminado%22%20id%3D%22toc-hId--1695305684%22%20id%3D%22toc-hId--1695305648%22%3EFinished%20%E5%AE%8C%E4%BA%86%20fertig%20finito%20%E0%A4%96%E0%A4%BC%E0%A4%A4%E0%A5%8D%E0%A4%AE%20%E0%A4%B9%E0%A5%8B%E0%A4%A8%E0%A4%BE%20terminado%3C%2FH2%3E%0A%3CP%3ECongratulations%20you%20have%20finished%20the%20tutorial.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Ffinished.jpg%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-792207149%22%20id%3D%22toc-hId-792207185%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22appendix%22%20id%3D%22toc-hId--1015247314%22%20id%3D%22toc-hId--1015247278%22%3EAppendix%3C%2FH2%3E%0A%3CH3%20id%3D%22understanding-tutorial-solution%22%20id%3D%22toc-hId-1601348238%22%20id%3D%22toc-hId-1601348274%22%3EUnderstanding%20Tutorial%20Solution%3C%2FH3%3E%0A%3CP%3EFrom%20Visual%20Studio%2C%20open%20the%20main.c.%3C%2FP%3E%0A%3CP%3EReview%20the%20following%20functions.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EInitPeripheralsAndHandlers%3C%2FLI%3E%0A%3CLI%3EGetTelemetry%3C%2FLI%3E%0A%3CLI%3ETwinCallback%3C%2FLI%3E%0A%3CLI%3EAzureDirectMethodHandler%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH4%20id%3D%22toc-hId--77023506%22%20id%3D%22toc-hId--77023470%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22initperipheralsandhandlers%22%20id%3D%22toc-hId--1186316028%22%20id%3D%22toc-hId--1186315992%22%3EInitPeripheralsAndHandlers%3C%2FH4%3E%0A%3CP%3ESets%20up%20SIGTERM%20termination%20handler%2C%20initialize%20peripherals%2C%20and%20set%20up%20event%20handlers.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Estatic%20int%20InitPeripheralsAndHandlers(void)%0A%7B%0A%20%20%20%20struct%20sigaction%20action%3B%0A%20%20%20%20memset(%26amp%3Baction%2C%200%2C%20sizeof(struct%20sigaction))%3B%0A%20%20%20%20action.sa_handler%20%3D%20TerminationHandler%3B%0A%20%20%20%20sigaction(SIGTERM%2C%20%26amp%3Baction%2C%20NULL)%3B%0A%0A%20%20%20%20epollFd%20%3D%20CreateEpollFd()%3B%0A%20%20%20%20if%20(epollFd%20%26lt%3B%200)%20%7B%0A%20%20%20%20%20%20%20%20return%20-1%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20OpenPeripheral(%26amp%3Bsending)%3B%0A%20%20%20%20OpenPeripheral(%26amp%3Brelay)%3B%0A%20%20%20%20OpenPeripheral(%26amp%3Blight)%3B%0A%0A%20%20%20%20%2F%2F%20Initialize%20Grove%20Shield%20and%20Grove%20Temperature%20and%20Humidity%20Sensor%0A%20%20%20%20GroveShield_Initialize(%26amp%3Bi2cFd%2C%20115200)%3B%0A%20%20%20%20sht31%20%3D%20GroveTempHumiSHT31_Open(i2cFd)%3B%0A%0A%20%20%20%20StartTimer(%26amp%3BiotClientDoWork)%3B%0A%20%20%20%20StartTimer(%26amp%3BiotClientMeasureSensor)%3B%0A%0A%20%20%20%20return%200%3B%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CH4%20id%3D%22toc-hId-1301196805%22%20id%3D%22toc-hId-1301196841%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22gettelemetry%22%20id%3D%22toc-hId--506257658%22%20id%3D%22toc-hId--506257622%22%3EGetTelemetry%3C%2FH4%3E%0A%3CP%3EReads%20sensor%20telemetry%20and%20returns%20the%20data%20as%20a%20JSON%20object.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Estatic%20int%20ReadTelemetry(char%20eventBuffer%5B%5D%2C%20size_t%20len)%20%7B%0A%20%20%20%20GroveTempHumiSHT31_Read(sht31)%3B%0A%20%20%20%20float%20temperature%20%3D%20GroveTempHumiSHT31_GetTemperature(sht31)%3B%0A%20%20%20%20float%20humidity%20%3D%20GroveTempHumiSHT31_GetHumidity(sht31)%3B%0A%0A%20%20%20%20static%20const%20char*%20EventMsgTemplate%20%3D%20%22%7B%20%5C%22Temperature%5C%22%3A%20%5C%22%253.2f%5C%22%2C%20%5C%22Humidity%5C%22%3A%20%5C%22%253.1f%5C%22%2C%20%5C%22MsgId%5C%22%3A%25d%20%7D%22%3B%0A%20%20%20%20return%20snprintf(eventBuffer%2C%20len%2C%20EventMsgTemplate%2C%20temperature%2C%20humidity%2C%20msgId%2B%2B)%3B%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CH4%20id%3D%22toc-hId-1981255175%22%20id%3D%22toc-hId-1981255211%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22twincallback%22%20id%3D%22toc-hId-173800712%22%20id%3D%22toc-hId-173800748%22%3ETwinCallback%3C%2FH4%3E%0A%3CP%3EHandles%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-hub%2Fiot-hub-devguide-device-twins%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Hub%20Device%20Twins%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3EIn%20Azure%20IoT%20Central%2C%20Azure%20IoT%20Hub%20Device%20Twins%20are%20exposed%20in%20the%20user%20interface%20as%20%3CEM%3ESettings%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-device-settings.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Estatic%20void%20TwinCallback(DEVICE_TWIN_UPDATE_STATE%20updateState%2C%20const%20unsigned%20char*%20payload%2C%0A%20%20%20%20size_t%20payloadSize%2C%20void*%20userContextCallback)%0A%7B%0A%20%20%20%20JSON_Value*%20root_value%20%3D%20NULL%3B%0A%20%20%20%20JSON_Object*%20root_object%20%3D%20NULL%3B%0A%0A%20%20%20%20char*%20payLoadString%20%3D%20(char*)malloc(payloadSize%20%2B%201)%3B%0A%20%20%20%20if%20(payLoadString%20%3D%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20goto%20cleanup%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20memcpy(payLoadString%2C%20payload%2C%20payloadSize)%3B%0A%20%20%20%20payLoadString%5BpayloadSize%5D%20%3D%200%3B%20%2F%2Fnull%20terminate%20string%0A%0A%20%20%20%20root_value%20%3D%20json_parse_string(payLoadString)%3B%0A%20%20%20%20if%20(root_value%20%3D%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20goto%20cleanup%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20root_object%20%3D%20json_value_get_object(root_value)%3B%0A%20%20%20%20if%20(root_object%20%3D%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20goto%20cleanup%3B%0A%20%20%20%20%7D%0A%0A%0A%20%20%20%20JSON_Object*%20desiredProperties%20%3D%20json_object_dotget_object(root_object%2C%20%22desired%22)%3B%0A%20%20%20%20if%20(desiredProperties%20%3D%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20desiredProperties%20%3D%20root_object%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20SetDesiredState(desiredProperties%2C%20%26amp%3Brelay)%3B%0A%20%20%20%20SetDesiredState(desiredProperties%2C%20%26amp%3Blight)%3B%0A%0Acleanup%3A%0A%20%20%20%20%2F%2F%20Release%20the%20allocated%20memory.%0A%20%20%20%20if%20(root_value%20!%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20json_value_free(root_value)%3B%0A%20%20%20%20%7D%0A%20%20%20%20free(payLoadString)%3B%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CH4%20id%3D%22toc-hId--1633653751%22%20id%3D%22toc-hId--1633653715%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22azuredirectmethodhandler%22%20id%3D%22toc-hId-853859082%22%20id%3D%22toc-hId-853859118%22%3EAzureDirectMethodHandler%3C%2FH4%3E%0A%3CP%3EHandles%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-hub%2Fiot-hub-devguide-direct-methods%3FWT.mc_id%3Dtech-communities-blog-dglover%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20IoT%20Hub%20Direct%20Methods%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EIn%20Azure%20IoT%20Central%2C%20Azure%20IoT%20Hub%20Direct%20Methods%20are%20exposed%20in%20the%20user%20interface%20as%20%3CEM%3ECommands%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-device-commands.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CPRE%3E%3CCODE%3Estatic%20int%20AzureDirectMethodHandler(const%20char*%20method_name%2C%20const%20unsigned%20char*%20payload%2C%20size_t%20payloadSize%2C%0A%20%20%20%20unsigned%20char**%20responsePayload%2C%20size_t*%20responsePayloadSize%2C%20void*%20userContextCallback)%20%7B%0A%0A%20%20%20%20const%20char*%20onSuccess%20%3D%20%22%5C%22Successfully%20invoke%20device%20method%5C%22%22%3B%0A%20%20%20%20const%20char*%20notFound%20%3D%20%22%5C%22No%20method%20found%5C%22%22%3B%0A%0A%20%20%20%20const%20char*%20responseMessage%20%3D%20onSuccess%3B%0A%20%20%20%20int%20result%20%3D%20200%3B%0A%20%20%20%20JSON_Value*%20root_value%20%3D%20NULL%3B%0A%20%20%20%20JSON_Object*%20root_object%20%3D%20NULL%3B%0A%0A%20%20%20%20%2F%2F%20Prepare%20the%20payload%20for%20the%20response.%20This%20is%20a%20heap%20allocated%20null%20terminated%20string.%0A%20%20%20%20%2F%2F%20The%20Azure%20IoT%20Hub%20SDK%20is%20responsible%20of%20freeing%20it.%0A%20%20%20%20*responsePayload%20%3D%20NULL%3B%20%20%2F%2F%20Response%20payload%20content.%0A%20%20%20%20*responsePayloadSize%20%3D%200%3B%20%2F%2F%20Response%20payload%20content%20size.%0A%0A%20%20%20%20char*%20payLoadString%20%3D%20(char*)malloc(payloadSize%20%2B%201)%3B%0A%20%20%20%20if%20(payLoadString%20%3D%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20responseMessage%20%3D%20%22payload%20memory%20failed%22%3B%0A%20%20%20%20%20%20%20%20result%20%3D%20500%3B%0A%20%20%20%20%20%20%20%20goto%20cleanup%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20memcpy(payLoadString%2C%20payload%2C%20payloadSize)%3B%0A%20%20%20%20payLoadString%5BpayloadSize%5D%20%3D%200%3B%20%2F%2Fnull%20terminate%20string%0A%0A%20%20%20%20root_value%20%3D%20json_parse_string(payLoadString)%3B%0A%20%20%20%20if%20(root_value%20%3D%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20responseMessage%20%3D%20%22Invalid%20JSON%22%3B%0A%20%20%20%20%20%20%20%20result%20%3D%20500%3B%0A%20%20%20%20%20%20%20%20goto%20cleanup%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20root_object%20%3D%20json_value_get_object(root_value)%3B%0A%20%20%20%20if%20(root_object%20%3D%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20responseMessage%20%3D%20%22Invalid%20JSON%22%3B%0A%20%20%20%20%20%20%20%20result%20%3D%20500%3B%0A%20%20%20%20%20%20%20%20goto%20cleanup%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20if%20(strcmp(method_name%2C%20%22fanspeed%22)%20%3D%3D%200)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20int%20speed%20%3D%20(int)json_object_get_number(root_object%2C%20%22speed%22)%3B%0A%20%20%20%20%20%20%20%20Log_Debug(%22Set%20fan%20speed%20%25d%22%2C%20speed)%3B%0A%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20responseMessage%20%3D%20notFound%3B%0A%20%20%20%20%20%20%20%20result%20%3D%20404%3B%0A%20%20%20%20%7D%0A%0Acleanup%3A%0A%0A%20%20%20%20%2F%2F%20Prepare%20the%20payload%20for%20the%20response.%20This%20is%20a%20heap%20allocated%20null%20terminated%20string.%0A%20%20%20%20%2F%2F%20The%20Azure%20IoT%20Hub%20SDK%20is%20responsible%20of%20freeing%20it.%0A%20%20%20%20*responsePayloadSize%20%3D%20strlen(responseMessage)%3B%0A%20%20%20%20*responsePayload%20%3D%20(unsigned%20char*)malloc(*responsePayloadSize)%3B%0A%20%20%20%20strncpy((char*)(*responsePayload)%2C%20responseMessage%2C%20*responsePayloadSize)%3B%0A%0A%20%20%20%20if%20(root_value%20!%3D%20NULL)%20%7B%0A%20%20%20%20%20%20%20%20json_value_free(root_value)%3B%0A%20%20%20%20%7D%0A%20%20%20%20free(payLoadString)%3B%0A%0A%20%20%20%20return%20result%3B%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CH3%20id%3D%22toc-hId--1082678100%22%20id%3D%22toc-hId--1082678064%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22azure-iot-central-template-settings-for-device-twins%22%20id%3D%22toc-hId-1404834733%22%20id%3D%22toc-hId-1404834769%22%3EAzure%20IoT%20Central%20Template%20Settings%20for%20Device%20Twins%3C%2FH3%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-template-settings-relay.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Fraw.githubusercontent.com%2Fgloveboxes%2FCreate-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central%2Fmaster%2Fresources%2Fiot-central-template-settings-light.png%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1086750%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20will%20learn%20how%20to%20build%20an%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fazure-sphere%2F%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EAzure%20Sphere%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eapplication%20that%20integrates%20with%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fiot-central%2F%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EAzure%20IoT%20Central%3C%2FA%3E.%20This%20includes%20support%20for%20displaying%20telemetry%2C%20controlling%20the%20device%20state%20using%20IoT%20Central%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3ESettings%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-hub%2Fiot-hub-devguide-device-twins%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EAzure%20IoT%20Hub%20Device%20Twins%3C%2FA%3E)%20and%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3ECommands%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-hub%2Fiot-hub-devguide-direct-methods%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3EAzure%20IoT%20Hub%20Direct%20Methods%3C%2FA%3E)%2C%20defining%20rules%20to%20trigger%20workflows%2C%20and%20a%20custom%20dashboard.%3C%2FP%3E%0A%3CP%3EIf%20unfamiliar%20with%20Azure%20Sphere%20development%20then%20review%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fgloveboxes%2FCreate-a-Secure-Azure-Sphere-App-using-the-Grove-Shield-Sensor-Kit%22%20rel%3D%22noopener%20noreferrer%22%20target%3D%22_blank%22%3ECreate%20a%20Secure%20Azure%20Sphere%20App%20using%20the%20Grove%20Shield%20Sensor%20Kit%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etutorial%20before%20starting%20this%20tutorial.%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

Integrate Azure Sphere with Azure IoT Central

Follow me on Twitter @dglover

 

Author Dave Glover, Microsoft Cloud Developer Advocate
Target Platform Seeed Studio Azure Sphere MT3620
Target Service Azure IoT Central
Developer Platform Windows 10 or Ubuntu 18.04
Azure SDK Azure Sphere SDK 19.11 or better
Developer Tools Visual Studio (The free Community Edition or better) or Visual Studio Code (Free OSS)
Hardware Seeed Studio Grove Shield, and the Grove Temperature and Humidity Sensor (SHT31)
Source Code https://github.com/gloveboxes/Create-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Cen...
Language C
Date As of January, 2020

 

Introduction to Azure Sphere Development

 

What you will learn

You will learn how to build an Azure Sphere application that integrates with Azure IoT Central. This includes support for displaying telemetry, controlling the device state using IoT Central Settings (Azure IoT Hub Device Twins) and Commands (Azure IoT Hub Direct Methods), defining rules to trigger workflows, and a custom dashboard.

 

If unfamiliar with Azure Sphere development then review the Create a Secure Azure Sphere App using the Grove Shield Sensor Kit tutorial before starting this tutorial.

 

What is Azure Sphere

Azure Sphere is a secured, high-level application platform with built-in communication and security features for internet-connected devices.

 

It comprises a secured, connected, crossover microcontroller unit (MCU), a custom high-level Linux-based operating system (OS), and a cloud-based security service that provides continuous, renewable security.

 

Why Azure Sphere

As billions of new devices are connected, organizations need to secure them to help protect data, privacy, physical safety, and infrastructure. Azure Sphere builds on decades of Microsoft experience in hardware, software, and cloud to provide a turnkey solution for IoT devices. Get defense in depth to embrace IoT innovation with confidence.

 

What is Azure IoT Central

Azure IoT Central provides an easy way to connect, monitor and manage your Internet of Things (IoT) assets at scale. Azure IoT Central is a hosted, extensible software as a service (SaaS) platform that simplifies the setup of your IoT solution and helps reduce the burden and costs of IoT management, operations, and development. Provide customers superior products and services while expanding your business possibilities.

Azure IoT Central

 

Tutorial Overview

  1. Create an Azure IoT Central Application (Free trial)
  2. Set up Azure IoT Central to work with Azure Sphere
  3. Deploy an Azure IoT Central application to Azure Sphere

 

Clone the following GitHub Repositories

  1. The Azure Sphere Samples

    git clone https://github.com/Azure/azure-sphere-samples.git
    
  2. This tutorial

    git clone https://github.com/gloveboxes/Create-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central.git
    

 

Create an Azure IoT Central Application

We are going to create an Azure IoT Central application, connect Azure IoT Central to an Azure Sphere Tenant, and finally create a device.

  1. Open the Azure IoT Central in a new browser tab, then click Getting started.

  2. Next, you will need to sign with your Microsoft Personal, or Work, or School account. If you do not have a Microsoft account, then you can create one for free using the Create one! link.

    iot central

  3. Create a new Azure IoT Central application. Scroll to the bottom of the screen, select Create a custom app. This takes you to the Create Application page.

 

Create a New application

Specify Application name, URL, enable 7-day free trial, and complete the registration form. Then click Create.

  1. Add new Device Template

    Click Device templates

  2. Select IoT device template type

  3. Create an IoT Device Template

    1. Select IoT device,
    2. Click Next:Customise,
    3. Click Next: Review,
    4. Click Create.
    5. Name your template and press Enter

 

Create a Capability Model

Add an Interface

  1. Click Custom,
  2. Click the + Add interface to add an Interface.
  3. Choose Custom interface.

 

Add Capabilities

Click < (Collapse) to create more working space.

  1. Add Humidity Capability

    1. Click + to Add capability.
    2. Add Humidity Telemetry Capability
    3. Set the Unit to %

    add capability

  2. Click Add Capability and add Temperature Capabilities

    • Display name: Temperature
    • Name: Temperature
    • Semantic type: Temperature
    • Units: C
    • Display Unit: C
  3. Click Save to save the capabilities model.

 

Create a Device Template View

  1. Click Views
  2. Click Generate default views
  3. Click Generate default dashboard view(s)
  4. You can customize the default view later.

    create view

 

Publish the Template

Click Publish to activate the template, then click Publish. publish view

 

Connect Azure IoT Central to an Azure Azure Sphere Tenant

The Azure Sphere includes out of the box support for Azure IoT Hub and IoT Central.

Follow the complete Set up Azure IoT Central to work with Azure Sphere guide.

In summary, you need to:

  1. Open an Azure Sphere Developer Command Prompt
  2. Authenticate azsphere login
  3. Download the Certificate Authority (CA) certificate for your Azure Sphere tenant azsphere tenant download-CA-certificate --output CAcertificate.cer
  4. Upload the tenant CA certificate to Azure IoT Central and generate a verification code
  5. Verify the tenant CA certificate
  6. Use the validation certificate to verify the tenant identity

 

Create an Azure Device in Azure IoT Central

From the Azure Sphere Developer Command Prompt, type the following command.

azsphere device show-attached

Note: The Create New Device dialog box in Azure IoT Central requires that the device ID be in lowercase characters. From the Azure Sphere Developer Command Prompt, enter the following command, which gets the ID of the attached device and converts it to lowercase:

powershell -Command ((azsphere device show-attached)[0] -split ': ')[1].ToLower()

Switch back to Azure IoT Central Web Portal

  1. Select Devices from the side menu, then the Device Template previously created.

  2. Click + New to add a new device

    Paste in the device ID you generated with the PowerShell command into the Device ID field and give your device a friendly name.

  1. Click Create to create the new device.

 

Configure the Azure Sphere Application for Azure IoT Central

Review the Azure IoT Central Sample guide.

Config the Azure Sphere Application

  1. Open the Create-a-Secure-IoT-Solution-with-Azphere-Sphere-and-and-Azure-IoT-Central solution you cloned with Visual Studio
  2. Open the app_manifest.json file
  3. Set the default Azure Sphere Tenant You may need to select the default Azure Sphere Tenant. Use the azsphere tenant list command to list available tenants, use the azsphere tenant select -i <guid> to select the default tenant.
  4. From the Azure Sphere Developer Command Prompt, issue the following command to get the tenant ID. Copy the returned value and paste it into the DeviceAuthentication field of the app_manifest.json file:

    azsphere tenant show-selected
    
  5. From the Azure Sphere Developer Command Prompt, change to the azure-sphere-samples\Samples\AzureIoT\Tools folder you previously cloned, and run ShowIoTCentralConfig.exe.

    ShowIoTCentralConfig
    

    When prompted, log in with the credentials you use for Azure IoT Central.

    The output of this command will be similar as follows:

    Are you using a Work/School account to sign in to your IoT Central Application (Y/N) ?
    
    Getting your IoT Central applications
    You have one IoT Central application 'yourappname-iot-central'.
    Getting the Device Provisioning Service (DPS) information.
    Getting a list of IoT Central devices.
    
    Find and modify the following lines in your app_manifest.json:
    "CmdArgs": [ "0ne9992KK6D" ],
    "AllowedConnections": [ "global.azure-devices-provisioning.net", "saas-iothub-9999999-f33a-4002-4444-7ca8989898989.azure-devices.net" ],
    "DeviceAuthentication": "--- YOUR AZURE SPHERE TENANT ID--- ",
    
  6. Copy the information from the output into the appmanifest.json file in Visual Studio. You *appmanifest.json* file will look similar to the following:

    {
    "SchemaVersion": 1,
    "Name": "AzureSphereBlink1",
    "ComponentId": "a3ca0929-5f46-42b0-91ba-d5de1222da86",
    "EntryPoint": "/bin/app",
    "CmdArgs": [ "0ne9992KK6D" ],
    "Capabilities": {
        "Gpio": [ 9 ],
        "Uart": [ "ISU0" ],
        "AllowedConnections": [ "global.azure-devices-provisioning.net", "saas-iothub-9999999-f33a-4002-4444-7ca8989898989.azure-devices.net" ],
        "DeviceAuthentication": "999x999xeb-e021-43ce-8gh8-8k9lp888494"
    },
    "ApplicationType": "Default"
    }
    

 

Configure Visual Studio App Deployment Settings

Before building the application with Visual Studio ensure ARM-Debug and GDB Debugger (HLCore) options are selected.

 

Build, Deploy, and start Debugging

To start the build, deploy, debug process either click the Visual Studio Start Selected Item icon or press F5. To Build and deploy without attaching the debugger, simply press Ctrl+F5.

 

Azure IoT Central Integration

Now the application is running on the Azure Sphere switch across to Azure IoT Central, select the Devices tab, the device template you created, then the actual device. You may have to wait a moment before the telemetry is displayed in the Measurements panel.

 

Azure IoT Central Settings

To work with settings you will need to update the Device Template and add settings for Light and Relay. See the Appendix.

 

Switch to the settings tab on Azure IoT Central and change the toggle state and click update and observe an LED on the Azure Sphere will toggle between on and off.

iot central device settings

 

Finished 完了 fertig finito ख़त्म होना terminado

Congratulations you have finished the tutorial.

 

Appendix

Understanding Tutorial Solution

From Visual Studio, open the main.c.

Review the following functions.

  1. InitPeripheralsAndHandlers
  2. GetTelemetry
  3. TwinCallback
  4. AzureDirectMethodHandler

 

InitPeripheralsAndHandlers

Sets up SIGTERM termination handler, initialize peripherals, and set up event handlers.

static int InitPeripheralsAndHandlers(void)
{
    struct sigaction action;
    memset(&action, 0, sizeof(struct sigaction));
    action.sa_handler = TerminationHandler;
    sigaction(SIGTERM, &action, NULL);

    epollFd = CreateEpollFd();
    if (epollFd < 0) {
        return -1;
    }

    OpenPeripheral(&sending);
    OpenPeripheral(&relay);
    OpenPeripheral(&light);

    // Initialize Grove Shield and Grove Temperature and Humidity Sensor
    GroveShield_Initialize(&i2cFd, 115200);
    sht31 = GroveTempHumiSHT31_Open(i2cFd);

    StartTimer(&iotClientDoWork);
    StartTimer(&iotClientMeasureSensor);

    return 0;
}

 

GetTelemetry

Reads sensor telemetry and returns the data as a JSON object.

static int ReadTelemetry(char eventBuffer[], size_t len) {
    GroveTempHumiSHT31_Read(sht31);
    float temperature = GroveTempHumiSHT31_GetTemperature(sht31);
    float humidity = GroveTempHumiSHT31_GetHumidity(sht31);

    static const char* EventMsgTemplate = "{ \"Temperature\": \"%3.2f\", \"Humidity\": \"%3.1f\", \"MsgId\":%d }";
    return snprintf(eventBuffer, len, EventMsgTemplate, temperature, humidity, msgId++);
}

 

TwinCallback

Handles Azure IoT Hub Device Twins.

In Azure IoT Central, Azure IoT Hub Device Twins are exposed in the user interface as Settings.

static void TwinCallback(DEVICE_TWIN_UPDATE_STATE updateState, const unsigned char* payload,
    size_t payloadSize, void* userContextCallback)
{
    JSON_Value* root_value = NULL;
    JSON_Object* root_object = NULL;

    char* payLoadString = (char*)malloc(payloadSize + 1);
    if (payLoadString == NULL) {
        goto cleanup;
    }

    memcpy(payLoadString, payload, payloadSize);
    payLoadString[payloadSize] = 0; //null terminate string

    root_value = json_parse_string(payLoadString);
    if (root_value == NULL) {
        goto cleanup;
    }

    root_object = json_value_get_object(root_value);
    if (root_object == NULL) {
        goto cleanup;
    }


    JSON_Object* desiredProperties = json_object_dotget_object(root_object, "desired");
    if (desiredProperties == NULL) {
        desiredProperties = root_object;
    }

    SetDesiredState(desiredProperties, &relay);
    SetDesiredState(desiredProperties, &light);

cleanup:
    // Release the allocated memory.
    if (root_value != NULL) {
        json_value_free(root_value);
    }
    free(payLoadString);
}

 

AzureDirectMethodHandler

Handles Azure IoT Hub Direct Methods

In Azure IoT Central, Azure IoT Hub Direct Methods are exposed in the user interface as Commands.

static int AzureDirectMethodHandler(const char* method_name, const unsigned char* payload, size_t payloadSize,
    unsigned char** responsePayload, size_t* responsePayloadSize, void* userContextCallback) {

    const char* onSuccess = "\"Successfully invoke device method\"";
    const char* notFound = "\"No method found\"";

    const char* responseMessage = onSuccess;
    int result = 200;
    JSON_Value* root_value = NULL;
    JSON_Object* root_object = NULL;

    // Prepare the payload for the response. This is a heap allocated null terminated string.
    // The Azure IoT Hub SDK is responsible of freeing it.
    *responsePayload = NULL;  // Response payload content.
    *responsePayloadSize = 0; // Response payload content size.

    char* payLoadString = (char*)malloc(payloadSize + 1);
    if (payLoadString == NULL) {
        responseMessage = "payload memory failed";
        result = 500;
        goto cleanup;
    }

    memcpy(payLoadString, payload, payloadSize);
    payLoadString[payloadSize] = 0; //null terminate string

    root_value = json_parse_string(payLoadString);
    if (root_value == NULL) {
        responseMessage = "Invalid JSON";
        result = 500;
        goto cleanup;
    }

    root_object = json_value_get_object(root_value);
    if (root_object == NULL) {
        responseMessage = "Invalid JSON";
        result = 500;
        goto cleanup;
    }

    if (strcmp(method_name, "fanspeed") == 0)
    {
        int speed = (int)json_object_get_number(root_object, "speed");
        Log_Debug("Set fan speed %d", speed);
    }
    else
    {
        responseMessage = notFound;
        result = 404;
    }

cleanup:

    // Prepare the payload for the response. This is a heap allocated null terminated string.
    // The Azure IoT Hub SDK is responsible of freeing it.
    *responsePayloadSize = strlen(responseMessage);
    *responsePayload = (unsigned char*)malloc(*responsePayloadSize);
    strncpy((char*)(*responsePayload), responseMessage, *responsePayloadSize);

    if (root_value != NULL) {
        json_value_free(root_value);
    }
    free(payLoadString);

    return result;
}

 

Azure IoT Central Template Settings for Device Twins