Quickstart: Configure networking and update the device OS

After you claim your Azure Sphere device, configure it for networking so that it can receive cloud updates from the Azure Sphere Security Service and communicate with services such as an Azure IoT Hub. When you've configured and enabled networking, your device can receive an OS update from the cloud.

Important

This topic describes how to connect your Azure Sphere device to a Wi-Fi network. If your device supports a different networking mechanism and does not support Wi-Fi, connect it to the internet using that mechanism and proceed to Receive device update.

Prerequisites

Set up Wi-Fi on your Azure Sphere device

Follow these steps to configure Wi-Fi on your Azure Sphere device:

  1. Connect your Azure Sphere device to your computer.

  2. Open a command-line interface using PowerShell, Windows Command Prompt, or Linux command shell.

  3. Register the device's MAC address if your network environment requires it. Use the following command to get the MAC address, and then register it according to the procedure for your environment:

    az sphere device wifi show-status
    
  4. Add your Wi-Fi network to the device by using the az sphere device wifi add command as follows:

    az sphere device wifi add --ssid <SSID> --psk <EXAMPLEPSK>
    

    Replace <SSID> with the name of your network. Network SSIDs are case-sensitive. If the SSID is hidden, add --targeted-scan to try to connect to it anyway. You can use az sphere device wifi scan to get a list of available Wi-Fi networks.

    Replace <EXAMPLEPSK> with your WPA/WPA2 key. Azure Sphere devices do not support WEP. To add an open network, omit --psk.

    If the network SSID or key has embedded spaces or an ampersand, enclose the SSID or key in single quotes. If the SSID or key includes a quotation mark, use a backslash to escape the quotation mark. Backslashes do not have to be escaped if they are part of a value. For example:

    az sphere device wifi add --ssid "New SSID" --psk "key \'value\' with quotes"
    

    It typically takes several seconds for networking to be ready on the board, but might take longer, depending on your network environment.

  5. Use the az sphere device wifi show-status command to check the status of the connection:

    az sphere device wifi show-status
    

    During update, the az sphere device wifi show-status command may temporarily show an unknown configuration state. The following example shows successful results for a secure WPA2 connection:

    ----- ------------------ --------------- ------------- --------- ------- ------------- --------- ------------- -----------------
    SSID  ConfigurationState ConnectionState SecurityState Frequency Mode    KeyManagement WpaState  IpAddress     MacAddress
    ===============================================================================================================================
    <value> enabled            connected       psk           2412      station WPA2-PSK      COMPLETED <value>      <value>
    ----- ------------------ --------------- ------------- --------- ------- ------------- --------- ------------- -----------------
    

The az sphere device wifi command supports several additional options. Type az sphere device wifi --help for a complete list, or az sphere device wifi option --help for help on an individual option.

Follow these steps to configure Wi-Fi on your Azure Sphere device:

  1. Connect your Azure Sphere device to your computer.

  2. Open Azure Sphere Explorer.

  3. Expand the Device node for the device you are interested in.

  4. Expand the Wi-Fi node. You should see something like the following:

  5. Expand the node labeled Disconnected and you should see the MAC address of the device. Register the device's MAC address if your network environment requires it. Note the refresh button at the right; you will need this to view the connectivity information after you have connected to a network.

  6. Expand the Available networks node, if possible. Hover over the network you wish to connect to and select Connect (this appears as a + at the right of the node). If the network requires a Pre-Shared Key (PSK), type the network password in the textbox that appears and press Enter.

  7. Return to the node previously labeled Disconnected, which should now read Connected to: <network>. If you still see Disconnected after a few moments, click the refresh button on this node to view the updated connection status of your device.

  8. You should see the following information:

    • SSID
    • Configuration state
    • Connection state
    • Security state
    • Frequency
    • Mode
    • Key management type
    • WPA state
    • IP address
    • MAC address

    This is the same information as reported by the CLI command az sphere device wifi show-status.

    You should also see the network you've connected to appear on your Saved networks node.

