Getting started

Kees Schollaart edited this page Apr 14, 2018 · 7 revisions


  • Create an Azure Function using Visual Studio or using Visual Studio Code
  • Make sure your Microsoft.NET.Sdk.Functions package version is 1.0.13 or higher
  • For local development: Make sure your Functions SDK is up to date (make sure you have V2 installed) [howto-1 & howto-2]
  • Install the CaseOnline.Azure.WebJobs.Extensions.Mqtt NuGet package in you Functions Project
  • Add a connectionstring to your 'local.settings.json' during development time or in Azure to your Application Settings
  • When deploying/running on Azure, make sure the application-setting FUNCTIONS_EXTENSION_VERSION to beta.

The Connectionstring

The default name/key for the connectionstring is MqttConnection.

The available parts are:

  • Server (just the dns/hostname)
  • Username (string, optional)
  • Password (string, optional)
  • Port (integer, optional, defaults to 1883 or 8883 when tls=true)
  • Tls (boolean, optional, defaults to false)
  • ClientId (string, optional, defaults to a random Guid)

Example Connectionstring

This is an example of the local.settings.json file

	"Values": {
		"MqttConnection": "Server=<<>>;Username=<<username>>;Password=<<password>>"

Multiple connections

Is is possible to work with multiple connections but it is also possible to reuse connections for multiple triggers or outputs. When adding a second connectionstring to your settings make sure to point to this connectionstring using the ConnectionString property on the Mqtt(Trigger) attribute.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.