创建媒体服务帐户Create a Media Services account

若要开始加密、编码、管理和流式处理 Azure 中的媒体内容,需要创建媒体服务帐户。To start encrypting, encoding, managing, and streaming media content in Azure, you need to create a Media Services account. 媒体服务帐户需与一个或多个存储帐户相关联。The Media Services account needs to be associated with one or more storage accounts.

备注

媒体服务帐户和所有关联的存储帐户必须位于同一 Azure 订阅中。The Media Services account and all associated storage accounts must be in the same Azure subscription. 强烈建议在媒体服务帐户所在的位置使用存储帐户,避免额外的延迟和数据出口成本。It is strongly recommended to use storage accounts in the same location as the Media Services account to avoid additional latency and data egress costs.

本文介绍创建新 Azure 媒体服务帐户的步骤。This article describes steps for creating a new Azure Media Services account. 从以下选项卡中进行选择。Choose from the following tabs.

使用 Azure 门户Use the Azure portal

如果没有 Azure 订阅,可在开始前创建一个试用帐户If you don't have an Azure subscription, create a trial account before you begin.

使用 Azure 门户,可以快速创建 Azure 媒体服务帐户。The Azure portal provides a way to quickly create an Azure Media Services account. 可以使用自己的帐户访问媒体服务,通过这些服务可以在 Azure 中存储、加密、编码、管理和流式传输媒体内容。You can use your account to access Media Services that enable you to store, encrypt, encode, manage, and stream media content in Azure.

目前,可以使用 Azure 门户执行以下操作:Currently, you can use the Azure portal to:

对于其他所有管理任务(例如,转换和作业内容保护),请使用 REST APICLI 或某个受支持的 SDKFor all other management tasks (for example, Transforms and Jobs and Content protection), use the REST API, CLI, or one of the supported SDKs.

本文展示了如何使用 Azure 门户创建媒体服务帐户。This article shows how to create a Media Services account using the Azure portal.

创建媒体服务帐户Create a Media Services account

  1. 登录到 Azure 门户Sign in at the Azure portal.

  2. 单击“+创建资源” > “媒体” > “媒体服务”。Click +Create a resource > Media > Media Services.

  3. 在“创建媒体服务帐户”部分中输入所需的值。In the Create a Media Services account section enter required values.

    名称Name 说明Description
    帐户名Account Name 输入新的媒体服务帐户的名称。Enter the name of the new Media Services account. 媒体服务帐户名称由小写字母或数字构成(不含空格),长度为 3 到 24 个字符。A Media Services account name is all lowercase letters or numbers with no spaces, and is 3 to 24 characters in length.
    订阅Subscription 如果有多个订阅,请从有权访问的 Azure 订阅的列表中选择一个订阅。If you have more than one subscription, select one from the list of Azure subscriptions that you have access to.
    资源组Resource Group 选择新的或现有的资源。Select the new or existing resource. 资源组是共享生命周期、权限和策略的资源的集合。A resource group is a collection of resources that share lifecycle, permissions, and policies. 此处了解更多信息。Learn more here.
    位置Location 选择用于存储媒体服务帐户的媒体和元数据记录的地理区域。Select the geographic region that will be used to store the media and metadata records for your Media Services account. 此区域用于处理和流式传输媒体。This region will be used to process and stream your media. 下拉列表中仅显示可用的媒体服务区域。Only the available Media Services regions appear in the drop-down list box.
    存储帐户Storage Account 选择一个存储帐户,以便为媒体服务帐户中的媒体内容提供 Blob 存储。Select a storage account to provide blob storage of the media content from your Media Services account. 可以选择位于媒体服务帐户所在的地理区域内的现有存储帐户,也可以创建一个新的存储帐户。You can select an existing storage account in the same geographic region as your Media Services account, or you can create a new storage account. 在同一区域内会创建一个新的存储帐户。A new storage account is created in the same region. 适用于存储帐户名的规则对媒体服务帐户同样适用。The rules for storage account names are the same as for Media Services accounts.

    必须具有一个主存储帐户,并且可以拥有任意数量的与媒体服务帐户关联的辅助存储帐户 。You must have one Primary storage account and you can have any number of Secondary storage accounts associated with your Media Services account. 可以使用 Azure 门户来添加辅助存储帐户。You can use the Azure portal to add secondary storage accounts. 有关详细信息,请参阅 Azure 存储帐户与 Azure 媒体服务帐户For more information, see Azure Storage accounts with Azure Media Services accounts.

    媒体服务帐户和所有关联的存储帐户必须位于同一 Azure 订阅中。The Media Services account and all associated storage accounts must be in the same Azure subscription. 强烈建议在媒体服务帐户所在的位置使用存储帐户,避免额外的延迟和数据出口成本。It is strongly recommended to use storage accounts in the same location as the Media Services account to avoid additional latency and data egress costs.
  4. 选择“固定到仪表板”以查看帐户部署进度。Select Pin to dashboard to see the progress of the account deployment.

  5. 单击窗体底部的“创建”。Click Create at the bottom of the form.

    创建媒体服务帐户后,会将一个处于“已停止”状态的默认流式处理终结点添加到帐户。When your Media Services account is created a default streaming endpoint is added to your account in the Stopped state. 若要开始对内容进行流式处理并利用动态打包动态加密功能,必须确保要从其流式获取内容的流式处理终结点处于“正在运行”状态。To start streaming your content and take advantage of dynamic packaging and dynamic encryption, the streaming endpoint from which you want to stream content has to be in the Running state.

