将市场项下载到 Azure Stack HubDownload Marketplace items to Azure Stack Hub

云操作员可从市场将项下载 Azure Stack Hub,并使这些项可供所有使用 Azure Stack Hub 环境的用户使用。As a cloud operator, you can download items to Azure Stack Hub from the Marketplace and make them available to all users using the Azure Stack Hub environment. 可以选择的项来自 Azure 市场项的有序列表,这些项已预先经过测试,支持与 Azure Stack Hub 配合使用。The items you can choose are from a curated list of Azure Marketplace items that are pre-tested and supported to work with Azure Stack Hub. 其他项会不断地添加到此列表中,因此请不时地返回查看新内容。Additional items are frequently added to this list, so continue to check back for new content.

有两种下载市场产品的场景:There are two scenarios for downloading Marketplace products:

  • 离线或部分联网场景:需使用市场联合集成工具访问 Internet 来下载市场项。Disconnected or partially connected scenario: Requires you to access the internet using the Marketplace syndication tool to download Marketplace items. 然后,将下载内容传输到离线 Azure Stack Hub 安装中。Then, you transfer your downloads to your disconnected Azure Stack Hub installation. 此场景使用 PowerShell。This scenario uses PowerShell.
  • 联网场景:需将 Azure Stack Hub 环境连接到 Internet。Connected scenario: Requires your Azure Stack Hub environment to be connected to the internet. 使用 Azure Stack Hub 管理员门户查找和下载项。You use the Azure Stack Hub administrator portal to locate and download items.

有关可下载的市场项的完整列表,请参阅 Azure Stack Hub 的 Azure 市场项See Azure Marketplace items for Azure Stack Hub for a complete list of the marketplace items you can download. 有关 Azure Stack Hub 市场的最新添加、删除和更新的列表,请参阅 Azure Stack Hub 市场更改一文。See the Azure Stack Hub Marketplace changes article for a list of recent additions, deletions, and updates to Azure Stack Hub Marketplace.


目录根据 Azure Stack Hub 系统连接到的云而异。The catalog will be different based on the cloud your Azure Stack Hub system is connected to. 云环境由用于注册 Azure Stack Hub 的 Azure 订阅确定。The cloud environment is determined by the Azure subscription you use for registering your Azure Stack Hub.


还可以使用操作员访问工作站 (OAW) 访问特权终结点 (PEP)、支持方案的管理员门户和 Azure Stack Hub GitHub 工具。You can also use the The Operator Access Workstation (OAW) to access the privileged endpoint (PEP), the Administrator portal for support scenarios, and Azure Stack Hub GitHub Tools. 有关详细信息,请参阅 Azure Stack Hub 操作员访问工作站For more information see Azure Stack Hub Operator Access Workstation.

通过连接的部署,可以使用管理员门户下载市场项。A connected deployment allows you to use the administrator portal to download marketplace items.


Azure Stack Hub 部署必须已建立 Internet 连接,并且已注册到 Azure。Your Azure Stack Hub deployment must have internet connectivity and be registered with Azure.

