• Stars
    star
    435
  • Rank 96,288 (Top 2 %)
  • Language
    C#
  • License
    Other
  • Created over 7 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A C# SDK for connecting devices to Microsoft Azure IoT services

Microsoft Azure IoT SDK for .NET

Contents

This repository contains the following:

  • Microsoft Azure IoT Hub device SDK for C# to connect client devices to Azure IoT Hub with .NET.
  • Microsoft Azure IoT Hub service SDK for C# to manage your IoT Hub service instance from a back-end .NET application.
  • Microsoft Azure Provisioning device SDK for C# to provision devices to Azure IoT Hub with .NET.
  • Microsoft Azure Provisioning service SDK for C# to manage your Provisioning service instance from a back-end .NET application.

Critical Upcoming Change Notice

All Azure IoT SDK users are advised to be aware of upcoming TLS certificate changes for Azure IoT Hub and Device Provisioning Service that will impact the SDK's ability to connect to these services. In October 2022, both services will migrate from the current Baltimore CyberTrust CA Root to the DigiCert Global G2 CA root. There will be a transition period beforehand where your IoT devices must have both the Baltimore and Digicert public certificates installed in their certificate store in order to prevent connectivity issues.

Devices with only the Baltimore public certificate installed will lose the ability to connect to Azure IoT hub and Device Provisioning Service in October 2022.

To prepare for this change, make sure your device's certificate store has both of these public certificates installed.

For a more in depth explanation as to why the IoT services are doing this, please see this article.

Recommended NuGet packages

Package Name Release Version
Microsoft.Azure.Devices.Client NuGet
Microsoft.Azure.Devices NuGet
Microsoft.Azure.Devices.Shared NuGet
Microsoft.Azure.Devices.Provisioning.Client NuGet
Microsoft.Azure.Devices.Provisioning.Transport.Amqp NuGet
Microsoft.Azure.Devices.Provisioning.Transport.Http NuGet
Microsoft.Azure.Devices.Provisioning.Transport.Mqtt NuGet
Microsoft.Azure.Devices.Provisioning.Service NuGet
Microsoft.Azure.Devices.Provisioning.Security.Tpm NuGet

Note:

  1. In addition to stable builds we also release pre-release builds that contain preview features. You can find details about the preview features released by looking at the release notes. It is not recommended to take dependency on preview NuGets for production applications as breaking changes can be introduced in preview packages.

  2. Device streaming feature is not being included in our newer preview releases as there is no active development going on in the service. For more details on the feature, see here.

    This feature has not been included in any preview release after 2020-10-14. However, the feature is still available under previews/deviceStreaming branch.

    The latest preview NuGet versions that contain the device streaming feature are:
    Microsoft.Azure.Devices.Client - 1.32.0-preview-001
    Microsoft.Azure.Devices - 1.28.0-preview-001

  3. Stable and preview NuGet versions are not interdependent; eg. for NuGet packages versioned 1.25.0 (stable release) and 1.25.0-preview-001 (preview release), there is no guarantee that v1.25.0 contains the feature(s) previewed in v1.25.0-preview-001. For a list of updates shipped with each NuGet package, please refer to the release notes.

The API reference documentation for .NET SDK is here.

To find SDKs in other languages for Azure IoT, please refer to the azure-iot-sdks repository. For IoT Hub Management SDK in .NET, please visit azure-sdk-for-net repository.

Developing applications for Azure IoT

Visit Azure IoT Dev Center to learn more about developing applications for Azure IoT.

Samples

All of our samples are located in this repository. The samples live alongside the source for each client library.

Samples for each of these categories are further separated into three sub-categories (from simplest to complex):

  1. Getting Started
  2. How To Guides
  3. Solutions

If you are looking for a good device sample to get started with, please see the device reconnection sample. It shows how to connect a device, handle disconnect events, cases to handle when making calls, and when to re-initialize the DeviceClient.

Contribute to the Azure IoT C# SDK

If you would like to build or change the SDK source code, please follow the devguide.

OS platforms and hardware compatibility

For an official list of all the operating systems and .NET platforms that we support, please see this document.

Note that you can configure your TLS protocol version and ciphers by following this document.

Key features and roadmap

IoT Hub Device SDK

✔️ feature available ✖️ feature planned but not supported ➖ no support planned