使用 Azure CLIUse the Azure CLI

如果没有 Azure 订阅,可在开始前创建一个试用帐户If you don't have an Azure subscription, create a trial account before you begin.

设置 Azure 订阅Set the Azure subscription

在以下命令中,为媒体服务帐户提供想要使用的 Azure 订阅 ID。In the following command, provide the Azure subscription ID that you want to use for the Media Services account. 导航到订阅即可查看有权访问的订阅列表。You can see a list of subscriptions that you have access to by navigating to Subscriptions.

az account set --subscription mySubscriptionId

创建资源组Create a resource group

使用以下命令创建资源组。Create a resource group using the following command. Azure 资源组是在其中部署和管理资源(例如 Azure 媒体服务帐户和关联的存储帐户)的逻辑容器。An Azure resource group is a logical container into which resources like Azure Media Services accounts and the associated Storage accounts are deployed and managed.

可以将 amsResourceGroup 替换为你的值。You can substitute amsResourceGroup with your value.

az group create --name amsResourceGroup --location chinaeast2

创建存储帐户Create a storage account

创建媒体服务帐户时,需要提供 Azure 存储帐户资源的名称。When creating a Media Services account, you need to supply the name of an Azure Storage account resource. 指定存储帐户会附加到媒体服务帐户。The specified storage account is attached to your Media Services account. 若要详细了解如何在媒体服务中使用存储帐户,请参阅存储帐户For more information about how storage accounts are used in Media Services, see Storage accounts.

必须具有一个主存储帐户,并且可以拥有任意数量的与媒体服务帐户关联的辅助存储帐户 。You must have one Primary storage account and you can have any number of Secondary storage accounts associated with your Media Services account. 媒体服务支持常规用途 v2 (GPv2) 或常规用途 v1 (GPv1) 帐户 。Media Services supports General-purpose v2 (GPv2) or General-purpose v1 (GPv1) accounts. 不允许将仅限 Blob 的帐户作为主帐户。Blob only accounts are not allowed as Primary. 若要了解存储帐户的详细信息,请参阅 Azure 存储帐户选项If you want to learn more about storage accounts, see Azure Storage account options.

在此示例中,我们创建一个常规用途 v2 标准 LRS 帐户。In this example, we create a General Purpose v2, Standard LRS account. 若要通过存储帐户进行试验,请使用 --sku Standard_LRSIf you want to experiment with storage accounts, use --sku Standard_LRS. 但是,在选取用于生产的 SKU 时,应考虑 --sku Standard_RAGRS,以便通过异地复制确保业务连续性。However, when picking a SKU for production you should consider, --sku Standard_RAGRS, which provides geographic replication for business continuity. 有关详细信息,请参阅存储帐户For more information, see storage accounts.

以下命令创建将与媒体服务帐户相关联的存储帐户。The following command creates a Storage account that is going to be associated with the Media Services account. 在以下脚本中,可以将 storageaccountforams 替换为你的值。In the script below, you can substitute storageaccountforams with your value. amsResourceGroup 必须与在上一步中为资源组指定的值匹配。amsResourceGroup must match the value you gave for the resource group in the previous step. 存储帐户名称的长度必须小于 24。The storage account name must have length less than 24.

az storage account create --name storageaccountforams \  
  --kind StorageV2 \
  --sku Standard_LRS \
  -l chinaeast2 \
  -g amsResourceGroup

创建媒体服务帐户Create a Media Services account

以下 Azure CLI 命令创建新的媒体服务帐户。The following Azure CLI command creates a new Media Services account. 可以替换以下值:amsaccount``storageaccountforams(必须与提供给存储帐户的值相符)和 amsResourceGroup(必须与提供给资源组的值相符)。You can replace the following values: amsaccount storageaccountforams (must match the value you gave for your storage account), and amsResourceGroup (must match the value you gave for the resource group).

az ams account create --name amsaccount \
   -g amsResourceGroup --storage-account storageaccountforams \
   -l chinaeast2 

另请参阅See also


后续步骤Next steps

流式传输文件Stream a file