Create a deployment

To deploy your applications from the cloud, you upload the application images to your Azure Sphere catalog and create a deployment to distribute the images to Azure Sphere devices. To create a deployment, you must be signed in to Azure and you must have the the appropriate RBAC permissions granted. In addition, your devices must be prepared to receive cloud deployments.

Note

Each component in a deployment must have a unique GUID. If you base your application on an Azure Sphere sample, remember to create a unique GUID for your application before creating a deployment to avoid possible conflicts.

Prepare the devices

Before your devices can receive applications from the cloud, they must have a product and belong to a device group, and cannot have the AppDevelopment capability installed.

If you haven't already created a product for your devices, you need to do so before you can create a deployment. To create a product:

az sphere product create --resource-group MyResourceGroup --catalog MyCatalog --name MyProduct --description MyDescription

Replace <MyProduct> with a name for your product, such as DW100. See az sphere product for more information on this command.

Deployments target device groups, so you'll also need to assign your devices to a device group that enables cloud updates before they can receive your deployed applications. By default, each product has five device groups: Production, Field Test, Development, Field Test OS Evaluation, and Production OS Evaluation. You can use one of these device groups or create your own. To find out whether a device group accepts cloud updates, use az sphere device-group show.

The devices must also be prepared for cloud loading, which means that they do not have the appDevelopment capability. When shipped from the factory, devices do not have this capability. However, if you've used a device for application development, you've probably added this capability with the az sphere device enable-development command.

To remove the capability, use az sphere device enable-cloud-test:

az sphere device enable-cloud-test --resource-group MyResourceGroup --catalog MyCatalog --device-group <device-group-ID>

For more information, see deployment create.

Create a deployment for a device group

Deployments can contain both applications and board configurations, and both are handled the same way when you create a deployment. Deployments are sets of images to be distributed to all devices within a device group. Each deployment is linked to a specific device group within a specific product. You must include either the product name and the device group name (as the following example shows) or the device group ID when you create the deployment.

To create a deployment:

  1. Upload the image package:

    az sphere image add --resource-group MyResourceGroup --catalog MyCatalog --image-path <path-to-image> --regional-data-boundary <value>
    
  2. Create a new deployment for a device group:

    az sphere deployment create --resource-group MyResourceGroup --catalog MyCatalog --product <product-name> --device-group <device-group-ID> --images <image-ID>
    

To provide multiple values for --images enter a list of values separated by spaces.

The --images parameter provides the image ID of the image package file for the application. The image is uploaded to your current catalog.

The --regional-data-boundary parameter specifies the regional data boundary for this image. Allowed values are EU and None. The default value is None. If no value is specified the default value will be used.

For example (some parameters removed for brevity):

az sphere image add --image my-app.imagepackage --regional-data-boundary "None"
az sphere deployment create --product "DW100" --device-group "Field Test" --images e3769536-dc4b-48d9-afd4-22ed321ba4bc

Rules for a valid deployment

To be valid, a deployment must follow these rules:

  • The total size of the deployment must be less than 1 MiB.
  • The deployment can have no more than one board configuration file.

Update a deployment

To update a deployment, use the az sphere image add and az sphere deployment create commands again, as described in the previous section, and specify the path to the updated application file.