-
Download and install the Azure Storage Emulator
-
Start the emulator from the Start Menu
-
Add
127.0.0.1 protocol-gateway.contoso.com
to your windows hosts file:C:\Windows\System32\drivers\etc\hosts
-
git clone https://github.com/Azure/azure-iot-protocol-gateway
-
Right Click Visual Studio and select
Run As Administrator
-
Open the Protocol Gateway Solution
-
Modify the VS Solution
host\ProtocolGateway.Host.Console\appSettings.config.user
file with your IoT Hub Connection String -
Run the Solution
-
Create a directory for the Node project
-
Copy the other files in this gist to the project directory
-
run
npm install
Open an Adminstrative Powershell Terminal
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname orin.windowsitpro.internal
Assign the thumbprint from the previous command to a variable
$thumbprint = {the return value of the previous command}
Create a password for the cert
$pwd = ConvertTo-SecureString -String "{secure_password}" -Force -AsPlainText
Export the certificate
Export-PfxCertificate -cert "cert:\localMachine\my\$thumbprint" -FilePath c:\temp\cert.pfx -Password $pwd
Open Bash in the Windows Subsystem for Linux and type the following commands
-
cd /mnt/c/temp
-
openssl pkcs12 -in cert.pfx -nocerts -out key.pem -nodes
-
openssl pkcs12 -in cert.pfx -nokeys -out cert.pem
-
openssl rsa -in key.pem -out server.key
-
In Windows Explorer copy the cert files to the Node Project source directory
-
Edit the main.js connectionString with your IoT Hub hostname and Url for the running protocol gateway(
protocol-gateway.contoso.com
). -
From a terminal in the Node project directory run
node main.js