使用门户下载市场项Use the portal to download marketplace items

  1. 登录到 Azure Stack Hub 管理员门户。Sign into the Azure Stack Hub administrator portal.

  2. 下载市场项之前,查看可用的存储空间。Review the available storage space before downloading marketplace items. 稍后在选择要下载的项时,可将下载大小与可用存储容量进行比较。Later, when you select items for download, you can compare the download size to your available storage capacity. 如果容量有限,请考虑使用管理可用空间的选项。If capacity is limited, consider options for managing available space.

    若要查看可用空间,请在“区域管理”中选择要浏览的区域,然后转到“资源提供程序” > “存储”: To review available space: in Region management, select the region you want to explore and then go to Resource Providers > Storage:

    在 Azure Stack Hub 管理员门户中查看存储空间

  3. 打开 Azure Stack Hub 市场并连接到 Azure。Open Azure Stack Hub Marketplace and connect to Azure. 为此,请依次选择“市场管理”服务、“市场项”和“从 Azure 中添加”:To do so, select the Marketplace management service, select Marketplace items, and then select Add from Azure:

    从 Azure 添加市场项

  4. 每个行项还显示当前可用版本。Each line item also shows the currently available version. 如果某个市场项有多个可用版本,“版本”列会显示“多个”。 If more than one version of a Marketplace item is available, the Version column shows Multiple. 可以单击每个项查看其说明和附加信息,包括其下载大小:You can click on each item to view its description and additional information, including its download size:


  5. 如果某个项的版本显示为“多个”,你可以选择该项,然后从显示的版本选择器下拉列表中选择特定的版本。If the version of an item is shown as Multiple, you can select that item and then choose a specific version from the resulting version selector dropdown. 请注意,Microsoft 现在可以通过添加属性来阻止管理员下载由于各种属性(例如,Azure Stack 版本或计费模型)而与其 Azure Stack 不兼容的市场产品。Note that Microsoft now has the ability to add attributes that block administrators from downloading marketplace products that are incompatible with their Azure Stack, due to various properties, such as the Azure Stack version or billing model. 只有 Microsoft 才能添加以下属性:Only Microsoft can add these attributes:

    从 Azure 添加Add from Azure

  6. 选择所需的项,然后选择“下载”。Select the item you want, and then select Download. 下载时间根据网络连接性能而异。Download times vary and depends on the network connectivity. 下载完成后,可以 Azure Stack Hub 操作员或用户的身份部署新市场项。After the download completes, you can deploy the new marketplace item as either an Azure Stack Hub operator or a user.

  7. 若要部署下载的项,请选择“+ 创建资源”,在类别中搜索该新市场项。To deploy the downloaded item, select + Create a resource, and then search among the categories for the new marketplace item. 接下来,选择该项以开始部署过程。Next, select the item to begin the deployment process. 该过程根据市场项的不同而异。The process varies for different marketplace items.

Azure Stack Hub 受限或未建立 Internet 连接时,可以使用 PowerShell 和“市场联合工具”,将市场项下载到已建立 Internet 连接的计算机。When Azure Stack Hub has limited or no internet connectivity, you use PowerShell and the marketplace syndication tool to download the marketplace items to a machine with internet connectivity. 然后,将这些项传输到 Azure Stack Hub 环境。You then transfer the items to your Azure Stack Hub environment. 在离线环境中,无法使用 Azure Stack Hub 门户下载市场项。In a disconnected environment, you can't download marketplace items by using the Azure Stack Hub portal.

也可以在联网场景中使用市场联合工具。The marketplace syndication tool can also be used in a connected scenario.

此方案包含两个部分:There are two parts to this scenario:

  • 第 1 部分:从市场项下载。Part 1: Download from Marketplace items. 在能够访问 Internet 的计算机上配置 PowerShell,下载联合工具,然后从 Azure 市场下载项。On the computer with internet access, you configure PowerShell, download the syndication tool, and then download items from Azure Marketplace.
  • 第 2 部分:上传并发布到 Azure Stack Hub 市场。Part 2: Upload and publish to Azure Stack Hub Marketplace. 将下载的文件移到 Azure Stack Hub 环境,然后将其发布到 Azure Stack Hub 市场。You move the files you downloaded to your Azure Stack Hub environment and then publish them to Azure Stack Hub Marketplace.


  • 联网环境(不必是 Azure Stack Hub)。A connected environment (does not have to be Azure Stack Hub). 需要建立连接才能获取 Azure 中的产品列表及其详细信息,并在本地下载所有项。You need connectivity to get the list of products from Azure with their details, and to download everything locally. 完成此操作后,剩余的过程无需建立 Internet 连接。Once this is done, the rest of the procedure does not require internet connectivity. 此过程将创建以前下载的项的目录,供你在离线环境中使用。It creates a catalog of items you've previously downloaded for you to use in your disconnected environment.

  • 一个用于连接离线环境和传输所有必要项目的可移动媒体。Removable media to connect to your disconnected environment and transfer all the necessary artifacts.

  • 符合以下先决条件的离线 Azure Stack Hub 环境:A disconnected Azure Stack Hub environment with the following prerequisites:

