Saltar al contenido principal

 Subscribe

On the Azure IoT team, a key part of our mission is to make it as easy as possible for developers to connect devices to IoT Hub. We’ve been continually improving the developer experience since we first launched the public preview in September 2015, but there’s still room to do more.

Say hello to the VS Connected Service for IoT Hub

Today, we’re releasing a Visual Studio extension that takes away the hassle of dealing with the connection strings and other details when connecting your application to IoT Hub. With the VS Connected Service for Azure IoT Hub, you can connect your application to IoT Hub in seconds (literally!), without ever leaving Visual Studio.

You can install the extension from the Visual Studio Gallery. Alternatively, you can find it from the Visual Studio by navigating to Tools, Extensions and Updates, Online.

Type “Azure IoT” in the search box on the right. Download the extension and restart the Visual Studio if prompted to do so. To use the extension, just follow these instructions.

Introducing the Visual Studio Connected Service for IoT Hub 

The extension generates some “boiler plate” code you can invoke from your application. That code would be different for each application type. For C#, you will see a new file AzureIoTHub.cs added to your project.

The class AzureIoTHub defined in this file has two methods: SendDeviceToCloudMessageAsync and ReceiveCloudToDeviceMessageAsync. These methods contain everything necessary to send messages to and receive from Azure, and you can call them directly from elsewhere in your application. Of course, you should treat the code in these methods merely as a jumping-off place for you to write your own logic.

A note on the connection details

For your convenience, the Connected Service for Azure IoT Hub inserted the deviceConnectionString variable containing the shared access key required to connect to your instance of IoT Hub on behalf of the chosen device. Keep in mind, anyone who comes into the possession of this information will be able to send and receive messages on behalf of that device. Therefore, it is recommended you remove this string from the source code before committing your code into a source control. Consider storing it in a configuration file, an environment variable, or other solutions.

Feedback? We’re listening!

We believe this extension will reduce the hassle of connecting your applications to Azure IoT. That said, we can do so much more! For example, it would great if the extension allowed you to create instances of Azure IoT Hubs, avoiding the need to do this in the Azure portal. Have other ideas? Head over to GitHub and submit a proposed enhancement, or report a bug.

  • Explore

     

    Let us know what you think of Azure and what you would like to see in the future.

     

    Provide feedback

  • Build your cloud computing and Azure skills with free courses by Microsoft Learn.

     

    Explore Azure learning


Join the conversation