部署基本Deployment basics

我們後續的討論都將以虛構 Contoso Corporation 的三個設備型號為例。We will use three appliance models from the fictitious Contoso Corporation as an example throughout this discussion.

Contoso 洗碗機和咖啡機

裝置識別碼Device IDs

每個 Azure Sphere 晶片都具有唯一且不可變的 Azure Sphere 裝置識別碼。Every Azure Sphere chip has a unique and immutable Azure Sphere device ID. Azure Sphere 裝置識別碼可唯一識別個別的晶片。The Azure Sphere device ID uniquely identifies the individual chip. 裝置識別碼會儲存於裝置本身。The device ID is stored on the device itself. 部署的所有其他元素都會連同 Azure Sphere 安全性服務一起儲存。All the other elements of a deployment are stored with the Azure Sphere Security Service.

SKU 和 SKU 集SKUs and SKU sets

庫存單位 (SKU) 是用來識別實體裝置型號的 GUID。A stock keeping unit (SKU) is a GUID that identifies a model of physical device. 產品 SKU 可識別內含 Azure Sphere MCU 的連線裝置產品。A product SKU identifies a connected device product that incorporates an Azure Sphere MCU. 身為製造商,您會為每個型號的連線裝置 (例如洗碗機或咖啡機) 建立一個產品 SKU。As the manufacturer, you create a product SKU for each model of connected device, such as a dishwasher or coffeemaker. 例如,Contoso 為其 DW100 洗碗機建立了一個產品 SKU,並在製造期間將此產品 SKU 指派給每個 DW100 洗碗機。For example, Contoso creates a product SKU for its DW100 dishwashers and assigns this product SKU to each DW100 dishwasher during manufacturing.

每個連線裝置各有一個產品 SKU,但一個產品 SKU 可與多個裝置相關聯。Every connected device has a single product SKU, but a single product SKU can be associated with many devices. 每個產品 SKU 都有名稱和描述,以提供可讓一般使用者區別不同產品 SKU 的方法。Each product SKU has a name and a description, which provide a human-readable way to distinguish one product SKU from another.

此外,還有每個 Azure Sphere 晶片也都有晶片 SKU,用以識別特定類型的 Azure Sphere 相容 MCU。In addition, every Azure Sphere chip has a chip SKU that identifies a particular type of Azure Sphere-compatible MCU. 晶片 SKU 由 Microsoft 所指派,且無法變更。The chip SKU is assigned by Microsoft and cannot be changed. Microsoft 會使用此 SKU 將正確的系統軟體更新提供給每個 Azure Sphere 裝置。Microsoft uses this SKU to deliver the correct system software updates to each Azure Sphere device.

SKU 集可識別所有併入連線裝置的硬體,並因此可識別與裝置相容的所有軟體。A SKU set identifies all the hardware that is incorporated into a connected device, and thus identifies all the software that is compatible with the device. 連線裝置的 SKU 集包含其由製造商指派的產品 SKU,和 Microsoft 指派的晶片 SKU。The SKU set for a connected device includes both its manufacturer-assigned product SKU and the Microsoft-assigned chip SKU.

例如︰For example:

SKU 集

Contoso 設備的 SKU 集SKU sets for Contoso appliances

此圖顯示了三項 Contoso 設備,每一項都包含 Azure Sphere MT3620 MCU:The figure shows three Contoso appliances, all of which include an Azure Sphere MT3620 MCU:

  • DW100 洗碗機具有 DW100 產品 SKU。The DW100 dishwasher has the DW100 Product SKU. 其 SKU 集指出該裝置與以 DW100 洗碗機為目標的 Contoso 應用程式軟體相容。Its SKU set indicates that the device is compatible with Contoso application software that targets the DW100 dishwasher.

  • DW200 洗碗機具有 DW100 未提供的其他功能,因此具有不同的產品 SKU:DW200 產品 SKU。The DW200 dishwasher has additional features that are not available in the DW100 and thus has a different product SKU: the DW200 product SKU. 其 SKU 集指出該裝置與以 DW200 洗碗機為目標的 Contoso 應用程式軟體相容。Its SKU set indicates that the device is compatible with Contoso application software that targets the DW200 dishwasher. 目前,DW200 所執行的應用程式軟體與 DW100 相同,但 Contoso 預計將在近期發行 DW200 專用的軟體。Currently, the DW200 runs the same application software as the DW100, but Contoso intends to release DW200-specific software soon.

  • CM300 咖啡機具有 CM300 產品 SKU。The CM300 coffeemaker has the CM300 product SKU.

