Quickstart: Build the Blink application

This quickstart shows how to enable application development on an Azure Sphere device and how to build and debug a high-level application. It uses the Blink sample, which is part of the Azure Sphere SDK. The Blink sample blinks an LED, so that you can verify that the Azure Sphere device and tools are installed and set up correctly.


The steps in this quickstart assume that:

  • Your Azure Sphere device is connected to your PC
  • You have completed all the steps to install Azure Sphere


These instructions assume that you are using hardware that follows the MT3620 reference board design (RBD), such as the Seeed MT3620 Development Kit. If you are using different Azure Sphere hardware, consult the manufacturer's documentation to find out whether the GPIO is exposed and how to access it. You might need to update the sample code and the "Gpio" field of the app_manifest.json file to use a different GPIO.

Prepare your device for development and debugging

Before you can build a sample application on your Azure Sphere device or develop new applications for it, you must enable development and debugging. By default, Azure Sphere devices are "locked"; that is, they do not allow applications under development to be loaded from a PC, and they do not allow debugging of applications. Preparing the device for debugging removes this restriction.

The azsphere device prep-debug command configures the device to accept applications from a PC for debugging and loads the debugging server onto the device. It also assigns the device to a device group that does not allow over-the-air (OTA) application updates. During application development and debugging, you should leave the device in this group so that OTA application updates do not overwrite the application under development.

To prep your device

  1. Make sure that your Azure Sphere device is connected to your PC, and your PC is connected to the internet.

  2. In an Azure Sphere Developer Command Prompt window, type the following command:

    azsphere device prep-debug

    You should see output similar to the following:

    Getting device capability configuration for application development.
    Downloading device capability configuration for device ID '<device ID>'.
    Successfully downloaded device capability configuration.
    Successfully wrote device capability configuration file 'C:\Users\user\AppData\Local\Temp\tmpD732.tmp'.
    Setting device group ID 'a6df7013-c7c2-4764-8424-00cbacb431e5' for device with ID '<device ID>'.
    Successfully disabled over-the-air updates.
    Enabling application development capability on attached device.
    Applying device capability configuration to device.
    Successfully applied device capability configuration to device.
    The device is rebooting.
    Installing debugging server to device.
    Deploying 'C:\Program Files (x86)\Microsoft Azure Sphere SDK\DebugTools\gdbserver.imagepackage' to the attached device.
    Image package 'C:\Program Files (x86)\Microsoft Azure Sphere SDK\DebugTools\gdbserver.imagepackage' has been deployed to the attached device.
    Application development capability enabled.
    Successfully set up device '<device ID>' for application development, and disabled over-the-air updates.
    Command completed successfully in 00:00:38.3299276.

The device remains enabled for debugging and closed to OTA application updates until you explicitly change it. To disable debugging and allow application updates, use the azsphere device prep-field command.

  1. If you are new to Visual Studio, consider the Quickstart or Guided Tour to learn about navigating and using it.

  2. In Visual Studio, create a new project based on the Azure Sphere Blink template. Enter a name and location for the project and select OK. The project opens with main.c in the editor.

  3. In Visual Studio, select View>Output to display the Output window.

  4. Ensure that your device is connected to your PC by USB. Then select Remote GDB Debugger from the menu bar or press F5.

    Remote GDB Debugger button

  5. If you are prompted to build the project, select Yes. Visual Studio compiles the application, creates an image package, sideloads it onto the board, and starts it in debug mode. Sideloading means that the application is delivered directly from the PC over a wired connection, rather than delivered over the air (OTA).


    Note the path in the Build output, which indicates the location of the output image package on your PC. You'll use the image package later in the Deployment Quickstart.

  6. By default, the Output window shows output from Device Output. To see messages from the debugger, select Debug from the Show output from: dropdown menu. You can also inspect the program disassembly, registers, or memory through the Debug>Windows menu.

  7. When you run the program, you should see an LED blink.

Next steps

This quickstart showed how to prepare your Azure Sphere device for debugging and how to build and debug a high-level application.