使用以下命令从 PowerShell 库下载 Azs.Syndication.Admin 模块:Download the Azs.Syndication.Admin module from the PowerShell Gallery using the following command:

Install-Module -Name Azs.Syndication.Admin -AllowPrerelease -PassThru

注册 Azure Stack 后,可以忽略市场管理边栏选项卡上显示的以下消息,因为此消息与离线用例无关:Once you have registered your Azure Stack, you can disregard the following message that appears on the Marketplace management blade, as this is not relevant for the disconnected use case:


使用市场联合工具下载市场项Use the marketplace syndication tool to download marketplace items


每当在离线场景中下载市场项时,都请确保下载市场联合工具。Be sure to download the marketplace syndication tool each time you download marketplace items in a disconnected scenario. 此工具经常发生更改,每次下载都应使用最新版本。Frequent changes are made to this tool and the most current version should be used for each download.

  1. 在已建立 Internet 连接的计算机上,以管理员身份打开 PowerShell 控制台。On a computer with an Internet connection, open a PowerShell console as an administrator.

  2. 使用已用于注册 Azure Stack Hub 的 Azure 帐户登录到相应的 Azure 云和 AzureAD 目录租户。Sign in to the appropriate Azure cloud and AzureAD directory tenant using the Azure account that you've used to register Azure Stack Hub. 若要添加该帐户,请在 PowerShell 中运行 Connect-AzAccountTo add the account, in PowerShell run Connect-AzAccount:

    Connect-AzAccount -Environment AzureCloud -Tenant '<mydirectory>.onmicrosoft.com'

    系统会提示输入 Azure 帐户凭据。根据帐户的配置,可能需要使用双因素身份验证。You are prompted to enter your Azure account credentials and you might have to use two-factor authentication, depending on your account configuration.


    如果会话过期、密码已更改或你需要切换帐户,请在使用 Connect-AzAccount 登录之前先运行以下 cmdlet:Remove-AzAccount -Scope ProcessIf your session expires, your password has changed, or you want to switch accounts, run the following cmdlet before you sign in using Connect-AzAccount: Remove-AzAccount -Scope Process.

  3. 如果有多个订阅,请运行以下命令,以选择已用于注册的订阅:If you have multiple subscriptions, run the following command to select the one you used for registration:

    Get-AzSubscription -SubscriptionID 'Your Azure Subscription GUID' | Select-AzSubscription
  4. 如果尚未在先决条件步骤中完成此操作,请下载最新版本的市场联合工具:If you haven't done it in the pre-requisites step already, download the latest version of the Marketplace syndication tool:

    Install-Module -Name Azs.Syndication.Admin -AllowPrerelease -PassThru
  5. 若要选择要下载的市场项(如 VM 映像、扩展或解决方案模板),请运行以下命令:To select the Marketplace items such as VM images, extensions, or solution templates to download, run the following command:

    $products = Select-AzsMarketplaceItem

    随后会显示一个表格,其中列出了所选订阅中可用的所有 Azure Stack 注册。This displays a table that lists all the Azure Stack registrations available in the selected subscription. 选择与要下载其市场项的 Azure Stack 环境相匹配的注册,然后选择“确定”。Choose the registration that matches the Azure Stack environment you're downloading the marketplace items for, and select OK.

    屏幕截图,显示所选订阅中可用的所有 Azure Stack 注册的列表。

    此时应会看到另一个表格,其中列出了所有可供下载的市场项。You should now see a second table listing all the marketplace items available for download. 选择要下载的项,并记下 版本Select the item that you want to download and make a note of the Version. 可以按住 Ctrl 键选择多个映像。You can hold the Ctrl key to select multiple images. 屏幕截图,显示所选订阅中可用的所有 Azure Stack 注册的另一个列表。Screenshot that shows another list of all the Azure Stack registrations available in the selected subscription.

    也可通过“添加条件”选项来筛选映像的列表。You can also filter the list of images by using the Add criteria option. 选择 Azure Stack 注册Select Azure Stack Registrations

    做出选择后,选择“确定”。Once you've made your selections, select OK.

  6. 已经选择要下载的市场项的 ID 会保存在 $products 变量中。The IDs for the Marketplace items you've selected for download are saved in the $products variable. 使用以下命令开始下载选定的项。Use the command below to begin downloading the selected items. 请将 destination folder path 替换为从 Azure 市场下载的文件的存储位置:Replace the destination folder path with a location to store the files you download from Azure Marketplace:

    $products | Export-AzsMarketplaceItem  -RepositoryDir "Destination folder path in quotes"
  7. 所需的下载时间取决于项的大小。The time that the download takes depends on the size of the item. 下载完成后,该项会出现在脚本中指定的文件夹内。After the download completes, the item is available in the folder that you specified in the script. 下载内容中包括一个 VHD 文件(适用于虚拟机)或 .zip 文件(适用于虚拟机扩展和资源提供程序)。The download includes a VHD file (for virtual machines), or a .zip file (for virtual machine extensions and resource providers). 其中还可能包含一个 .azpkg 格式的库包(一个 .zip 文件)。It might also include a gallery package in the .azpkg format, which is a .zip file.

  8. 如果下载失败,可以重新运行以下 PowerShell cmdlet 来重试下载:If the download fails, you can try again by re-running the following PowerShell cmdlet:

    $products | Export-AzsMarketplaceItem  -RepositoryDir "Destination folder path in quotes"
  9. 还应该将 Azs.Syndication.Admin 模块导出到本地,以便能够将其复制到要从中将市场项导入到 Azure Stack Hub 的计算机。You should also export the Azs.Syndication.Admin module locally so that you can copy it over to the machine from which you are importing Marketplace items to Azure Stack Hub.


    用于导出此模块的目标文件夹应该不同于市场项的导出所在位置。The destination folder for exporting this module should be different from the location to which you have exported the marketplace items.

    Save-Package -ProviderName NuGet -Source https://www.powershellgallery.com/api/v2 -Name Azs.Syndication.Admin -Path "Destination folder path in quotes" -Force

