基于内容保护方案的迁移指南Content protection scenario-based migration guidance

迁移指南徽标


迁移步骤 2

本文提供了有关将内容保护用例从 v2 API 迁移到新的 Azure 媒体服务 v3 API 的详细信息和指南。This article provides you with details and guidance on the migration of content protection use cases from the v2 API to the new Azure Media Services v3 API.

v3 API 中的保护内容Protect content in v3 API

在新的 v3 API 中使用对 Multi-key 功能的支持。Use the support for Multi-key features in the new v3 API.

有关具体步骤,请参阅以下内容保护概念、教程和操作指南。See content protection concepts, tutorials and how to guides below for specific steps.

v2 Assets、StreamingLocators 等属性在 v3 API 中的可见性(适用于内容保护场景)Visibility of v2 Assets, StreamingLocators, and properties in the v3 API for content protection scenarios

在迁移到 v3 API 的过程中,你会发现需要访问 v2 资产中的某些属性或内容密钥。During migration to the v3 API, you will find that you need to access some properties or content keys from your v2 Assets. 一个关键区别在于,v2 API 会使用 AssetId 作为主标识密钥,而新的 v3 API 则使用实体的 Azure 资源管理名称作为主要标识符。One key difference is that the v2 API would use the AssetId as the primary identification key and the new v3 API uses the Azure Resource Management name of the entity as the primary identifier. v2 Asset.Name 属性通常不用作唯一标识符,因此,在迁移到 v3 时,你会发现 v2 资产名称现在显示在 Asset.Description 字段中 。The v2 Asset.Name property is not typically used as a unique identifier, so when migrating to v3 you will find that your v2 Asset names now appear in the Asset.Description field.

例如,如果之前有一个 ID 为“nb:cid:UUID:8cb39104-122c-496e-9ac5-7f9e2c2547b8”的 v2 资产,那么你会发现通过 v3 API 列出旧 v2 资产时,此名称现在是结尾的 GUID 部分(在本例中为“8cb39104-122c-496e-9ac5-7f9e2c2547b8”。 )For example, if you previously had a v2 Asset with the ID of "nb:cid:UUID:8cb39104-122c-496e-9ac5-7f9e2c2547b8", then you will find when listing the old v2 assets through the v3 API, the name will now be the GUID part at the end (in this case, "8cb39104-122c-496e-9ac5-7f9e2c2547b8".)

你可以使用资产实体上的新 v3 方法 ListStreamingLocators 查询与 v2 API 中创建的资产关联的 StreamingLocators。You can query the StreamingLocators associated with the Assets created in the v2 API using the new v3 method ListStreamingLocators on the Asset entity. 同时引用 ListStreamingLocatorsAsync 的 .NET 客户端 SDK 版本Also reference the .NET client SDK version of ListStreamingLocatorsAsync

ListStreamingLocators 方法的结果将为你提供定位器的名称和 StreamingLocatorId 以及 StreamingPolicyName 。The results of the ListStreamingLocators method will provide you the Name and StreamingLocatorId of the locator along with the StreamingPolicyName.

若要查找 StreamingLocators 中用于内容保护的 ContentKey,可以调用 StreamingLocator.ListContentKeysAsync 方法 。To find the ContentKeys used in your StreamingLocators for content protection, you can call the StreamingLocator.ListContentKeysAsync method.

对于任何使用 v2 API 创建并发布的资产,在 v3 API 中将为其定义内容密钥策略和内容密钥,而不是使用流式处理策略上的默认内容密钥策略。Any Assets that were created and published using the v2 API will have both a Content Key Policy and a Content Key defined on them in the v3 API, instead of using a default content key policy on the Streaming Policy.

有关 v3 API 内容保护的详细信息,请参阅使用媒体服务动态加密保护内容一文。For more information on content protection in the v3 API, see the article Protect your content with Media Services dynamic encryption.

如何使用 v3 API 列出 v2 资产和内容保护设置How to list your v2 Assets and content protection settings using the v3 API

在 v2 API 中,通常会使用“Assets”、“StreamingLocators”和“ContentKeys”来保护流式处理内容 。In the v2 API, you would commonly use Assets, StreamingLocators, and ContentKeys to protect your streaming content. 迁移到 v3 API 时,v2 API Assets、StreamingLocators 和 ContentKey 都将在 v3 API 中自动公开,你可以访问其中的所有数据。When migrating to the v3 API, your v2 API Assets, StreamingLocators, and ContentKeys are all exposed automatically in the v3 API and all of the data on them is available for you to access.

能否使用 v3 API 更新 v2 属性?Can I update v2 properties using the v3 API?

不可以,不能通过使用 v2 中的 StreamingLocators、StreamingPolicies、内容密钥策略和内容密钥创建的 v3 API 来更新 v2 实体上的任何属性。No, you cannot update any properties on v2 entities through the v3 API that were created using StreamingLocators, StreamingPolicies, Content Key Policies, and Content Keys in v2. 如果需要更新、改变或更改存储在 v2 实体上的内容,则需要通过 v2 API 对其进行更新,或创建新的 v3 API 实体以将其迁移。If you need to update, change or alter content stored on v2 entities, you will need to update it via the v2 API or create new v3 API entities to migrate them forward.

如何更改用于已发布的 v2 资产的 ContentKeyPolicy 并保持相同的内容密钥?How do I change the ContentKeyPolicy used for a v2 Asset that is published and keep the same content key?

在这种情况下,你应该首先通过 v2 SDK(删除定位符、取消链接内容密钥授权策略、取消链接资产传送策略、取消链接内容密钥、删除内容密钥)在资产上取消发布(删除所有流式处理定位符),然后使用 v3 StreamingPolicyContentKeyPolicy 在 v3 中创建一个新的 StreamingLocatorIn this situation, you should first unpublish (remove all Streaming Locators) on the Asset via the v2 SDK (delete the locator, unlink the Content Key Authorization Policy, unlink the Asset Delivery Policy, unlink the Content Key, delete the Content Key) then create a new StreamingLocator in v3 using a v3 StreamingPolicy and ContentKeyPolicy.

你需要指定在创建 StreamingLocator 时所需的特定内容密钥标识符和密钥值。You would need to specify the specific content key identifier and key value needed when you are creating the StreamingLocator.

请注意,可以使用 v3 API 删除 v2 定位符,但这不会删除在 v2 API 中使用的内容密钥或内容密钥策略(如果创建)。Note that it is possible to delete the v2 locator using the v3 API, but this will not remove the content key or the content key policy used if they were created in the v2 API.

并行使用 AMSE v2 和 AMSE v3Using AMSE v2 and AMSE v3 side by side

将内容从 v2 迁移到 v3 时,建议安装 v2 Azure 媒体服务资源管理器工具,以及 v3 Azure 媒体服务资源管理器工具,以帮助比较通过 v2 API 创建和发布的资产并排显示的数据。When migrating your content from v2 to v3, it is advised to install the v2 Azure Media Services Explorer tool along with the v3 Azure Media Services Explorer tool to help compare the data that they show side by side for an Asset that is created and published via v2 APIs. 所有属性都应该是可见的,但目前在略微不同的位置。The properties should all be visible, but in slightly different locations now.

内容保护概念、教程和操作指南Content protection concepts, tutorials and how to guides

概念Concepts

教程Tutorials

快速入门:使用门户加密内容Quickstart: Use portal to encrypt content

操作方法指南How to guides

示例Samples

还可将代码示例中的 V2 和 V3 代码进行比较You can also compare the V2 and V3 code in the code samples.

工具Tools