Follow these steps to configure Wi-Fi on your Azure Sphere device:

  1. Connect your Azure Sphere device to your computer.

  2. Open Azure Sphere Explorer.

  3. Expand the Device node for the device you are interested in.

  4. Expand the Wi-Fi node. You should see something like the following:

  5. Expand the node labeled Disconnected and you should see the MAC address of the device. Register the device's MAC address if your network environment requires it. Note the refresh button at the right; you will need this to view the connectivity information after you have connected to a network.

  6. Expand the available networks node, if possible. Right-click the network you wish to connect to and select Connect. If your network requires a Pre-Shared Key (PSK), type the network password in the PSK textbox and press Enter.

  7. Return to the node previously labeled Disconnected, which should now read Connected to: <network>. If you still see Disconnected after a few moments, click the refresh button on this node to view the updated connection status of your device.

  8. You should see the following information:

    • IP address
    • Security state
    • MAC address
    • WPA state
    • Mode
    • Frequency
    • Key management type
    • Whether a targeted scan was used

    This is the same information as reported by the CLI command az sphere device wifi show-status.

    You should also see the network you've connected to appear on your Saved networks node.

Enable or disable Wi-Fi networks

You can enable a configured Wi-Fi network using the az sphere device wifi enable command:

az sphere device wifi enable --id <ID>

Replace <ID> with the ID of the network, which can be obtained by calling az sphere device wifi list.

You can disable a configured Wi-Fi network using the az sphere device wifi disable command as follows:

az sphere device wifi disable --id <ID>

Replace <ID> with the ID of the network, which can be obtained by calling az sphere device wifi list.

To enable a configured Wi-Fi network in Visual Studio Code's Azure Sphere Explorer:

  1. Expand the Saved networks node.

  2. Find a disabled network; these will have a Wi-Fi symbol to the right of their names.

  3. Select the Wi-Fi symbol, or right-click the network name and then select Enable.

To disable a configured Wi-Fi network in Visual Studio Code's Azure Sphere Explorer:

  1. Expand the Saved networks node.

  2. Find an enabled network; these will have a Wi-Fi symbol with a backslash through it to the right of their names.

  3. Select the disabled Wi-Fi symbol, or right-click the network name and then select Disable.

To enable a configured Wi-Fi network in Visual Studio's Azure Sphere Explorer:

  1. Expand the Saved networks node.

  2. Find a disabled network; these will have a connection symbol to the right of their names.

  3. Select the connection symbol, or right-click the network name and then select Enable.

To disable a configured Wi-Fi network in Visual Studio Code's Azure Sphere Explorer:

  1. Expand the Saved networks node.

  2. Find an enabled network; these will have a disconnect symbol to the right of their names.

  3. Select the disconnect symbol, or right-click the network name and then select Disable.

Forget a Wi-Fi network

You can forget a configured Wi-Fi network using the az sphere device wifi forget command:

az sphere device wifi forget --id <ID>

Replace <ID> with the ID of the network, which can be obtained by calling az sphere device wifi list.

To forget a configured Wi-Fi network in Visual Studio Code's Azure Sphere Explorer:

  1. Expand the Saved networks node.
  2. Right-click the network you want to forget and then select Forget.

To forget a configured Wi-Fi network in Visual Studio's Azure Sphere Explorer:

  1. Expand the Saved networks node.
  2. Right-click the network you want to forget and then select Forget.

Receive device update

The Azure Sphere device checks for Azure Sphere OS and application updates each time it boots, when it initially connects to the internet, and at 24-hour intervals thereafter. If updates are available, download and installation could take as much as 15-20 minutes and might cause the device to restart.

To check on update status, type the following command:

az sphere device show-deployment-status --resource-group MyResourceGroup --catalog MyCatalog --device <DeviceIdValue>

If you have an older Seeed MT3620 Development Kit, you may have to update it manually:

  1. Connect the board to the PC by USB.

  2. Open a command-line interface using PowerShell, Windows Command Prompt, or Linux command shell.

  3. Update your board by using the recovery procedure:

    az sphere device recover

If you encounter Wi-Fi problems, first ensure that your Wi-Fi network uses 802.11b/g/n; Azure Sphere devices do not support 802.11a.

Note

Azure Sphere OS update is a staged process over a period that may be less than 15 minutes but can be longer depending on the internet connectivity. Between stages, the board will appear functional while the next group of updates is downloaded, but during the update you should expect the board to be unresponsive for several minutes at a time.

Next steps