# Azure

## Content

* Automatic setup Microsoft Azure and EdgeX
* Verify EdgeX Message

## Automatic setup Microsoft EdgeX

* Install Microsoft Azure CLI. (If there is not any)\
  Reopen command prompt after the first installation on Windows.

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ldahy90A1eekcr5A2U8%2F-MWScZMpLl6kxk8C504F%2F-MWSdrRwSWKvEkEh2g3s%2FUntitled.png?alt=media\&token=60333e54-90ce-496d-8b47-b7e691d9afec)

* Create the Azure IoT hub account. (If there is not any)
* Generate the device certificate.
* Create a registration script of EdgeX.(Windows: export\_to\_azure\_delhi.bat\
  Linux: export\_to\_azure\_delhi.sh)

1.In the EdgeX folder, go to tools\azure and modify script with custom Azure configuration.(Windows: create\_azure\_iothub\_edgex\_delhi.bat; Linux: create\_azure\_iothub\_edgex\_delhi.sh)

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ldahy90A1eekcr5A2U8%2F-MWScZMpLl6kxk8C504F%2F-MWSg26URRMXqn0d4oI2%2FUntitled.png?alt=media\&token=7907d808-dc11-42b9-a869-a7b414cbb584)

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ldahy90A1eekcr5A2U8%2F-MWScZMpLl6kxk8C504F%2F-MWSgQamuYXtH5_jl_cl%2FUntitled.png?alt=media\&token=6b7aa8fa-68ed-4d24-8ef3-0e72aaba845b)

2.Run the script (Windows: create\_azure\_iothub\_edgex\_delhi.bat; Linux: create\_azure\_iothub\_edgex\_delhi.sh)

3.Please follow the instruction to open the URL in the browser, enter code, and sign-in Microsoft with your account to complete the installation

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ldahy90A1eekcr5A2U8%2Fuploads%2FlcovNDRtV98dJiYI0Ovl%2Faz%20login.png?alt=media\&token=361bed98-8328-4931-86e9-6e5f30ca27cd)

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ldahy90A1eekcr5A2U8%2Fuploads%2FNYs2oSrQdoCbH54qxDJP%2Fenter%20code.png?alt=media\&token=5503427a-9e70-4982-bca6-24efa7ab31c8)

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ldahy90A1eekcr5A2U8%2Fuploads%2F11DQO4Utq7mgsRoMxLmB%2Fsign%20in%20azure.png?alt=media\&token=5421718a-a2aa-4e03-a1db-bc19e2fcbd44)

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ldahy90A1eekcr5A2U8%2Fuploads%2FeoCszfo9gjlrFNHWR5Ng%2Fcomplete%20installation.png?alt=media\&token=320cba4f-2cd7-466c-aae4-f693287901fa)

## Verify EdgeX Message

1.In the Azure portal, verify that the event hub has received the EdgeX messages. Select **Overview** > **IoT Hub Usage**. Refresh the page to update the chart. It might take a few seconds for it to show that the messages have been received.

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ldahy90A1eekcr5A2U8%2F-MWSghqBAMwp2gcxpG3y%2F-MWSh0u79gEdUOMi9prv%2FUntitled.png?alt=media\&token=d06e184e-8062-4660-be83-4ab402b11307)

2.You also can receive events from a JavaScript application that we made.

* Cloning application from the repository:\
  &#x20;<https://github.com/Advantech-EdgeX/web-apps-node-iot-hub-data-visualization>
* Open any editor, we choose Visual Studio Code here.
* Open the application by selecting **File** > **Open Directory** in the editor.
* Edit **IotHubConnectionString** and **EventHubConsumerGroup** in launch.json\
  You can find the ConnectionString in create\_azure\_iothub\_edgex\_delhi.bat complete installed screen

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ldahy90A1eekcr5A2U8%2Fuploads%2FSVcICHWijHNfgY5Wxm4F%2Flaunch%20json.png?alt=media\&token=b20469a0-8772-4309-9a93-bf6b22276f9f)

3.In VS Code, press F5 to start debugging.

4.Open a browser to <http://localhost:3000>. It will display EdgeX device data in a chart.

![](https://1210863923-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ldahy90A1eekcr5A2U8%2Fuploads%2FVY2aUwBsGm29ap13A0xz%2FUntitled.png?alt=media\&token=60a6e058-52bc-4ba3-ba7e-24e7a62a35d9)