使用 PowerShell 导入下载内容并发布到 Azure Stack Hub 市场Import the download and publish to Azure Stack Hub Marketplace using PowerShell

  1. 必须将前面下载到本地的文件移到已与 Azure Stack Hub 环境建立了连接的计算机。You must move the files that you have previously downloaded locally to a machine that has connectivity to your Azure Stack Hub environment. 市场联合工具也必须可供 Azure Stack Hub 环境使用,因为你需要使用该工具来执行导入操作。The marketplace syndication tool must also be available to your Azure Stack Hub environment because you need to use the tool to perform the import operation.

    下图显示了文件夹结构示例。The following image shows a folder structure example. D:\downloadfolder 包含所有已下载的市场项。D:\downloadfolder contains all the downloaded marketplace items. 每个子文件夹都是一个市场项(例如 microsoft.custom-script-linux-arm-2.0.3),并按产品 ID 命名。Each subfolder is a marketplace item (for example, microsoft.custom-script-linux-arm-2.0.3), named by the product ID. 每个子文件夹包含市场项的下载内容。Inside each subfolder is the marketplace item's downloaded content.


  2. 按照此文中的说明配置 Azure Stack Hub 操作员 PowerShell 会话。Follow the instructions in this article to configure the Azure Stack Hub Operator PowerShell session.

  3. 使用对“默认提供程序订阅”拥有所有者访问权限的标识登录到 Azure Stack Hub。Sign in to your Azure Stack Hub with an identity that has owner access to the "Default Provider Subscription".

  4. 导入联合模块,然后运行以下脚本来启动市场联合工具:Import the syndication module and then launch the marketplace syndication tool by running the following script:

    Import-AzsMarketplaceItem -RepositoryDir "Source folder path in quotes"
  5. 成功完成该脚本后,Azure Stack Hub 市场中应会提供这些市场项。After the script successfully completes, the marketplace items should be available in Azure Stack Hub Marketplace.