元件和應用程式Components and applications

元件代表可更新的軟體套件。A component represents a software package that can be updated. 前述的 Contoso 範例中討論到兩個元件:The preceding Contoso example involves two components:

  • DW100SW 洗碗機應用程式軟體,執行於 DW100 和 DW200 型號上DW100SW dishwasher application software, which runs on the DW100 and DW200 models
  • CM300SW 咖啡機應用程式軟體CM300SW coffeemaker application software

應用程式是指會執行特定連線裝置之特有工作的元件。An application is a component that performs tasks specific to certain connected devices. 每個應用程式分別以這些連線裝置的一或多個相關產品 SKU 為目標。Each application targets one or more product SKUs that are associated with those connected devices. 身為產品製造商,您會開發及管理應用程式,而 Microsoft 則開發和管理系統軟體元件。As a product manufacturer, you develop and manage applications, whereas Microsoft develops and manages system software components. 系統軟體元件以晶片 SKU 為目標。System software components target chip SKUs.

映像和映像集Images and image sets

映像代表元件的單一版本。An image represents a single version of a component. 映像是不可變的:映像在您上傳之後即無法修改。Images are immutable: you cannot modify an image after it has been uploaded. 就應用程式而言,映像會包含應用程式及其映像中繼資料的二進位檔。For an application, the image includes the binaries for the application along with its image metadata. 每個映像都有唯一的映像識別碼,這是映像中繼資料的一部分。Each image has a unique image ID, which is part of the image metadata. 每次 SDK 建置或重建 Azure Sphere 映像套件時,它都會使用新的唯一映像識別碼。Every time the SDK builds or rebuilds an Azure Sphere image package, it uses a new unique image ID.

映像集是一個映像群組,代表交互相依而因此必須以整體方式部署和更新的元件。An image set is a group of images that represent interdependent components and therefore must be deployed and updated as a unit. 和單一映像一樣,映像集也是不可變的。Like a single image, an image set is immutable.

摘要Feeds

摘要會將軟體傳遞至一或多個裝置。A feed delivers software to one or more devices. Microsoft 會建立傳遞 Azure Sphere OS 的摘要,而您則建立傳遞應用程式軟體的摘要。Microsoft creates feeds to deliver the Azure Sphere OS, and you create feeds to deliver your application software. 摘要是階層式的:每個應用程式摘要都取決於 Azure Sphere OS 摘要。Feeds are hierarchical: every application feed depends on an Azure Sphere OS feed.

當您建立應用程式摘要時,您會指定摘要所依存的系統軟體、摘要的目標產品和晶片 SKU,以及摘要所傳遞的元件。When you create an application feed, you specify the system software feed that it depends on, the product and chip SKUs that it targets, and the component that it delivers. 目前,每個應用程式摘要分別會與一個元件相關聯。Currently, each application feed is associated with a single component.

當您準備好要部署應用程式時,您可以建立映像,用以代表您要部署的應用程式版本。When you are ready to deploy an application, you create an image that represents the version of the application you want to deploy. 然後,您可以將映像新增至映像集,再將映像集新增至相關元件的摘要。Then you add the image to an image set, and add the image set to a feed for the associated component. 最近新增的映像集會成為最新的映像集。The most recently added image set becomes the current image set. Azure Sphere 安全性服務會將目前的映像集提供給目標裝置。The Azure Sphere Security Service delivers the current image set to the targeted devices. 雖然一個摘要只有一個目前的映像集,但每個摘要都會就其已新增的所有映像集維護一份稽核清單。Although a feed has only one current image set, each feed maintains an audit list of all image sets that were ever added to it.