Features mqtt mqtt-ws amqp amqp-ws https Description
Authentication ✔️ ✔️* ✔️ ✔️* ✔️* Connect your device to IoT Hub securely with supported authentication methods, including private key, shared access signature (SAS) token, X.509 self-signed, and X.509 certificate authority (CA) signed.
*IoT Hub only supports X.509 CA signed over AMQP and MQTT at the moment. X.509 CA authentication over web socket and HTTPS are not supported. When authenticating a device using shared access key (SAK) over MQTT, new connection will be setup as part of the SAS token refresh process; device communication will be briefly closed during refresh (for details, see device connection and messaging reliability documentation). X.509 certificate-based authentication process does not have the same refresh disruption. Also, X.509 certificate-based authentication is more secure than share access key authentication.
Send device-to-cloud message ✔️* ✔️* ✔️ ✔️ ✔️ Send device-to-cloud messages (max 256KB) to IoT Hub with the option to add application properties and system properties, and batch send.
*IoT Hub only supports batch send over AMQP and HTTPS at the moment. The MQTT implementation loops over the batch and sends each message individually.
Receive cloud-to-device messages ✔️* ✔️* ✔️ ✔️ ✔️ Receive cloud-to-device messages and read associated application and system properties from IoT Hub, with the option to complete/reject/abandon C2D messages.
*IoT Hub does not support the option to reject/abandon C2D messages over MQTT at the moment.
Device Twins ✔️* ✔️* ✔️* ✔️* IoT Hub persists a device twin for each device that you connect to IoT Hub. The device can perform operations like get twin tags, subscribe to desired properties.
*Send reported properties version and desired properties version are in progress.
Direct Methods ✔️ ✔️ ✔️ ✔️ IoT Hub gives you the ability to invoke direct methods on devices from the cloud. The SDK supports handler for method specific and generic operation.
Upload file to Blob ✔️ The user can use the device client to retrieve a SAS URI from IoT Hub (to use for file uploads), upload to Azure Storage blob using IoT Hub provided credentials (using a supported client library), and then use the device client to notify IoT Hub that a file upload has completed. File upload requires HTTPS connection, but can be initiated from client using any protocol for other operations.
Connection Status and Error reporting ✔️ ✔️ ✔️ ✔️ ✔️ Error reporting for IoT Hub supported error code.
Retry policies ✔️ ✔️ ✔️ ✔️ ✔️ Retry policy for unsuccessful device-to-cloud messages have three options: no try, exponential backoff with jitter (default) and custom.
Devices multiplexing over single connection ✔️ ✔️ ✔️
Connection Pooling - Specifying number of connections ✔️ ✔️ ✔️
IoT Plug and Play ✔️ ✔️ ✔️* ✔️* IoT Plug and Play lets you build smart devices that advertise their capabilities to Azure IoT applications. IoT Plug and Play devices don't require manual configuration when a customer connects them to IoT Plug and Play-enabled applications. You can read more here.
*Note: AMQP support is mainly targeted for Edge-based scenarios.

IoT Hub Service SDK

✔️ feature available ✖️ feature planned but not supported ➖ no support planned

Features Support Transport protocol used underneath Client to use Description
Identity registry (CRUD) ✔️ HTTP RegistryManager Use your backend app to perform CRUD operation for individual device or in bulk.
Query ✔️ HTTP RegistryManager Use your backend app to query for information on device twins, module twins, jobs and message routing.
Import/Export jobs ✔️ HTTP RegistryManager Use your backend app to import or export device identities in bulk.
Scheduled jobs ✔️ HTTP JobsClient Use your backend app to schedule jobs to update desired properties, update tags and invoke direct methods.
Cloud-to-device messaging ✔️ AMQP ServiceClient Use your backend app to send cloud-to-device messages in AMQP and AMQP-WS, and set up notifications for cloud-to-device message delivery.
Direct Methods operations ✔️ HTTP ServiceClient Use your backend app to invoke direct method on device.
File Upload Notifications ✔️ AMQP ServiceClient Use your backend app to receive file upload notifications.
IoT Hub Statistics ✔️ HTTP ServiceClient Use your backend app to get IoT hub identity registry statistics such as total device count for device statistics, and connected device count for service statistics.
Digital Twin Operations ✔️ HTTP DigitalTwinClient or RegistryManager Use your backend app to perform operations on plug and play devices. The operations include get twins, update twins and invoke commands. DigitalTwinClient is the preferred client to use.

Provisioning Device SDK

This repository contains provisioning device client SDK for the Device Provisioning Service.

✔️ feature available ✖️ feature planned but not supported ➖ no support planned

