Streaming & Messaging Azure

Mosquitto and Node-RED on Windows Server 2025 on Azure User Guide

| Product: Mosquitto and Node-RED on Windows Server 2025

Overview

Eclipse Mosquitto is a lightweight open source MQTT broker: devices, sensors and programs publish messages to topics on it, and everything subscribed to those topics receives them. Node-RED is an open source, browser based flow editor for wiring those messages to APIs, files, databases and dashboards by joining nodes together, with JavaScript where you need it.

This image runs Mosquitto 2.1.4 and Node-RED 5.0.10 (on Node.js 24.23.0 LTS) on Windows Server 2025 Datacenter (Desktop Experience), already connected to each other. The Node-RED editor is served over HTTPS on port 443, and port 80 redirects to HTTPS. Mosquitto accepts MQTT over TLS on port 8883 from your clients, and plain MQTT on 127.0.0.1:1883 for programs on the server itself, such as Node-RED. Every client signs in: anonymous MQTT is refused, and the editor asks for a user name and password. On the first boot of every VM the image creates this VM's own Node-RED and MQTT passwords, Node-RED's credential encryption key and a TLS certificate; neither service starts until that is done. The Windows Server licence is included in the virtual machine price that Microsoft bills; Mosquitto (EPL-2.0 or EDL-1.0) and Node-RED (Apache-2.0) are free software. cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours.

What is included:

  • Eclipse Mosquitto 2.1.4 from mosquitto.org's Windows installer (checksum verified), installed in C:\Program Files\mosquitto, running as the Windows service Mosquitto under its own virtual account NT SERVICE\Mosquitto
  • Node-RED 5.0.10, installed from a locked, checksum verified package list in C:\Program Files\Node-RED, running as the Windows service NodeRED under its own virtual account NT SERVICE\NodeRED, on Node.js 24.23.0 LTS
  • MQTT over TLS on TCP 8883 for your clients, and plain MQTT on 127.0.0.1:1883 for this server only; anonymous clients refused on both; one MQTT account, cloudimg, with this VM's own password, stored hashed
  • The Node-RED editor and admin API over HTTPS on TCP 443, signed in as admin with this VM's own password; port 80 redirects to HTTPS
  • A demo flow, MQTT Demo, that publishes to and subscribes from the broker, so you can see the two working together as soon as you sign in
  • This VM's own self signed TLS certificate, shared by Node-RED and Mosquitto, and Windows Firewall rules for 443, 80 and 8883
  • Windows Server 2025 Datacenter, patched with Windows Update at build, with Microsoft Defender Antivirus and Windows Firewall on
  • cloudimg's support team on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours

Prerequisites

An active Azure subscription, a Remote Desktop client, and a virtual network in the target region. Standard_B2ms (2 vCPU, 8 GiB RAM) is a good starting point for a broker with a few hundred clients and a handful of flows; choose a larger size for many connected devices, high message rates or heavy flows. In the network security group, allow inbound TCP 3389 (Remote Desktop), TCP 443 (the Node-RED editor), TCP 80 (the redirect to HTTPS) and TCP 8883 (MQTT over TLS) from your own address ranges only.

Step 1: Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Mosquitto and Node-RED on Windows Server 2025 by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size, and set the Administrator account username and password. Under Inbound port rules allow RDP (3389), HTTP (80) and HTTPS (443). After the VM is created, add an inbound rule for TCP 8883 to its network security group, and narrow each rule's source to your own address range. Select Review + create, then Create.

Step 2: Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn cloudimg1647283583153:mosquitto-node-red-windows-server:default:latest

az vm create \
  --resource-group <your-rg> \
  --name mqtt-node-red \
  --image cloudimg1647283583153:mosquitto-node-red-windows-server:default:latest \
  --size Standard_B2ms \
  --admin-username <admin-name> \
  --admin-password '<a strong password>' \
  --public-ip-sku Standard