應用程式摘要與僅傳輸特定內容類型的管道相類似;也就是說,應用程式摘要只能傳遞代表特定元件的映像集。An application feed is analogous to a pipe that carries only a certain kind of material; that is, an application feed can only deliver image sets that represent a particular component. 因此,Contoso 會分別為 DW100SW 應用程式軟體和 CM300SW 應用程式軟體定義不同的摘要,因為這兩個裝置使用不同的應用程式。Therefore, Contoso would define one feed for the DW100SW application software and another for the CM300SW application software because the two devices use different applications.

單一摘要可將其軟體提供給一或多個產品 SKU。A single feed can supply its software to one or more product SKUs. 定義摘要後,您可以新增映像集,但無法對摘要新增或移除元件、晶片 SKU 或產品 SKU。After you define a feed, you can add an image set, but you cannot add or remove a component, a chip SKU, or a product SKU from the feed. 也就是說,摘要的定義 (它所傳遞的元件及其目標 SKU) 是不可變的。That is, the definition of the feed—the components it delivers and the SKUs it targets—is immutable.

在 Contoso 範例中,DW100 與 DW200 洗碗機各有不同的產品 SKU,但目前都使用 DW100SW 應用程式軟體。In the Contoso example, the DW100 and DW200 dishwashers have different product SKUs but both currently use the DW100SW application software. Contoso 有兩個選項:Contoso has two options:

  • 定義單一摘要,將 DW100SW 應用程式軟體同時傳遞給 DW100 和 DW200 產品 SKUDefine a single feed that delivers the DW100SW application software to both the DW100 and DW200 product SKUs
  • 定義一個將 DW100SW 應用程式軟體傳遞給 DW100 產品 SKU 的摘要,並定義另一個將 DW100SW 應用程式軟體傳遞給 DW200 產品 SKU 的摘要Define one feed that delivers the DW100SW application software to the DW100 product SKU and another feed that delivers the DW100SW application software to the DW200 product SKU

Contoso 預計在近期為 DW200 發行個別的應用程式。Contoso plans to release a separate application for the DW200 soon. 如果他們定義將目前的應用程式同時傳遞給這兩個產品 SKU 的單一摘要,則有新的軟體可供使用時,他們將必須建立兩個新摘要:每個 SKU 各一個。If it defines a single feed that delivers the current application to both product SKUs, it must create two new feeds when the new software is ready: one for each SKU. 他們並未這麼做,而是建立了兩個摘要。Instead, it creates two feeds now. DW100 摘要將 DW100SW 應用程式傳遞給 DW100 洗碗機,暫時的 DW200 摘要則將 DW100SW 應用程式傳遞給 DW200 洗碗機。The DW100 feed delivers the DW100SW application to DW100 dishwashers, and a temporary DW200 feed delivers the DW100SW application to the DW200 dishwashers. 下圖顯示這些範例摘要:The following figure shows these sample feeds:

Contoso DW100 的範例摘要

Contoso 的 DW100 應用程式摘要Contoso feeds for DW100 application

Contoso 準備好要測試其新 DW200 專屬的應用程式時,他們建立了新的元件和映像集,以代表 DW200SW 應用程式的測試版本。When Contoso is ready to test its new DW200-specific application, it creates a new component and image set to represent the test version of the DW200SW application. 然後,Contoso 設定了新的摘要,以將 DW200SW 元件傳遞給具有 DW200 產品 SKU 的裝置,並將 DW200 測試應用程式映像集指派給這個新的摘要。Contoso then sets up a new feed that delivers the DW200SW component to devices that have the DW200 product SKU, and it assigns the DW200 test application image set to this new feed. 現有的 DW100 摘要則繼續將 DW100SW 應用程式傳遞給 DW100 洗碗機。The existing DW100 feed continues to deliver the DW100SW application to DW100 dishwashers.

Contoso DW200 的範例摘要

Contoso 為新的 DW200 應用程式建立的摘要Contoso feed for new DW200 application