Features mqtt mqtt-ws amqp amqp-ws https Description
TPM Individual Enrollment ✔️ ✔️ ✔️ This SDK supports connecting your device to the Device Provisioning Service via individual enrollment using Trusted Platform Module. Please review the samples folder and this quickstart on how to create a device client. TPM over MQTT is currently not supported by the Device Provisioning Service.
X.509 Individual Enrollment ✔️ ✔️* ✔️ ✔️* ✔️ This SDK supports connecting your device to the Device Provisioning Service via individual enrollment using X.509 root certificate. Please review the samples and this quickstart folder on how to create a device client.
X.509 Enrollment Group ✔️ ✔️* ✔️ ✔️* ✔️ This SDK supports connecting your device to the Device Provisioning Service via individual enrollment using X.509 leaf certificate. Please review the samples folder on how to create a device client.

Note * WebSocket support for MQTT/AMQP is limited to .NET Framework 4.x.

Provisioniong Service SDK

This repository contains provisioning service client SDK for the Device Provisioning Service to programmatically enroll devices.

Feature Support Description
CRUD Operation with TPM Individual Enrollment ✔️ Programmatically manage device enrollment using TPM with the service SDK. Please visit the samples folder to learn more about this feature.
Bulk CRUD Operation with TPM Individual Enrollment ✔️ Programmatically bulk manage device enrollment using TPM with the service SDK. Please visit the samples folder to learn more about this feature.
CRUD Operation with X.509 Individual Enrollment ✔️ Programmatically manage device enrollment using X.509 individual enrollment with the service SDK. Please visit the samples folder to learn more about this feature.
CRUD Operation with X.509 Group Enrollment ✔️ Programmatically manage device enrollment using X.509 group enrollment with the service SDK. Please visit the samples folder to learn more about this feature.
Query enrollments ✔️ Programmatically query registration states with the service SDK. Please visit the samples folder to learn more about this feature.

Read more

Device Explorer is no longer supported. A replacement tool can be found here.

Certificates - Important to know

The Azure IoT Hub certificates presented during TLS negotiation shall be always validated using the appropriate root CA certificate(s).

Always prefer using the local system's Trusted Root Certificate Authority store instead of hardcoding the certificates.

A couple of examples:

Additional Information

For additional guidance and important information about certificates, please refer to this blog post from the security team.

Support

The Azure IoT Hub Device Client supported releases is outlined in the following table.

Refer to the Azure IoT Device SDK lifecycle and support for details on the different supported stages.

Release Category End-of-life
NuGet Active -

Need help?

  • Have a feature request for SDKs? Please post it on User Voice to help us prioritize.
  • Have a technical question? Ask on Stack Overflow with tag “azure-iot-hub”.
  • Need Support? Every customer with an active Azure subscription has access to support with guaranteed response time. Consider submitting a ticket and get assistance from Microsoft support team.
  • Found a bug? Please help us fix it by thoroughly documenting it and filing an issue on GitHub (C, Java, .NET, Node.js, Python).

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Microsoft collects performance and usage information which may be used to provide and improve Microsoft products and services and enhance your experience. To learn more, review the privacy statement.

More Repositories

1

azure-quickstart-templates

Azure Quickstart Templates
Bicep
13,655
star
2

azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
4,953
star
3

autorest

OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python
TypeScript
4,332
star
4

Azure-Sentinel

Cloud-native SIEM for intelligent security analytics for your entire enterprise.
Jupyter Notebook
4,270
star
5

DotNetty

DotNetty project – a port of netty, event-driven asynchronous network application framework
C#
4,011
star
6

azure-powershell

Microsoft Azure PowerShell
4,010
star
7

MachineLearningNotebooks

Python notebooks with ML and deep learning examples with Azure Machine Learning Python SDK | Microsoft
Jupyter Notebook
3,956
star
8

draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
Go
3,922
star
9

azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
Python
3,842
star
10

azure-cli

Azure Command-Line Interface
Python
3,813
star
11

bicep

Bicep is a declarative language for describing and deploying Azure resources
Bicep
3,114
star
12

azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
2,426
star
13

azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
Java
2,157
star
14

azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
TypeScript
1,918
star
15

AKS

Azure Kubernetes Service
1,884
star
16

azure-functions-host

The host/runtime that powers Azure Functions
C#
1,871
star
17

golua

A Lua 5.3 engine implemented in Go
Go
1,850
star
18

Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
TypeScript
1,695
star
19

Enterprise-Scale

The Azure Landing Zones (Enterprise-Scale) architecture provides prescriptive guidance coupled with Azure best practices, and it follows design principles across the critical design areas for organizations to define their Azure architecture
PowerShell
1,603
star
20

Microsoft-Defender-for-Cloud

Welcome to the Microsoft Defender for Cloud community repository
PowerShell
1,592
star
21

azureml-examples

Official community-driven Azure Machine Learning examples, tested with GitHub Actions.
Jupyter Notebook
1,555
star
22

Stormspotter