az vm open-port --resource-group <your-rg> --name mqtt-node-red --port 3389 --priority 1000
az vm open-port --resource-group <your-rg> --name mqtt-node-red --port 443 --priority 1010
az vm open-port --resource-group <your-rg> --name mqtt-node-red --port 80 --priority 1020
az vm open-port --resource-group <your-rg> --name mqtt-node-red --port 8883 --priority 1030

az vm open-port opens each port to any address; narrow the rules to your own ranges in the network security group afterwards.

First boot takes a few minutes. When the VM first starts, Windows finishes its setup, then the image creates this VM's passwords, key and certificate and starts Mosquitto and Node-RED. Until then nothing answers on ports 80, 443 and 8883. The setup is finished when the file C:\ProgramData\mosquitto-node-red-windows-server-firstboot.done exists (Step 4).

Step 3: Connect with Remote Desktop

Connect to the VM's public IP address with your Remote Desktop client (on Windows, mstsc; on macOS, Windows App), signing in with the administrator name and password you set at deployment. Open Windows PowerShell as administrator for the commands below.

Step 4: Confirm Mosquitto and Node-RED are running

Test-Path C:\ProgramData\mosquitto-node-red-windows-server-firstboot.done
Get-CimInstance Win32_Service -Filter "Name='Mosquitto' OR Name='NodeRED'" | Format-Table Name, State, StartMode, StartName -AutoSize
Get-NetTCPConnection -State Listen -LocalPort 80, 443, 1883, 8883 | Sort-Object LocalPort | Format-Table LocalAddress, LocalPort, @{n='Process';e={(Get-Process -Id $_.OwningProcess).ProcessName}} -AutoSize
& 'C:\Program Files\nodejs\node.exe' -v
(Get-Content 'C:\Program Files\Node-RED\node_modules\node-red\package.json' | ConvertFrom-Json).version
(& 'C:\Program Files\mosquitto\mosquitto.exe' -h 2>&1 | Select-Object -First 1).ToString()
Get-NetFirewallRule -Group 'Mosquitto and Node-RED' | Get-NetFirewallPortFilter | Format-Table Protocol, LocalPort -AutoSize
True

Name      State   StartMode StartName
----      -----   --------- ---------
Mosquitto Running Auto      NT SERVICE\Mosquitto
NodeRED   Running Auto      NT SERVICE\NodeRED

LocalAddress LocalPort Process
------------ --------- -------
0.0.0.0             80 node
0.0.0.0            443 node
127.0.0.1         1883 mosquitto
::                8883 mosquitto
0.0.0.0           8883 mosquitto

v24.23.0
5.0.10
1796277082: mosquitto version 2.1.4 terminating

Protocol LocalPort
-------- ---------
TCP      443
TCP      80
TCP      8883

First boot has finished, and both services are running and start automatically with Windows, each under its own virtual account. Node-RED (node) listens on 443 and 80, and Mosquitto on 8883 on every address (IPv4 and IPv6) and on 1883 on 127.0.0.1 only, so plain, unencrypted MQTT is never reachable from the network. The next lines are the Node.js, Node-RED and Mosquitto versions (mosquitto -h prints its version with a timestamp, then exits), and the last table is the Windows Firewall rules the image adds.

An elevated PowerShell window on a new VM: Mosquitto and Node-RED running and set to start automatically as their own virtual accounts, ports 80 and 443 on Node-RED, 8883 on every address and 1883 on 127.0.0.1 only for Mosquitto, and the firewall rules for 80, 443 and 8883

Step 5: Read your passwords

First boot wrote this VM's passwords to a file that only the SYSTEM account and the Administrators group can read. To see the file with the passwords hidden, and its permissions:

Get-Content C:\ProgramData\mosquitto-node-red-windows-server-credentials.txt | ForEach-Object { $_ -replace '(\.password=).*', '$1<hidden in this output>' }
(Get-Acl C:\ProgramData\mosquitto-node-red-windows-server-credentials.txt).Access | Format-Table IdentityReference, FileSystemRights -AutoSize
# Mosquitto and Node-RED on Windows Server 2025 by cloudimg: this VM's own sign-ins (made at first boot).
# Node-RED editor: https://<this VM's public IP>/ (port 80 redirects there), user admin.
# MQTT broker: <this VM's public IP> port 8883 (MQTT over TLS), user cloudimg; 127.0.0.1:1883 on this server.
# The certificate is this VM's own, self-signed: its public half is C:\ProgramData\Mosquitto\ssl\mosquitto-cert.pem.
# Guide: https://www.cloudimg.co.uk/guides/mosquitto-and-node-red-on-windows-server-2025-azure/

mosquitto-node-red-windows-server.node-red.user=admin
mosquitto-node-red-windows-server.node-red.password=<hidden in this output>
mosquitto-node-red-windows-server.mqtt.user=cloudimg
mosquitto-node-red-windows-server.mqtt.password=<hidden in this output>

IdentityReference      FileSystemRights
-----------------      ----------------
NT AUTHORITY\SYSTEM         FullControl
BUILTIN\Administrators      FullControl

Run Get-Content C:\ProgramData\mosquitto-node-red-windows-server-credentials.txt on its own to see the passwords. node-red.password is the Node-RED editor's admin password, and mqtt.password is the MQTT user cloudimg's password. Keep the file safe.

An elevated PowerShell window: the credentials file readable by SYSTEM and Administrators only, and its contents with both passwords hidden

Step 6: Sign in to the Node-RED editor

On your own computer, browse to https://<vm-public-ip>/. The certificate is this VM's own self signed one, so your browser warns about it the first time: accept it to continue (or install a trusted certificate, see Use a trusted certificate below). http:// addresses redirect to HTTPS. Sign in as admin with the node-red.password from Step 5.

The editor opens on the MQTT Demo flow. Send test message (an inject node) publishes hello from Node-RED via Mosquitto to the topic cloudimg/demo through publish cloudimg/demo (an MQTT out node). subscribe cloudimg/demo (an MQTT in node) receives every message on that topic and passes it to append to mqtt-inbox.log, which writes it to C:\ProgramData\Node-RED\mqtt-inbox.log, and to received message, which shows it in the Debug sidebar. The green connected under both MQTT nodes means Node-RED has signed in to Mosquitto.

The Node-RED editor after signing in: the MQTT Demo flow, with an inject node publishing to cloudimg/demo and an MQTT in node subscribed to it, both connected to the broker

Step 7: Send a message through the broker

Select the square button on the left of Send test message. The message goes out to Mosquitto and comes back through the subscription: it appears in the Debug sidebar on the right (open it with the bug icon, or ctrl-g d), with its topic, cloudimg/demo, and its payload.

The Debug sidebar showing two messages received on cloudimg/demo: hello from Node-RED via Mosquitto

Step 8: The MQTT nodes and the broker connection

Double-click publish cloudimg/demo to see how it is set up: the Server is the configuration node Local Mosquitto, then the topic, QoS and retain flag. Select the pencil next to Local Mosquitto to see the broker connection: 127.0.0.1 port 1883, signed in as cloudimg. The MQTT password is stored in Node-RED's credentials file, flows_cred.json, encrypted with this VM's own credential secret. Add your own MQTT in and MQTT out nodes, pick Local Mosquitto as their server, and select Deploy to start them.

The Edit mqtt out node dialog for publish cloudimg/demo: server Local Mosquitto, topic cloudimg/demo, QoS 1

To add nodes beyond Node-RED's built-in set, open the main menu (top right), choose Manage palette, and use its Install tab to search the Node-RED library. The Nodes tab lists what is installed: on a new VM, Node-RED 5.0.10's own 50 nodes.

Manage palette in User Settings: the Nodes tab with node-red 5.0.10 and its 50 nodes in use, and the Install tab for adding more

Step 9: Use the Node-RED admin API

Everything the editor does goes through Node-RED's admin API, at the same address, which you can script. It needs a token: request one with the admin password, then send it as a bearer token. On the VM, curl.exe checks Node-RED's certificate against this VM's own copy of it:

$ca = 'C:\ProgramData\Node-RED\ssl\node-red-cert.pem'
curl.exe -s -o NUL -w "%{http_code}`n" --cacert $ca https://localhost/flows
$pw = (Select-String -Path C:\ProgramData\mosquitto-node-red-windows-server-credentials.txt -Pattern '\.node-red\.password=(.+)').Matches[0].Groups[1].Value
$body = @{ client_id = 'node-red-admin'; grant_type = 'password'; scope = '*'; username = 'admin'; password = $pw } | ConvertTo-Json -Compress
$token = (($body | curl.exe -s --cacert $ca -H 'Content-Type: application/json' --data-binary '@-' https://localhost/auth/token) | ConvertFrom-Json).access_token; "token length: $($token.Length)"
(curl.exe -s --cacert $ca -H "Authorization: Bearer $token" https://localhost/flows | ConvertFrom-Json) | Format-Table id, type, name, label -AutoSize
curl.exe -s --cacert $ca -X POST -H "Authorization: Bearer $token" https://localhost/inject/cimginject0001; ''; Start-Sleep 2; Get-Content C:\ProgramData\Node-RED\mqtt-inbox.log -Tail 1
curl.exe -s -o NUL -w "%{http_code} %{redirect_url}`n" http://localhost/
401

token length: 172

id             type        name                     label
--             ----        ----                     -----
cimgtab0000001 tab                                  MQTT Demo
cimgbroker0001 mqtt-broker Local Mosquitto
cimginject0001 inject      Send test message
cimgmqttout001 mqtt out    publish cloudimg/demo
cimgmqttin0001 mqtt in     subscribe cloudimg/demo
cimgfileout001 file        append to mqtt-inbox.log
cimgdebug00001 debug       received message

OK

hello from Node-RED via Mosquitto

301 https://localhost/

Without a token the API answers 401. With one, /flows lists the demo flow's nodes, and POST /inject/<node id> presses the inject button: the message goes round through Mosquitto and lands in mqtt-inbox.log. Port 80 answers 301 to the HTTPS address. From your own computer the same calls work against https://<vm-public-ip>/ (copy the certificate first, as in Step 11, or let your client trust it).

Step 10: Publish and subscribe over MQTT

Mosquitto's command line clients, mosquitto_pub and mosquitto_sub, are installed with the broker. This subscribes to every topic under cloudimg/, publishes a message over TLS on port 8883 as cloudimg, shows that an anonymous client is refused, and publishes to the demo flow's topic:

$pw = (Select-String -Path C:\ProgramData\mosquitto-node-red-windows-server-credentials.txt -Pattern '\.mqtt\.password=(.+)').Matches[0].Groups[1].Value
$ca = 'C:\ProgramData\Mosquitto\ssl\mosquitto-cert.pem'
$sub = Start-Job { & 'C:\Program Files\mosquitto\mosquitto_sub.exe' -h localhost -p 8883 --cafile $using:ca -u cloudimg -P $using:pw -t 'cloudimg/#' -C 1 -W 20 -v }; Start-Sleep 3
& 'C:\Program Files\mosquitto\mosquitto_pub.exe' -h localhost -p 8883 --cafile $ca -u cloudimg -P $pw -t 'cloudimg/test' -m 'hello over TLS'; "exit code $LASTEXITCODE"
Receive-Job $sub -Wait
& 'C:\Program Files\mosquitto\mosquitto_pub.exe' -h localhost -p 8883 --cafile $ca -t 'cloudimg/test' -m 'anonymous' 2>&1; "exit code $LASTEXITCODE"
& 'C:\Program Files\mosquitto\mosquitto_pub.exe' -h localhost -p 8883 --cafile $ca -u cloudimg -P $pw -t 'cloudimg/demo' -m 'hello from the guide'; Start-Sleep 2; Get-Content C:\ProgramData\Node-RED\mqtt-inbox.log -Tail 2
exit code 0

cloudimg/test hello over TLS

mosquitto_pub.exe : Connection error: Connection Refused: not authorised
At line:1 char:1
+ & 'C:\Program Files\mosquitto\mosquitto_pub.exe' -h localhost -p 8883 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Connection erro... not authorised:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Error: The connection was refused
exit code 5

hello from Node-RED via Mosquitto
hello from the guide

The subscriber receives hello over TLS on cloudimg/test. A client without a user name and password is refused with not authorised (exit code 5), and the message published to cloudimg/demo is picked up by the demo flow's subscription and written to its inbox file, after the message from Step 9.

An elevated PowerShell window: a message published over TLS on port 8883 and received by mosquitto_sub, then the demo flow's inbox file showing it

Step 11: Connect your own MQTT clients

Your devices and programs connect to <vm-public-ip> on port 8883 with MQTT over TLS, user cloudimg and the mqtt.password from Step 5. Because the certificate is this VM's own self signed one, give your client its public half as the CA certificate: copy C:\ProgramData\Mosquitto\ssl\mosquitto-cert.pem from the VM (it holds no secret), then, for example, with the Mosquitto clients on your own computer:

mosquitto_sub -h <vm-public-ip> -p 8883 --cafile mosquitto-cert.pem -u cloudimg -P '<mqtt password>' -t 'cloudimg/#' -v
mosquitto_pub -h <vm-public-ip> -p 8883 --cafile mosquitto-cert.pem -u cloudimg -P '<mqtt password>' -t 'cloudimg/demo' -m 'hello from my laptop'

The certificate is named for the VM's public IP address, its private IP address, its computer name and localhost, so connect by one of those (or install your own certificate, below). The message published to cloudimg/demo appears in Node-RED's Debug sidebar. To give each device its own account, add users to the password file (see Managing the Services).

Server Components

Component Version or setting Where
Mosquitto 2.1.4, service Mosquitto (NT SERVICE\Mosquitto) through WinSW 2.12.0 C:\Program Files\mosquitto (program), C:\ProgramData\Mosquitto (configuration, data, logs)
MQTT listeners 8883 MQTT over TLS on every address; 1883 plain MQTT on 127.0.0.1 only; anonymous refused C:\ProgramData\Mosquitto\mosquitto.conf
Node-RED 5.0.10, service NodeRED (NT SERVICE\NodeRED) through WinSW 2.12.0 C:\Program Files\Node-RED (program), C:\ProgramData\Node-RED (user directory)
Node.js 24.23.0 LTS C:\Program Files\nodejs
Editor and admin API HTTPS on TCP 443, user admin; HTTP In nodes under /api; TCP 80 redirects to HTTPS C:\ProgramData\Node-RED\settings.js
TLS certificate This VM's own, self signed, RSA 2048, valid 10 years; one certificate for Node-RED and Mosquitto C:\ProgramData\Node-RED\ssl, C:\ProgramData\Mosquitto\ssl
Firewall TCP 443, 80 and 8883 Windows Firewall rules in the group Mosquitto and Node-RED
Windows Server 2025 Datacenter, Desktop Experience, build 26100

Filesystem Layout

Get-ChildItem C:\ProgramData\Node-RED -Name
Get-ChildItem C:\ProgramData\Mosquitto -Name
lib
logs
node_modules
ssl
.config.nodes.json
.config.runtime.json
.config.users.json
.config.users.json.backup
.sessions.json
flows.json
flows_cred.json
mqtt-inbox.log
package.json
settings.js

data
logs
ssl
mosquitto.conf
passwd
Path What it holds
C:\ProgramData\Node-RED\settings.js Node-RED's settings: the HTTPS certificate, the admin user's password hash, this VM's credential secret
C:\ProgramData\Node-RED\flows.json, flows_cred.json Your flows, and their credentials encrypted with this VM's credential secret
C:\ProgramData\Node-RED\node_modules\ Nodes you install from Manage palette
C:\ProgramData\Node-RED\logs\ Node-RED's service log
C:\ProgramData\Mosquitto\mosquitto.conf The broker's configuration (shown below)
C:\ProgramData\Mosquitto\passwd MQTT accounts, with hashed passwords
C:\ProgramData\Mosquitto\data\ Retained messages and persistent sessions
C:\ProgramData\Mosquitto\logs\ The broker's log
C:\ProgramData\mosquitto-node-red-windows-server-credentials.txt This VM's passwords. SYSTEM and Administrators only
C:\ProgramData\mosquitto-node-red-windows-server-firstboot.log What first boot did (never a password or key)

Each data folder can be read only by SYSTEM, the Administrators group and its own service's account. The broker's configuration:

# Every client signs in: anonymous clients are refused on every listener. Accounts are in the password file
# (hashed); add one with: mosquitto_passwd -b C:\ProgramData\Mosquitto\passwd <user> <password>, then restart.
per_listener_settings false
allow_anonymous false
password_file C:/ProgramData/Mosquitto/passwd

# Retained messages and persistent sessions survive a restart.
persistence true
persistence_location C:/ProgramData/Mosquitto/data/
autosave_interval 300

# The service's output (C:\ProgramData\Mosquitto\logs).
log_dest stdout
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp_format %Y-%m-%dT%H:%M:%S

# MQTT for Node-RED and other programs on this server only (loopback).
listener 1883 127.0.0.1

# MQTT over TLS for clients anywhere else, with this server's own certificate (made at first boot).
listener 8883
certfile C:/ProgramData/Mosquitto/ssl/mosquitto-cert.pem
keyfile C:/ProgramData/Mosquitto/ssl/mosquitto-key.pem

Managing the Services

From an elevated PowerShell window:

# restart the broker or Node-RED
Restart-Service Mosquitto
Restart-Service NodeRED

# add an MQTT account (you are asked for its password), then restart the broker
& 'C:\Program Files\mosquitto\mosquitto_passwd.exe' C:\ProgramData\Mosquitto\passwd <user>
Restart-Service Mosquitto

# the services' logs
Get-ChildItem C:\ProgramData\Mosquitto\logs, C:\ProgramData\Node-RED\logs

To change the admin password of the Node-RED editor, make a bcrypt hash of the new password with node-red admin hash-pw and put it in the password field of adminAuth in C:\ProgramData\Node-RED\settings.js, then restart Node-RED:

& 'C:\Program Files\nodejs\node.exe' 'C:\Program Files\Node-RED\node_modules\node-red-admin\node-red-admin.js' hash-pw
notepad C:\ProgramData\Node-RED\settings.js
Restart-Service NodeRED

To change the cloudimg MQTT password, run mosquitto_passwd for cloudimg as above, restart Mosquitto, then open Local Mosquitto in the Node-RED editor (Step 8), enter the new password on its Security tab, and select Deploy. The credentials file keeps the passwords first boot made.

On Startup

At the first start of your VM, the scheduled task Mosquitto and Node-RED first boot (SYSTEM) runs once:

  1. It keeps both services stopped and set to Manual, and waits until Azure has finished setting up the VM
  2. It reads the VM's public and private IP addresses and makes this VM's TLS certificate for them, its computer name and localhost, with a copy in each service's own locked data folder
  3. It creates the MQTT account cloudimg with this VM's own password, hashed by mosquitto_passwd, and writes the broker's configuration
  4. It hashes this VM's own admin password for Node-RED, writes settings.js with this VM's own credential secret, and stores the demo flow's broker password encrypted with it
  5. It writes C:\ProgramData\mosquitto-node-red-windows-server-credentials.txt, readable by SYSTEM and administrators only
  6. It sets both services to start automatically and starts them, waits until Node-RED answers on 443 and Mosquitto listens on 8883 and 1883, then writes mosquitto-node-red-windows-server-firstboot.done

If anything fails, both services stay stopped and Manual and the task runs again at the next start; once this VM's passwords and certificate exist they are never made again, so a password you already use keeps working. Every start after that, Mosquitto and Node-RED start with Windows.

Security Recommendations

  • Keep the editor to your own networks. Anyone who signs in to Node-RED can run code on this server through its function nodes and palette: open 443 and 80 only to the networks you manage it from, and prefer a VPN or private network.
  • Open 8883 only to your devices' networks, and give each device or program its own MQTT account rather than sharing cloudimg.
  • Leave 1883 on loopback. Plain MQTT sends passwords and messages unencrypted; keep it for programs on this server.
  • Install palette nodes you trust. Nodes from the library run with the NodeRED service's rights inside its data folder.
  • Do not give this VM a managed identity unless you need one. Any program on the VM, including a Node-RED flow, can reach the Azure Instance Metadata Service (169.254.169.254) and, through it, a managed identity's tokens.

Use a trusted certificate

First boot's certificate is self signed. To use a certificate for your own DNS name, put its PEM files in each service's ssl folder and point the services at them: in C:\ProgramData\Node-RED\settings.js change the https key and cert paths, and in C:\ProgramData\Mosquitto\mosquitto.conf change certfile and keyfile under listener 8883. Then restart both services and connect by that name:

Restart-Service Mosquitto
Restart-Service NodeRED

Clients that trust a public certificate authority then need no --cafile.

Maintenance

  • Windows updates: Windows Update is on, as Microsoft ships it. Restarting the VM restarts Mosquitto and Node-RED automatically.
  • Mosquitto updates: stop the Mosquitto service and run the newer Windows installer from mosquitto.org into C:\Program Files\mosquitto. Before starting it again, check that the service still runs this image's service wrapper as its own account: Get-CimInstance Win32_Service -Filter "Name='Mosquitto'" | Format-List PathName, StartName shows C:\Program Files\mosquitto\Mosquitto-service.exe and NT SERVICE\Mosquitto. Then start Mosquitto. The configuration, accounts and data in C:\ProgramData\Mosquitto are untouched.
  • Node-RED updates: follow Node-RED's upgrade notes: stop NodeRED, update the node-red package in C:\Program Files\Node-RED with npm, then start it again. Your flows and nodes in C:\ProgramData\Node-RED are kept.
  • Back up your data: back up C:\ProgramData\Node-RED (flows, their credentials and settings.js, which holds the credential secret: keep them together) and C:\ProgramData\Mosquitto. Azure Backup for the whole VM is a simple alternative.
  • Logs: the services' logs are in C:\ProgramData\Mosquitto\logs and C:\ProgramData\Node-RED\logs, and first boot's in C:\ProgramData\mosquitto-node-red-windows-server-firstboot.log (it never contains a password).

Troubleshooting

The editor does not answer, or the .done file is missing

First boot may still be running: give it a few minutes and check again. Its log shows how far it got:

Get-Content C:\ProgramData\mosquitto-node-red-windows-server-firstboot.log

"Login failed" in the editor

The user name is admin (lower case). Copy the password from node-red.password= in the credentials file (Step 5). If you changed it in settings.js, the file still holds the first one.

An MQTT client is refused, or cannot connect

not authorised means the user name or password is wrong, or the client sent none. A TLS or certificate error means the client does not trust this VM's certificate: give it mosquitto-cert.pem as its CA file (Step 11) and connect by the VM's IP address. A timeout means port 8883 is not open in the network security group. The broker's log names each connection and why it was refused:

Get-ChildItem C:\ProgramData\Mosquitto\logs | Sort-Object LastWriteTime | Select-Object -Last 1 | Get-Content -Tail 20

The MQTT nodes show "disconnected"

Check that the Mosquitto service is running (Step 4). If you changed the cloudimg password, enter the new one in Local Mosquitto and deploy (see Managing the Services).

Forgot the Windows password

Use Reset password on the VM's page in the Azure portal.

Support

cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours. Contact support@cloudimg.co.uk.

Eclipse Mosquitto and Eclipse are trademarks of the Eclipse Foundation. Node-RED is a trademark of the OpenJS Foundation. cloudimg is not affiliated with or endorsed by the Eclipse Foundation, the OpenJS Foundation or the Mosquitto and Node-RED projects; the software is provided under its open source licences (EPL-2.0 or EDL-1.0, and Apache-2.0).