如範例所提到的,產品製造商通常會定義多個摘要。As this example implies, a product manufacturer would typically define multiple feeds. 例如,Contoso 可能會分別為其應用程式定義兩個摘要:測試摘要和零售摘要。For example, Contoso might define two feeds for each of its applications: a Test feed and a Retail feed. 測試摘要負責傳遞仍在開發中的應用程式軟體,零售摘要則傳遞已可供實地部署的應用程式軟體。The Test feed delivers application software that is still in development, and the Retail feed delivers application software that is ready for field deployment. 這兩個摘要以相同的 SKU 集為目標,但傳遞不同版本的應用程式。Both feeds target the same SKU set, but deliver different versions of the application. 也就是說,它們與不同的映像集相關聯。That is, they are associated with different image sets.

Contoso DW100 的零售和測試摘要

Contoso 的零售和測試摘要Contoso retail and test feeds

此圖中的測試和零售摘要除了各自的映像集以外全部相同。The Test and Retail feeds in the figure are identical except for their image sets. 零售摘要與 DW100SW v1.0 映像集相關聯,而測試摘要則與 DW100SW v1.5 映像集相關聯。The Retail feed is associated with the DW100SW v1.0 image set, and the Test feed is associated with the DW100SW v1.5 image set. 為了測試 DW100SW 應用程式的新版本,Contoso 使用測試軟體的元件識別碼,直接建立了包含更新軟體的新映像集,並將該映像集指派給測試摘要。To test a new version of its DW100SW application, Contoso simply creates a new image set that contains the updated software, using the component ID for its test software, and assigns that image set to the Test feed. 同理,如果 Contoso 在測試期間發現錯誤,他們可以將之前的映像集指派給測試摘要,而將部署回復至先前的版本。Similarly, if Contoso discovers errors during testing, it can roll back the deployment to an earlier version by assigning an earlier image set to the Test feed.

摘要和映像集將決定哪些元件 (和這些元件的哪個版本) 會以無線方式部署至連線的裝置。Feeds and image sets determine which components—and which versions of those components—are deployed over the air to connected devices. 摘要會將元件和映像集連結至產品 SKU,而裝置群組會連結摘要與個別的連線裝置。Feeds link components and image sets with product SKUs, and device groups link feeds with individual connected devices.

裝置群組Device groups

裝置群組可讓您將應用程式部署的規模擴充至許多裝置。Device groups provide a way to scale application deployment to many devices. 裝置群組是有共通點的裝置,以及將軟體傳遞給這些裝置的摘要清單,所共同組成的具名集合。A device group is a named collection of devices that have something in common, together with a list of feeds that deliver software to those devices. 每個裝置分別屬於一個裝置群組。Each device belongs to exactly one device group. 例如,Contoso 可能會為其測試實驗室中的裝置建立一個裝置群組,並且為零售通路中的裝置建立另一個群組。For example, Contoso might create one device group for the devices in its test lab and another for devices in the retail channel. 測試實驗室群組中的裝置會收到測試應用程式摘要,而零售群組中的裝置則會收到生產應用程式摘要。Devices in the test lab group receive the test application feed, and the devices in the retail group receive the production application feed. 或者,Contoso 可能會依保固狀態或地理位置為裝置分組。Alternatively, Contoso might group devices by warranty status or geography. 分組條件完全由製造商斟情設定。The grouping criteria are left completely to the discretion of the manufacturer.

裝置群組可包含具有不同 SKU 的產品。A device group can contain products with different SKUs. 例如,一個裝置群組中可能會包含數個 DW100 洗碗機、DW200 洗碗機和 CM300 咖啡機。For example, a single device group could contain several DW100 dishwashers, DW200 dishwashers, and CM300 coffeemakers. 唯一的限制是群組中的每個裝置必須屬於相同的 Azure Sphere 租用戶。The only restriction is that every device in the group must belong to the same Azure Sphere tenant.

每個裝置群組都會與其成員裝置的摘要清單相關聯。Each device group is associated with a list of the feeds for its member devices. 據此,Contoso 測試實驗室的裝置群組可能會包含下列資訊:Thus, a device group for the Contoso Test Lab might contain the following information:

裝置:Devices:
DW100 裝置 123DW100 device 123
DW200 裝置 456DW200 device 456
CM300 裝置 789CM300 device 789
CM300 裝置 0abCM300 device 0ab

摘要:Feeds:
DW100 測試摘要,以 DW100 產品 SKU 為目標DW100 Test feed, which targets the DW100 product SKU
DW200 暫時摘要,以具有 DW100SW 軟體的 DW200 產品 SKU 為目標DW200 Temp feed, which targets the DW200 product SKU with DW100SW software
CM300 測試摘要,以 CM300 產品 SKU 為目標CM300 Test feed, which targets the CM300 product SKU

此裝置群組會將 DW100SW 測試軟體提供給 DW100 洗碗機、透過先前說明的 DW200 暫時摘要將 DW100SW 測試軟體提供給 DW200 洗碗機,並將 CM300SW 測試軟體提供給兩部 CM300 咖啡機。This device group provides the DW100SW Test software to the DW100 dishwasher, DW100SW Test software to the DW200 dishwasher through the DW200 Temp feed previously described, and the CM300SW Test software to both the CM300 coffeemakers.

指派給裝置群組的每個摘要都必須提供唯一的 SKU 集。Each feed assigned to a device group must supply a unique SKU set. 在此範例中,兩部 CM300 咖啡機都具有 CM300 產品 SKU,因此這兩個裝置都必須使用 CM300 測試摘要所提供的 CM300SW 版本。In this example, both CM300 coffeemakers have the CM300 product SKU, so both devices must use the version of the CM300SW that the CM300 Test feed supplies.

為了將更新軟體部署到測試實驗室中的裝置,Contoso 建立了新的映像集,並將其新增至適當的摘要。To deploy updated software to the devices in the test lab, Contoso creates a new image set and adds it to the appropriate feed. (請記住,映像集是不可變的)。例如,Contoso 在準備好要測試 DW100SW 應用程式的新版本時,他們建立了代表新版本的映像集,並將其指派給 DW100 測試摘要。(Remember, image sets are immutable.) For example, when Contoso is ready to test a new version of the DW100SW application, it creates an image set that represents the new version and assigns it to the DW100 Test feed. 為了測試新的 DW200SW 應用程式,他們建立了 DW200 測試摘要,並將其連結至 Contoso 測試實驗室裝置群組。To test its new DW200SW application, it creates a DW200 Test feed and links it to the Contoso Test Lab device group. 裝置群組此時會包含下列資訊:The device group then contains the following information:

裝置:Devices:
DW100 裝置 123DW100 device 123
DW200 裝置 456DW200 device 456
CM300 裝置 789CM300 device 789
CM300 裝置 0abCM300 device 0ab

摘要:Feeds:
DW100 測試摘要,以 DW100 產品 SKU 為目標DW100 Test feed, which targets DW100 product SKU
DW200 測試摘要,以 DW200 產品 SKU 為目標DW200 Test feed, which targets DW200 product SKU
CM300 測試摘要,以 CM300 產品 SKU 為目標CM300 Test feed, which targets CM300 product SKU

Contoso 測試實驗室中的裝置 456 在下次要求更新時,將會透過 DW200 測試摘要接收到 DW200SW 測試軟體。The next time device 456 in the Contoso Test Lab requests an update, it receives the DW200SW test software via the DW200 Test feed.

下圖顯示摘要、映像集和裝置群組如何共同決定部署到每個裝置的軟體:The following diagram shows how feeds, image sets, and device groups together determine the software that is deployed to each device:

Contoso 測試實驗室裝置群組

Contoso 測試實驗室裝置群組和摘要Contoso Test Lab device group and feeds

請記住,裝置群組並不會決定要部署的元件。Keep in mind that the device group does not establish which components are deployed. 哪些元件可在裝置上執行取決於 SKU 集,摘要則會決定目前的映像集,而映像集代表目前的元件版本。The SKU set establishes which components can run on the device, the feed determines the current image set, and the image set represents the current version of the component. 部署則由這些元素共同組合而成。These elements taken together determine the deployment.