Azure Red Team tool for graphing Azure and Azure Active Directory objects
Python
1,432
star
23

durabletask

Durable Task Framework allows users to write long running persistent workflows in C# using the async/await capabilities.
C#
1,423
star
24

iotedge

The IoT Edge OSS project
C#
1,421
star
25

azure-policy

Repository for Azure Resource Policy built-in definitions and samples
Open Policy Agent
1,410
star
26

azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
Go
1,409
star
27

aztfexport

A tool to bring existing Azure resources under Terraform's management
Go
1,335
star
28

azure-sdk-for-node

Azure SDK for Node.js - Documentation
JavaScript
1,187
star
29

azure-functions-core-tools

Command line tools for Azure Functions
C#
1,128
star
30

review-checklists

This repo contains code and examples to operationalize Azure review checklists.
Python
1,114
star
31

Azure-Functions

PowerShell
1,094
star
32

acs-engine

WE HAVE MOVED: Please join us at Azure/aks-engine!
Go
1,034
star
33

aks-engine

AKS Engine: legacy tool for Kubernetes on Azure (see status)
Go
1,027
star
34

coco-framework

The Confidential Consortium Blockchain Framework is an open-source system that enables high-scale, confidential blockchain networks that meet all key enterprise requirements—providing a means to accelerate production enterprise adoption of blockchain technology.
834
star
35

azure-iot-sdks

SDKs for a variety of languages and platforms that help connect devices to Microsoft Azure IoT services
821
star
36

azure-sql-database-samples

Azure SQL Database Samples and Reference Implementation Repository
Python
781
star
37

terraform-azurerm-caf-enterprise-scale

Azure landing zones Terraform module
HCL
746
star
38

caf-terraform-landingzones

Azure Terraform SRE framework
HCL
741
star
39

Azure-Network-Security

Resources for improving Customer Experience with Azure Network Security
Python
732
star
40

azure-webjobs-sdk

Azure WebJobs SDK
C#
712
star
41

ResourceModules

This repository includes a CI platform for and collection of mature and curated Bicep modules. The platform supports both ARM and Bicep and can be leveraged using GitHub actions as well as Azure DevOps pipelines.
Bicep
710
star
42

AzurePublicDataset

Microsoft Azure Traces
Jupyter Notebook
700
star
43

azure-functions-durable-extension

Durable Task Framework extension for Azure Functions
C#
698
star
44

ALZ-Bicep

This repository contains the Azure Landing Zones (ALZ) Bicep modules that help deliver and deploy the Azure Landing Zone conceptual architecture in a modular approach. https://aka.ms/alz/docs
Bicep
694
star
45

data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
C#
689
star
46

azure-api-management-devops-resource-kit

Azure API Management DevOps Resource Kit
C#
681
star
47

CCOInsights

Welcome to the Continuous Cloud Optimization Power BI Dashboard GitHub Project. In this repository you will find all the guidance and files needed to deploy the Dashboard in your environment to take benefit of a single pane of glass to get insights about your Azure resources and services.
Mathematica
668
star
48

SimuLand

Understand adversary tradecraft and improve detection strategies
PowerShell
664
star
49

azure-service-operator

Azure Service Operator allows you to create Azure resources using kubectl
Go
664
star
50

GPT-RAG

Sharing the learning along the way we been gathering to enable Azure OpenAI at enterprise scale in a secure manner. GPT-RAG core is a Retrieval-Augmented Generation pattern running in Azure, using Azure Cognitive Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
Bicep
664
star
51

application-gateway-kubernetes-ingress

This is an ingress controller that can be run on Azure Kubernetes Service (AKS) to allow an Azure Application Gateway to act as the ingress for an AKS cluster.
Go
658
star
52

azure-xplat-cli

For ARM-based service please go to CLI 2.0.
JavaScript
651
star
53

DeepLearningForTimeSeriesForecasting

A tutorial demonstrating how to implement deep learning models for time series forecasting
Jupyter Notebook
644
star
54

azure-cosmos-dotnet-v3

.NET SDK for Azure Cosmos DB for the core SQL API
C#
637
star
55

azure-sdk-for-rust

This repository is for active development of the *unofficial* Azure SDK for Rust. This repository is *not* supported by the Azure SDK team.
Rust
636
star
56

azure-search-vector-samples

A repository of code samples for Vector search capabilities in Azure AI Search.
Jupyter Notebook
635
star
57

node-sqlserver

C++
625
star
58

azure-storage-fuse

A virtual file system adapter for Azure Blob storage
Go
613
star
59

terraform

Source code for the Azure Marketplace Terraform development VM package.
HCL
605
star
60

azure-devops-cli-extension

Azure DevOps Extension for Azure CLI
Python
603
star
61

counterfit

a CLI that provides a generic automation layer for assessing the security of ML models
Python
599
star
62

azure-resource-manager-schemas

Schemas used to author and validate Resource Manager Templates. These schemas power the intellisense and syntax completion in our ARM Tools VSCode extension, as well as the Export Template API
TypeScript
598
star
63

azure-storage-azcopy

The new Azure Storage data transfer utility - AzCopy v10
Go
582
star
64

azure-cosmos-dotnet-v2

Contains samples and utilities relating to the Azure Cosmos DB .NET SDK
577
star
65

azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
C
572
star
66

azure-service-bus

☁️ Azure Service Bus service issue tracking and samples
571
star
67

aad-pod-identity

[DEPRECATED] Assign Azure Active Directory Identities to Kubernetes applications.
Go
568
star
68

Community-Policy

This repo is for Microsoft Azure customers and Microsoft teams to collaborate in making custom policies.
Open Policy Agent
555
star
69

AzureStack-QuickStart-Templates

Quick start ARM templates that deploy on Microsoft Azure Stack
PowerShell
540
star
70

iot-edge-v1

Azure IoT Edge
C
525
star
71

WALinuxAgent

Microsoft Azure Linux Guest Agent
Python
520
star
72

Azure-Sentinel-Notebooks

Interactive Azure Sentinel Notebooks provides security insights and actions to investigate anomalies and hunt for malicious behaviors.
Jupyter Notebook
518
star
73

Industrial-IoT

Azure Industrial IoT Platform
C#
510
star
74

Mission-Critical

This repository provides a design methodology and approach to building highly-reliable applications on Microsoft Azure for mission-critical workloads.
510
star
75

static-web-apps-cli

Azure Static Web Apps CLI ✨
TypeScript
509
star
76

azure-docs-powershell-samples

Azure Powershell code samples, often used in docs.microsoft.com/Azure developer documentation
PowerShell
499
star
77

azure-storage-node

Microsoft Azure Storage SDK for Node.js
JavaScript
495
star
78

Azure-TDSP-ProjectTemplate

TDSP: Data science project template repository with standardized directory structure and document templates to support efficient project execution and collaboration.
R
483
star
79

draft

A day 0 tool for getting your app on k8s fast
Go
473
star
80

api-management-developer-portal

Developer portal provided by the Azure API Management service.
TypeScript
472
star
81

azure-mobile-services

Mobile Services is deprecated - Use Mobile Apps instead
HTML
472
star
82

MS-AMP

Microsoft Automatic Mixed Precision Library
Python
456
star
83

azure-sdk

This is the Azure SDK parent repository and mostly contains documentation around guidelines and policies as well as the releases for the various languages supported by the Azure SDK.
PowerShell
454
star
84

mlops-v2

Azure MLOps (v2) solution accelerators. Enterprise ready templates to deploy your machine learning models on the Azure Platform.
Shell
451
star
85

azure-devtestlab

Azure DevTestLab artifacts, scripts and samples
PowerShell
448
star
86

azure-devops-utils

Azure DevOps Utilities
Shell
447
star
87

kubelogin

A Kubernetes credential (exec) plugin implementing azure authentication
Go
446
star
88

app-service-announcements

Subscribe to this repo to be notified about major changes in App Service
446
star
89

azure-storage-net

Microsoft Azure Storage Libraries for .NET
C#
445
star
90

Azure-DataFactory

C#
444
star
91

azqr

Azure Quick Review
Go
443
star
92

azure-openai-samples

Azure OpenAI Samples is a collection of code samples illustrating how to use Azure Open AI in creating AI solution for various use cases across industries. This repository is mained by a community of volunters. We welcomed your contributions.
Jupyter Notebook
443
star
93

RDS-Templates

ARM Templates for Remote Desktop Services deployments
PowerShell
427
star
94

AzureDatabricksBestPractices

Version 1 of Technical Best Practices of Azure Databricks based on real world Customer and Technical SME inputs
427
star
95

actions-workflow-samples

Help developers to easily get started with GitHub Action workflows to deploy to Azure
Pug
426
star
96

arm-ttk

Azure Resource Manager Template Toolkit
PowerShell
423
star
97

actions

Author and use Azure Actions to automate your GitHub workflows
HTML
422
star
98

opendigitaltwins-dtdl

IoT Plug And Play
417
star
99

container-service-for-azure-china

Container Service for Azure China
Shell
415
star
100

azure-iot-sdk-python

A Python SDK for connecting devices to Microsoft Azure IoT services
Python
415
star