Crear o actualizar una directiva de clave de contenido
Crear o actualizar una directiva de clave de contenido en la cuenta de Media Services
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}?api-version=2022-08-01
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
accountName
|
path |
True
|
string
|
Nombre de la cuenta de Media Services.
|
contentKeyPolicyName
|
path |
True
|
string
|
Nombre de la directiva de clave de contenido.
|
resourceGroupName
|
path |
True
|
string
|
Nombre del grupo de recursos dentro de la suscripción de Azure.
|
subscriptionId
|
path |
True
|
string
|
Identificador único de una suscripción de Microsoft Azure.
|
api-version
|
query |
True
|
string
|
Versión de la API que se va a usar con la solicitud de cliente.
|
Cuerpo de la solicitud
Nombre |
Requerido |
Tipo |
Description |
properties.options
|
True
|
ContentKeyPolicyOption[]
|
Opciones de la directiva de clave.
|
properties.description
|
|
string
|
Descripción de la directiva.
|
Respuestas
Ejemplos
Creates a Content Key Policy with ClearKey option and Token Restriction
Solicitud de ejemplo
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/contentKeyPolicies/PolicyWithClearKeyOptionAndSwtTokenRestriction?api-version=2022-08-01
{
"properties": {
"description": "ArmPolicyDescription",
"options": [
{
"name": "ClearKeyOption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": "AAAAAAAAAAAAAAAAAAAAAA=="
},
"restrictionTokenType": "Swt"
}
}
]
}
}
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyClearKeyConfiguration;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyOption;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyRestrictionTokenType;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicySymmetricTokenKey;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyTokenRestriction;
import java.util.Arrays;
/**
* Samples for ContentKeyPolicies CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-
* policies-create-nodrm-token.json
*/
/**
* Sample code: Creates a Content Key Policy with ClearKey option and Token Restriction.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void createsAContentKeyPolicyWithClearKeyOptionAndTokenRestriction(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager.contentKeyPolicies().define("PolicyWithClearKeyOptionAndSwtTokenRestriction")
.withExistingMediaService("contosorg", "contosomedia").withDescription("ArmPolicyDescription")
.withOptions(
Arrays.asList(new ContentKeyPolicyOption().withName("ClearKeyOption")
.withConfiguration(new ContentKeyPolicyClearKeyConfiguration())
.withRestriction(new ContentKeyPolicyTokenRestriction().withIssuer("urn:issuer")
.withAudience("urn:audience")
.withPrimaryVerificationKey(
new ContentKeyPolicySymmetricTokenKey().withKeyValue("AAAAAAAAAAAAAAAAAAAAAA==".getBytes()))
.withRestrictionTokenType(ContentKeyPolicyRestrictionTokenType.SWT))))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.media import AzureMediaServices
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-media
# USAGE
python contentkeypoliciescreatenodrmtoken.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = AzureMediaServices(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_key_policies.create_or_update(
resource_group_name="contoso",
account_name="contosomedia",
content_key_policy_name="PolicyWithClearKeyOptionAndSwtTokenRestriction",
parameters={
"properties": {
"description": "ArmPolicyDescription",
"options": [
{
"configuration": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"},
"name": "ClearKeyOption",
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"audience": "urn:audience",
"issuer": "urn:issuer",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": "AAAAAAAAAAAAAAAAAAAAAA==",
},
"restrictionTokenType": "Swt",
},
}
],
}
},
)
print(response)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-nodrm-token.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmediaservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-nodrm-token.json
func ExampleContentKeyPoliciesClient_CreateOrUpdate_createsAContentKeyPolicyWithClearKeyOptionAndTokenRestriction() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmediaservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewContentKeyPoliciesClient().CreateOrUpdate(ctx, "contoso", "contosomedia", "PolicyWithClearKeyOptionAndSwtTokenRestriction", armmediaservices.ContentKeyPolicy{
Properties: &armmediaservices.ContentKeyPolicyProperties{
Description: to.Ptr("ArmPolicyDescription"),
Options: []*armmediaservices.ContentKeyPolicyOption{
{
Name: to.Ptr("ClearKeyOption"),
Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"),
},
Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
Audience: to.Ptr("urn:audience"),
Issuer: to.Ptr("urn:issuer"),
PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
KeyValue: []byte("AAAAAAAAAAAAAAAAAAAAAA=="),
},
RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeSwt),
},
}},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ContentKeyPolicy = armmediaservices.ContentKeyPolicy{
// Name: to.Ptr("PolicyWithClearKeyOptionAndSwtTokenRestriction"),
// Type: to.Ptr("Microsoft.Media/mediaservices/contentKeyPolicies"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithClearKeyOptionAndSwtTokenRestriction"),
// Properties: &armmediaservices.ContentKeyPolicyProperties{
// Description: to.Ptr("ArmPolicyDescription"),
// Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-08T18:29:29.837Z"); return t}()),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-08T18:29:29.837Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Name: to.Ptr("ClearKeyOption"),
// Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"),
// },
// PolicyOptionID: to.Ptr("e7d4d465-b6f7-4830-9a21-74a7326ef797"),
// Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
// AlternateVerificationKeys: []armmediaservices.ContentKeyPolicyRestrictionTokenKeyClassification{
// },
// Audience: to.Ptr("urn:audience"),
// Issuer: to.Ptr("urn:issuer"),
// PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
// KeyValue: []byte(""),
// },
// RequiredClaims: []*armmediaservices.ContentKeyPolicyTokenClaim{
// },
// RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeSwt),
// },
// }},
// PolicyID: to.Ptr("2926c1bc-4dec-4a11-9d19-3f99006530a9"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureMediaServices } = require("@azure/arm-mediaservices");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Content Key Policy in the Media Services account
*
* @summary Create or update a Content Key Policy in the Media Services account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-nodrm-token.json
*/
async function createsAContentKeyPolicyWithClearKeyOptionAndTokenRestriction() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const contentKeyPolicyName = "PolicyWithClearKeyOptionAndSwtTokenRestriction";
const parameters = {
description: "ArmPolicyDescription",
options: [
{
name: "ClearKeyOption",
configuration: {
odataType: "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration",
},
restriction: {
odataType: "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
audience: "urn:audience",
issuer: "urn:issuer",
primaryVerificationKey: {
odataType: "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
keyValue: Buffer.from("AAAAAAAAAAAAAAAAAAAAAA=="),
},
restrictionTokenType: "Swt",
},
},
],
};
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const result = await client.contentKeyPolicies.createOrUpdate(
resourceGroupName,
accountName,
contentKeyPolicyName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Media;
using Azure.ResourceManager.Media.Models;
// Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-nodrm-token.json
// this example is just showing the usage of "ContentKeyPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this MediaServicesAccountResource created on azure
// for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "contoso";
string accountName = "contosomedia";
ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId);
// get the collection of this ContentKeyPolicyResource
ContentKeyPolicyCollection collection = mediaServicesAccount.GetContentKeyPolicies();
// invoke the operation
string contentKeyPolicyName = "PolicyWithClearKeyOptionAndSwtTokenRestriction";
ContentKeyPolicyData data = new ContentKeyPolicyData()
{
Description = "ArmPolicyDescription",
Options =
{
new ContentKeyPolicyOption(new ContentKeyPolicyClearKeyConfiguration(),new ContentKeyPolicyTokenRestriction("urn:issuer","urn:audience",new ContentKeyPolicySymmetricTokenKey(Convert.FromBase64String("AAAAAAAAAAAAAAAAAAAAAA==")),ContentKeyPolicyRestrictionTokenType.Swt))
{
Name = "ClearKeyOption",
}
},
};
ArmOperation<ContentKeyPolicyResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, contentKeyPolicyName, data);
ContentKeyPolicyResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContentKeyPolicyData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "PolicyWithClearKeyOptionAndSwtTokenRestriction",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithClearKeyOptionAndSwtTokenRestriction",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "2926c1bc-4dec-4a11-9d19-3f99006530a9",
"created": "2018-08-08T18:29:29.837Z",
"lastModified": "2018-08-08T18:29:29.837Z",
"description": "ArmPolicyDescription",
"options": [
{
"policyOptionId": "e7d4d465-b6f7-4830-9a21-74a7326ef797",
"name": "ClearKeyOption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
},
"alternateVerificationKeys": [],
"requiredClaims": [],
"restrictionTokenType": "Swt"
}
}
]
}
}
{
"name": "PolicyWithClearKeyOptionAndSwtTokenRestriction",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithClearKeyOptionAndSwtTokenRestriction",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "2926c1bc-4dec-4a11-9d19-3f99006530a9",
"created": "2018-08-08T18:29:29.837Z",
"lastModified": "2018-08-08T18:29:29.837Z",
"description": "ArmPolicyDescription",
"options": [
{
"policyOptionId": "e7d4d465-b6f7-4830-9a21-74a7326ef797",
"name": "ClearKeyOption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
},
"alternateVerificationKeys": [],
"requiredClaims": [],
"restrictionTokenType": "Swt"
}
}
]
}
}
Creates a Content Key Policy with multiple options
Solicitud de ejemplo
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/contentKeyPolicies/PolicyCreatedWithMultipleOptions?api-version=2022-08-01
{
"properties": {
"description": "ArmPolicyDescription",
"options": [
{
"name": "ClearKeyOption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": "AAAAAAAAAAAAAAAAAAAAAA=="
},
"restrictionTokenType": "Swt"
}
},
{
"name": "widevineoption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
"widevineTemplate": "{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"
}
}
]
}
}
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyClearKeyConfiguration;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyOpenRestriction;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyOption;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyRestrictionTokenType;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicySymmetricTokenKey;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyTokenRestriction;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyWidevineConfiguration;
import java.util.Arrays;
/**
* Samples for ContentKeyPolicies CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-
* policies-create-multiple-options.json
*/
/**
* Sample code: Creates a Content Key Policy with multiple options.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void createsAContentKeyPolicyWithMultipleOptions(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager.contentKeyPolicies().define("PolicyCreatedWithMultipleOptions")
.withExistingMediaService("contosorg", "contosomedia").withDescription("ArmPolicyDescription")
.withOptions(
Arrays.asList(
new ContentKeyPolicyOption().withName("ClearKeyOption")
.withConfiguration(new ContentKeyPolicyClearKeyConfiguration()).withRestriction(
new ContentKeyPolicyTokenRestriction()
.withIssuer("urn:issuer").withAudience("urn:audience")
.withPrimaryVerificationKey(new ContentKeyPolicySymmetricTokenKey().withKeyValue(
"AAAAAAAAAAAAAAAAAAAAAA==".getBytes()))
.withRestrictionTokenType(ContentKeyPolicyRestrictionTokenType.SWT)),
new ContentKeyPolicyOption().withName("widevineoption")
.withConfiguration(new ContentKeyPolicyWidevineConfiguration().withWidevineTemplate(
"{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"))
.withRestriction(new ContentKeyPolicyOpenRestriction())))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.media import AzureMediaServices
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-media
# USAGE
python contentkeypoliciescreatemultipleoptions.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = AzureMediaServices(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_key_policies.create_or_update(
resource_group_name="contoso",
account_name="contosomedia",
content_key_policy_name="PolicyCreatedWithMultipleOptions",
parameters={
"properties": {
"description": "ArmPolicyDescription",
"options": [
{
"configuration": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"},
"name": "ClearKeyOption",
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"audience": "urn:audience",
"issuer": "urn:issuer",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": "AAAAAAAAAAAAAAAAAAAAAA==",
},
"restrictionTokenType": "Swt",
},
},
{
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
"widevineTemplate": '{"allowed_track_types":"SD_HD","content_key_specs":[{"track_type":"SD","security_level":1,"required_output_protection":{"hdcp":"HDCP_V2"}}],"policy_overrides":{"can_play":true,"can_persist":true,"can_renew":false}}',
},
"name": "widevineoption",
"restriction": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"},
},
],
}
},
)
print(response)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-multiple-options.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmediaservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-multiple-options.json
func ExampleContentKeyPoliciesClient_CreateOrUpdate_createsAContentKeyPolicyWithMultipleOptions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmediaservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewContentKeyPoliciesClient().CreateOrUpdate(ctx, "contoso", "contosomedia", "PolicyCreatedWithMultipleOptions", armmediaservices.ContentKeyPolicy{
Properties: &armmediaservices.ContentKeyPolicyProperties{
Description: to.Ptr("ArmPolicyDescription"),
Options: []*armmediaservices.ContentKeyPolicyOption{
{
Name: to.Ptr("ClearKeyOption"),
Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"),
},
Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
Audience: to.Ptr("urn:audience"),
Issuer: to.Ptr("urn:issuer"),
PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
KeyValue: []byte("AAAAAAAAAAAAAAAAAAAAAA=="),
},
RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeSwt),
},
},
{
Name: to.Ptr("widevineoption"),
Configuration: &armmediaservices.ContentKeyPolicyWidevineConfiguration{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyWidevineConfiguration"),
WidevineTemplate: to.Ptr("{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"),
},
Restriction: &armmediaservices.ContentKeyPolicyOpenRestriction{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyOpenRestriction"),
},
}},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ContentKeyPolicy = armmediaservices.ContentKeyPolicy{
// Name: to.Ptr("PolicyCreatedWithMultipleOptions"),
// Type: to.Ptr("Microsoft.Media/mediaservices/contentKeyPolicies"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyCreatedWithMultipleOptions"),
// Properties: &armmediaservices.ContentKeyPolicyProperties{
// Description: to.Ptr("ArmPolicyDescription"),
// Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-08T18:29:29.980Z"); return t}()),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-08T18:29:29.980Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Name: to.Ptr("ClearKeyOption"),
// Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"),
// },
// PolicyOptionID: to.Ptr("8dac9510-770a-401f-8f2b-f72640977ed0"),
// Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
// AlternateVerificationKeys: []armmediaservices.ContentKeyPolicyRestrictionTokenKeyClassification{
// },
// Audience: to.Ptr("urn:audience"),
// Issuer: to.Ptr("urn:issuer"),
// PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
// KeyValue: []byte(""),
// },
// RequiredClaims: []*armmediaservices.ContentKeyPolicyTokenClaim{
// },
// RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeSwt),
// },
// },
// {
// Name: to.Ptr("widevineoption"),
// Configuration: &armmediaservices.ContentKeyPolicyWidevineConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyWidevineConfiguration"),
// WidevineTemplate: to.Ptr("{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"),
// },
// PolicyOptionID: to.Ptr("fc121776-6ced-4135-be92-f928dedc029a"),
// Restriction: &armmediaservices.ContentKeyPolicyOpenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyOpenRestriction"),
// },
// }},
// PolicyID: to.Ptr("07ad673b-dc14-4230-adab-716622f33992"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureMediaServices } = require("@azure/arm-mediaservices");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Content Key Policy in the Media Services account
*
* @summary Create or update a Content Key Policy in the Media Services account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-multiple-options.json
*/
async function createsAContentKeyPolicyWithMultipleOptions() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const contentKeyPolicyName = "PolicyCreatedWithMultipleOptions";
const parameters = {
description: "ArmPolicyDescription",
options: [
{
name: "ClearKeyOption",
configuration: {
odataType: "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration",
},
restriction: {
odataType: "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
audience: "urn:audience",
issuer: "urn:issuer",
primaryVerificationKey: {
odataType: "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
keyValue: Buffer.from("AAAAAAAAAAAAAAAAAAAAAA=="),
},
restrictionTokenType: "Swt",
},
},
{
name: "widevineoption",
configuration: {
odataType: "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
widevineTemplate:
'{"allowed_track_types":"SD_HD","content_key_specs":[{"track_type":"SD","security_level":1,"required_output_protection":{"hdcp":"HDCP_V2"}}],"policy_overrides":{"can_play":true,"can_persist":true,"can_renew":false}}',
},
restriction: {
odataType: "#Microsoft.Media.ContentKeyPolicyOpenRestriction",
},
},
],
};
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const result = await client.contentKeyPolicies.createOrUpdate(
resourceGroupName,
accountName,
contentKeyPolicyName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Media;
using Azure.ResourceManager.Media.Models;
// Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-multiple-options.json
// this example is just showing the usage of "ContentKeyPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this MediaServicesAccountResource created on azure
// for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "contoso";
string accountName = "contosomedia";
ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId);
// get the collection of this ContentKeyPolicyResource
ContentKeyPolicyCollection collection = mediaServicesAccount.GetContentKeyPolicies();
// invoke the operation
string contentKeyPolicyName = "PolicyCreatedWithMultipleOptions";
ContentKeyPolicyData data = new ContentKeyPolicyData()
{
Description = "ArmPolicyDescription",
Options =
{
new ContentKeyPolicyOption(new ContentKeyPolicyClearKeyConfiguration(),new ContentKeyPolicyTokenRestriction("urn:issuer","urn:audience",new ContentKeyPolicySymmetricTokenKey(Convert.FromBase64String("AAAAAAAAAAAAAAAAAAAAAA==")),ContentKeyPolicyRestrictionTokenType.Swt))
{
Name = "ClearKeyOption",
},new ContentKeyPolicyOption(new ContentKeyPolicyWidevineConfiguration("{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"),new ContentKeyPolicyOpenRestriction())
{
Name = "widevineoption",
}
},
};
ArmOperation<ContentKeyPolicyResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, contentKeyPolicyName, data);
ContentKeyPolicyResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContentKeyPolicyData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "PolicyCreatedWithMultipleOptions",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyCreatedWithMultipleOptions",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "07ad673b-dc14-4230-adab-716622f33992",
"created": "2018-08-08T18:29:29.98Z",
"lastModified": "2018-08-08T18:29:29.98Z",
"description": "ArmPolicyDescription",
"options": [
{
"policyOptionId": "8dac9510-770a-401f-8f2b-f72640977ed0",
"name": "ClearKeyOption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
},
"alternateVerificationKeys": [],
"requiredClaims": [],
"restrictionTokenType": "Swt"
}
},
{
"policyOptionId": "fc121776-6ced-4135-be92-f928dedc029a",
"name": "widevineoption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
"widevineTemplate": "{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"
}
}
]
}
}
{
"name": "PolicyCreatedWithMultipleOptions",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyCreatedWithMultipleOptions",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "07ad673b-dc14-4230-adab-716622f33992",
"created": "2018-08-08T18:29:29.98Z",
"lastModified": "2018-08-08T18:29:29.98Z",
"description": "ArmPolicyDescription",
"options": [
{
"policyOptionId": "8dac9510-770a-401f-8f2b-f72640977ed0",
"name": "ClearKeyOption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
},
"alternateVerificationKeys": [],
"requiredClaims": [],
"restrictionTokenType": "Swt"
}
},
{
"policyOptionId": "fc121776-6ced-4135-be92-f928dedc029a",
"name": "widevineoption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
"widevineTemplate": "{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"
}
}
]
}
}
Creates a Content Key Policy with PlayReady option and Open Restriction
Solicitud de ejemplo
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/contentKeyPolicies/PolicyWithPlayReadyOptionAndOpenRestriction?api-version=2022-08-01
{
"properties": {
"description": "ArmPolicyDescription",
"options": [
{
"name": "ArmPolicyOptionName",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration",
"licenses": [
{
"allowTestDevices": true,
"securityLevel": "SL150",
"beginDate": "2017-10-16T18:22:53.46Z",
"playRight": {
"scmsRestriction": 2,
"digitalVideoOnlyContentRestriction": false,
"imageConstraintForAnalogComponentVideoRestriction": true,
"imageConstraintForAnalogComputerMonitorRestriction": false,
"allowPassingVideoContentToUnknownOutput": "NotAllowed"
},
"licenseType": "Persistent",
"contentKeyLocation": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"
},
"contentType": "UltraVioletDownload"
}
]
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"
}
}
]
}
}
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyOpenRestriction;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyOption;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyPlayReadyConfiguration;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyPlayReadyContentType;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyPlayReadyLicense;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyPlayReadyLicenseType;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyPlayReadyPlayRight;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyPlayReadyUnknownOutputPassingOption;
import com.azure.resourcemanager.mediaservices.models.SecurityLevel;
import java.time.OffsetDateTime;
import java.util.Arrays;
/**
* Samples for ContentKeyPolicies CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-
* policies-create-playready-open.json
*/
/**
* Sample code: Creates a Content Key Policy with PlayReady option and Open Restriction.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void createsAContentKeyPolicyWithPlayReadyOptionAndOpenRestriction(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager.contentKeyPolicies().define("PolicyWithPlayReadyOptionAndOpenRestriction")
.withExistingMediaService("contosorg", "contosomedia").withDescription("ArmPolicyDescription")
.withOptions(Arrays.asList(new ContentKeyPolicyOption().withName("ArmPolicyOptionName")
.withConfiguration(new ContentKeyPolicyPlayReadyConfiguration()
.withLicenses(Arrays.asList(new ContentKeyPolicyPlayReadyLicense().withAllowTestDevices(true)
.withSecurityLevel(SecurityLevel.SL150)
.withBeginDate(OffsetDateTime.parse("2017-10-16T18:22:53.46Z"))
.withPlayRight(new ContentKeyPolicyPlayReadyPlayRight().withScmsRestriction(2)
.withDigitalVideoOnlyContentRestriction(false)
.withImageConstraintForAnalogComponentVideoRestriction(true)
.withImageConstraintForAnalogComputerMonitorRestriction(false)
.withAllowPassingVideoContentToUnknownOutput(
ContentKeyPolicyPlayReadyUnknownOutputPassingOption.NOT_ALLOWED))
.withLicenseType(ContentKeyPolicyPlayReadyLicenseType.PERSISTENT)
.withContentKeyLocation(new ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader())
.withContentType(ContentKeyPolicyPlayReadyContentType.ULTRA_VIOLET_DOWNLOAD))))
.withRestriction(new ContentKeyPolicyOpenRestriction())))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.media import AzureMediaServices
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-media
# USAGE
python contentkeypoliciescreateplayreadyopen.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = AzureMediaServices(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_key_policies.create_or_update(
resource_group_name="contoso",
account_name="contosomedia",
content_key_policy_name="PolicyWithPlayReadyOptionAndOpenRestriction",
parameters={
"properties": {
"description": "ArmPolicyDescription",
"options": [
{
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration",
"licenses": [
{
"allowTestDevices": True,
"beginDate": "2017-10-16T18:22:53.46Z",
"contentKeyLocation": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"
},
"contentType": "UltraVioletDownload",
"licenseType": "Persistent",
"playRight": {
"allowPassingVideoContentToUnknownOutput": "NotAllowed",
"digitalVideoOnlyContentRestriction": False,
"imageConstraintForAnalogComponentVideoRestriction": True,
"imageConstraintForAnalogComputerMonitorRestriction": False,
"scmsRestriction": 2,
},
"securityLevel": "SL150",
}
],
},
"name": "ArmPolicyOptionName",
"restriction": {"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"},
}
],
}
},
)
print(response)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-playready-open.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmediaservices_test
import (
"context"
"log"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-playready-open.json
func ExampleContentKeyPoliciesClient_CreateOrUpdate_createsAContentKeyPolicyWithPlayReadyOptionAndOpenRestriction() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmediaservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewContentKeyPoliciesClient().CreateOrUpdate(ctx, "contoso", "contosomedia", "PolicyWithPlayReadyOptionAndOpenRestriction", armmediaservices.ContentKeyPolicy{
Properties: &armmediaservices.ContentKeyPolicyProperties{
Description: to.Ptr("ArmPolicyDescription"),
Options: []*armmediaservices.ContentKeyPolicyOption{
{
Name: to.Ptr("ArmPolicyOptionName"),
Configuration: &armmediaservices.ContentKeyPolicyPlayReadyConfiguration{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration"),
Licenses: []*armmediaservices.ContentKeyPolicyPlayReadyLicense{
{
AllowTestDevices: to.Ptr(true),
BeginDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-16T18:22:53.460Z"); return t }()),
ContentKeyLocation: &armmediaservices.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"),
},
ContentType: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload),
LicenseType: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyLicenseTypePersistent),
PlayRight: &armmediaservices.ContentKeyPolicyPlayReadyPlayRight{
AllowPassingVideoContentToUnknownOutput: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed),
DigitalVideoOnlyContentRestriction: to.Ptr(false),
ImageConstraintForAnalogComponentVideoRestriction: to.Ptr(true),
ImageConstraintForAnalogComputerMonitorRestriction: to.Ptr(false),
ScmsRestriction: to.Ptr[int32](2),
},
SecurityLevel: to.Ptr(armmediaservices.SecurityLevelSL150),
}},
},
Restriction: &armmediaservices.ContentKeyPolicyOpenRestriction{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyOpenRestriction"),
},
}},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ContentKeyPolicy = armmediaservices.ContentKeyPolicy{
// Name: to.Ptr("PolicyWithPlayReadyOptionAndOpenRestriction"),
// Type: to.Ptr("Microsoft.Media/mediaservices/contentKeyPolicies"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithPlayReadyOptionAndOpenRestriction"),
// Properties: &armmediaservices.ContentKeyPolicyProperties{
// Description: to.Ptr("ArmPolicyDescription"),
// Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2012-11-01T00:00:00.000Z"); return t}()),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-08T18:29:29.510Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Name: to.Ptr("ArmPolicyOptionName"),
// Configuration: &armmediaservices.ContentKeyPolicyPlayReadyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration"),
// Licenses: []*armmediaservices.ContentKeyPolicyPlayReadyLicense{
// {
// AllowTestDevices: to.Ptr(true),
// BeginDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-10-16T18:22:53.460Z"); return t}()),
// ContentKeyLocation: &armmediaservices.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"),
// },
// ContentType: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyContentTypeUltraVioletDownload),
// LicenseType: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyLicenseTypePersistent),
// PlayRight: &armmediaservices.ContentKeyPolicyPlayReadyPlayRight{
// AllowPassingVideoContentToUnknownOutput: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed),
// DigitalVideoOnlyContentRestriction: to.Ptr(false),
// ImageConstraintForAnalogComponentVideoRestriction: to.Ptr(true),
// ImageConstraintForAnalogComputerMonitorRestriction: to.Ptr(false),
// ScmsRestriction: to.Ptr[int32](2),
// },
// SecurityLevel: to.Ptr(armmediaservices.SecurityLevelSL150),
// }},
// },
// PolicyOptionID: to.Ptr("c52f9af0-1f53-4775-8edb-af2d9a6e28cd"),
// Restriction: &armmediaservices.ContentKeyPolicyOpenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyOpenRestriction"),
// },
// }},
// PolicyID: to.Ptr("a9bacd1d-60f5-4af3-8d2b-cf46ca5c9b04"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureMediaServices } = require("@azure/arm-mediaservices");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Content Key Policy in the Media Services account
*
* @summary Create or update a Content Key Policy in the Media Services account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-playready-open.json
*/
async function createsAContentKeyPolicyWithPlayReadyOptionAndOpenRestriction() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const contentKeyPolicyName = "PolicyWithPlayReadyOptionAndOpenRestriction";
const parameters = {
description: "ArmPolicyDescription",
options: [
{
name: "ArmPolicyOptionName",
configuration: {
odataType: "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration",
licenses: [
{
allowTestDevices: true,
beginDate: new Date("2017-10-16T18:22:53.46Z"),
contentKeyLocation: {
odataType:
"#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader",
},
contentType: "UltraVioletDownload",
licenseType: "Persistent",
playRight: {
allowPassingVideoContentToUnknownOutput: "NotAllowed",
digitalVideoOnlyContentRestriction: false,
imageConstraintForAnalogComponentVideoRestriction: true,
imageConstraintForAnalogComputerMonitorRestriction: false,
scmsRestriction: 2,
},
securityLevel: "SL150",
},
],
},
restriction: {
odataType: "#Microsoft.Media.ContentKeyPolicyOpenRestriction",
},
},
],
};
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const result = await client.contentKeyPolicies.createOrUpdate(
resourceGroupName,
accountName,
contentKeyPolicyName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Media;
using Azure.ResourceManager.Media.Models;
// Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-playready-open.json
// this example is just showing the usage of "ContentKeyPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this MediaServicesAccountResource created on azure
// for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "contoso";
string accountName = "contosomedia";
ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId);
// get the collection of this ContentKeyPolicyResource
ContentKeyPolicyCollection collection = mediaServicesAccount.GetContentKeyPolicies();
// invoke the operation
string contentKeyPolicyName = "PolicyWithPlayReadyOptionAndOpenRestriction";
ContentKeyPolicyData data = new ContentKeyPolicyData()
{
Description = "ArmPolicyDescription",
Options =
{
new ContentKeyPolicyOption(new ContentKeyPolicyPlayReadyConfiguration(new ContentKeyPolicyPlayReadyLicense[]
{
new ContentKeyPolicyPlayReadyLicense(true,ContentKeyPolicyPlayReadyLicenseType.Persistent,new ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader(),ContentKeyPolicyPlayReadyContentType.UltraVioletDownload)
{
SecurityLevel = PlayReadySecurityLevel.SL150,
BeginOn = DateTimeOffset.Parse("2017-10-16T18:22:53.46Z"),
PlayRight = new ContentKeyPolicyPlayReadyPlayRight(false,true,false,ContentKeyPolicyPlayReadyUnknownOutputPassingOption.NotAllowed)
{
ScmsRestriction = 2,
},
}
}),new ContentKeyPolicyOpenRestriction())
{
Name = "ArmPolicyOptionName",
}
},
};
ArmOperation<ContentKeyPolicyResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, contentKeyPolicyName, data);
ContentKeyPolicyResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContentKeyPolicyData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "PolicyWithPlayReadyOptionAndOpenRestriction",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithPlayReadyOptionAndOpenRestriction",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "a9bacd1d-60f5-4af3-8d2b-cf46ca5c9b04",
"created": "2012-11-01T00:00:00Z",
"lastModified": "2018-08-08T18:29:29.51Z",
"description": "ArmPolicyDescription",
"options": [
{
"policyOptionId": "c52f9af0-1f53-4775-8edb-af2d9a6e28cd",
"name": "ArmPolicyOptionName",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration",
"licenses": [
{
"allowTestDevices": true,
"beginDate": "2017-10-16T18:22:53.46Z",
"playRight": {
"scmsRestriction": 2,
"digitalVideoOnlyContentRestriction": false,
"imageConstraintForAnalogComponentVideoRestriction": true,
"imageConstraintForAnalogComputerMonitorRestriction": false,
"allowPassingVideoContentToUnknownOutput": "NotAllowed"
},
"licenseType": "Persistent",
"contentKeyLocation": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"
},
"contentType": "UltraVioletDownload",
"securityLevel": "SL150"
}
]
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"
}
}
]
}
}
{
"name": "PolicyWithPlayReadyOptionAndOpenRestriction",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithPlayReadyOptionAndOpenRestriction",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "a9bacd1d-60f5-4af3-8d2b-cf46ca5c9b04",
"created": "2012-11-01T00:00:00Z",
"lastModified": "2018-08-08T18:29:29.51Z",
"description": "ArmPolicyDescription",
"options": [
{
"policyOptionId": "c52f9af0-1f53-4775-8edb-af2d9a6e28cd",
"name": "ArmPolicyOptionName",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration",
"licenses": [
{
"allowTestDevices": true,
"beginDate": "2017-10-16T18:22:53.46Z",
"playRight": {
"scmsRestriction": 2,
"digitalVideoOnlyContentRestriction": false,
"imageConstraintForAnalogComponentVideoRestriction": true,
"imageConstraintForAnalogComputerMonitorRestriction": false,
"allowPassingVideoContentToUnknownOutput": "NotAllowed"
},
"licenseType": "Persistent",
"contentKeyLocation": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"
},
"contentType": "UltraVioletDownload",
"securityLevel": "SL150"
}
]
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"
}
}
]
}
}
Creates a Content Key Policy with Widevine option and Token Restriction
Solicitud de ejemplo
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/contentKeyPolicies/PolicyWithWidevineOptionAndJwtTokenRestriction?api-version=2022-08-01
{
"properties": {
"description": "ArmPolicyDescription",
"options": [
{
"name": "widevineoption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
"widevineTemplate": "{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyRsaTokenKey",
"exponent": "AQAB",
"modulus": "AQAD"
},
"alternateVerificationKeys": [
{
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": "AAAAAAAAAAAAAAAAAAAAAA=="
}
],
"restrictionTokenType": "Jwt"
}
}
]
}
}
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyOption;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyRestrictionTokenType;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyRsaTokenKey;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicySymmetricTokenKey;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyTokenRestriction;
import com.azure.resourcemanager.mediaservices.models.ContentKeyPolicyWidevineConfiguration;
import java.util.Arrays;
/**
* Samples for ContentKeyPolicies CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-
* policies-create-widevine-token.json
*/
/**
* Sample code: Creates a Content Key Policy with Widevine option and Token Restriction.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void createsAContentKeyPolicyWithWidevineOptionAndTokenRestriction(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager.contentKeyPolicies().define("PolicyWithWidevineOptionAndJwtTokenRestriction")
.withExistingMediaService("contosorg", "contosomedia").withDescription("ArmPolicyDescription")
.withOptions(Arrays.asList(new ContentKeyPolicyOption().withName("widevineoption")
.withConfiguration(new ContentKeyPolicyWidevineConfiguration().withWidevineTemplate(
"{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"))
.withRestriction(new ContentKeyPolicyTokenRestriction().withIssuer("urn:issuer")
.withAudience("urn:audience")
.withPrimaryVerificationKey(new ContentKeyPolicyRsaTokenKey().withExponent("AQAB".getBytes())
.withModulus("AQAD".getBytes()))
.withAlternateVerificationKeys(Arrays.asList(
new ContentKeyPolicySymmetricTokenKey().withKeyValue("AAAAAAAAAAAAAAAAAAAAAA==".getBytes())))
.withRestrictionTokenType(ContentKeyPolicyRestrictionTokenType.JWT))))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.media import AzureMediaServices
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-media
# USAGE
python contentkeypoliciescreatewidevinetoken.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = AzureMediaServices(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.content_key_policies.create_or_update(
resource_group_name="contoso",
account_name="contosomedia",
content_key_policy_name="PolicyWithWidevineOptionAndJwtTokenRestriction",
parameters={
"properties": {
"description": "ArmPolicyDescription",
"options": [
{
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
"widevineTemplate": '{"allowed_track_types":"SD_HD","content_key_specs":[{"track_type":"SD","security_level":1,"required_output_protection":{"hdcp":"HDCP_V2"}}],"policy_overrides":{"can_play":true,"can_persist":true,"can_renew":false}}',
},
"name": "widevineoption",
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"alternateVerificationKeys": [
{
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": "AAAAAAAAAAAAAAAAAAAAAA==",
}
],
"audience": "urn:audience",
"issuer": "urn:issuer",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyRsaTokenKey",
"exponent": "AQAB",
"modulus": "AQAD",
},
"restrictionTokenType": "Jwt",
},
}
],
}
},
)
print(response)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-widevine-token.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmediaservices_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armmediaservices/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-widevine-token.json
func ExampleContentKeyPoliciesClient_CreateOrUpdate_createsAContentKeyPolicyWithWidevineOptionAndTokenRestriction() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmediaservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewContentKeyPoliciesClient().CreateOrUpdate(ctx, "contoso", "contosomedia", "PolicyWithWidevineOptionAndJwtTokenRestriction", armmediaservices.ContentKeyPolicy{
Properties: &armmediaservices.ContentKeyPolicyProperties{
Description: to.Ptr("ArmPolicyDescription"),
Options: []*armmediaservices.ContentKeyPolicyOption{
{
Name: to.Ptr("widevineoption"),
Configuration: &armmediaservices.ContentKeyPolicyWidevineConfiguration{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyWidevineConfiguration"),
WidevineTemplate: to.Ptr("{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"),
},
Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
AlternateVerificationKeys: []armmediaservices.ContentKeyPolicyRestrictionTokenKeyClassification{
&armmediaservices.ContentKeyPolicySymmetricTokenKey{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
KeyValue: []byte("AAAAAAAAAAAAAAAAAAAAAA=="),
}},
Audience: to.Ptr("urn:audience"),
Issuer: to.Ptr("urn:issuer"),
PrimaryVerificationKey: &armmediaservices.ContentKeyPolicyRsaTokenKey{
ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyRsaTokenKey"),
Exponent: []byte("AQAB"),
Modulus: []byte("AQAD"),
},
RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeJwt),
},
}},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ContentKeyPolicy = armmediaservices.ContentKeyPolicy{
// Name: to.Ptr("PolicyWithWidevineOptionAndJwtTokenRestriction"),
// Type: to.Ptr("Microsoft.Media/mediaservices/contentKeyPolicies"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithWidevineOptionAndJwtTokenRestriction"),
// Properties: &armmediaservices.ContentKeyPolicyProperties{
// Description: to.Ptr("ArmPolicyDescription"),
// Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-08T18:29:29.663Z"); return t}()),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-08T18:29:29.663Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Name: to.Ptr("widevineoption"),
// Configuration: &armmediaservices.ContentKeyPolicyWidevineConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyWidevineConfiguration"),
// WidevineTemplate: to.Ptr("{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"),
// },
// PolicyOptionID: to.Ptr("26fee004-8dfa-4828-bcad-5e63c637534f"),
// Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
// AlternateVerificationKeys: []armmediaservices.ContentKeyPolicyRestrictionTokenKeyClassification{
// &armmediaservices.ContentKeyPolicySymmetricTokenKey{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
// KeyValue: []byte(""),
// }},
// Audience: to.Ptr("urn:audience"),
// Issuer: to.Ptr("urn:issuer"),
// PrimaryVerificationKey: &armmediaservices.ContentKeyPolicyRsaTokenKey{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyRsaTokenKey"),
// Exponent: []byte(""),
// Modulus: []byte(""),
// },
// RequiredClaims: []*armmediaservices.ContentKeyPolicyTokenClaim{
// },
// RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeJwt),
// },
// }},
// PolicyID: to.Ptr("bad1d030-7d5c-4643-8f1e-49807a4bf64c"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureMediaServices } = require("@azure/arm-mediaservices");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Content Key Policy in the Media Services account
*
* @summary Create or update a Content Key Policy in the Media Services account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-widevine-token.json
*/
async function createsAContentKeyPolicyWithWidevineOptionAndTokenRestriction() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const contentKeyPolicyName = "PolicyWithWidevineOptionAndJwtTokenRestriction";
const parameters = {
description: "ArmPolicyDescription",
options: [
{
name: "widevineoption",
configuration: {
odataType: "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
widevineTemplate:
'{"allowed_track_types":"SD_HD","content_key_specs":[{"track_type":"SD","security_level":1,"required_output_protection":{"hdcp":"HDCP_V2"}}],"policy_overrides":{"can_play":true,"can_persist":true,"can_renew":false}}',
},
restriction: {
odataType: "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
alternateVerificationKeys: [
{
odataType: "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
keyValue: Buffer.from("AAAAAAAAAAAAAAAAAAAAAA=="),
},
],
audience: "urn:audience",
issuer: "urn:issuer",
primaryVerificationKey: {
odataType: "#Microsoft.Media.ContentKeyPolicyRsaTokenKey",
exponent: Buffer.from("AQAB"),
modulus: Buffer.from("AQAD"),
},
restrictionTokenType: "Jwt",
},
},
],
};
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const result = await client.contentKeyPolicies.createOrUpdate(
resourceGroupName,
accountName,
contentKeyPolicyName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Media;
using Azure.ResourceManager.Media.Models;
// Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-create-widevine-token.json
// this example is just showing the usage of "ContentKeyPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this MediaServicesAccountResource created on azure
// for more information of creating MediaServicesAccountResource, please refer to the document of MediaServicesAccountResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "contoso";
string accountName = "contosomedia";
ResourceIdentifier mediaServicesAccountResourceId = MediaServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
MediaServicesAccountResource mediaServicesAccount = client.GetMediaServicesAccountResource(mediaServicesAccountResourceId);
// get the collection of this ContentKeyPolicyResource
ContentKeyPolicyCollection collection = mediaServicesAccount.GetContentKeyPolicies();
// invoke the operation
string contentKeyPolicyName = "PolicyWithWidevineOptionAndJwtTokenRestriction";
ContentKeyPolicyData data = new ContentKeyPolicyData()
{
Description = "ArmPolicyDescription",
Options =
{
new ContentKeyPolicyOption(new ContentKeyPolicyWidevineConfiguration("{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"),new ContentKeyPolicyTokenRestriction("urn:issuer","urn:audience",new ContentKeyPolicyRsaTokenKey(Convert.FromBase64String("AQAB"),Convert.FromBase64String("AQAD")),ContentKeyPolicyRestrictionTokenType.Jwt)
{
AlternateVerificationKeys =
{
new ContentKeyPolicySymmetricTokenKey(Convert.FromBase64String("AAAAAAAAAAAAAAAAAAAAAA=="))
},
})
{
Name = "widevineoption",
}
},
};
ArmOperation<ContentKeyPolicyResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, contentKeyPolicyName, data);
ContentKeyPolicyResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ContentKeyPolicyData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Respuesta de muestra
{
"name": "PolicyWithWidevineOptionAndJwtTokenRestriction",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithWidevineOptionAndJwtTokenRestriction",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "bad1d030-7d5c-4643-8f1e-49807a4bf64c",
"created": "2018-08-08T18:29:29.663Z",
"lastModified": "2018-08-08T18:29:29.663Z",
"description": "ArmPolicyDescription",
"options": [
{
"policyOptionId": "26fee004-8dfa-4828-bcad-5e63c637534f",
"name": "widevineoption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
"widevineTemplate": "{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyRsaTokenKey",
"exponent": "",
"modulus": ""
},
"alternateVerificationKeys": [
{
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
}
],
"requiredClaims": [],
"restrictionTokenType": "Jwt"
}
}
]
}
}
{
"name": "PolicyWithWidevineOptionAndJwtTokenRestriction",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithWidevineOptionAndJwtTokenRestriction",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "bad1d030-7d5c-4643-8f1e-49807a4bf64c",
"created": "2018-08-08T18:29:29.663Z",
"lastModified": "2018-08-08T18:29:29.663Z",
"description": "ArmPolicyDescription",
"options": [
{
"policyOptionId": "26fee004-8dfa-4828-bcad-5e63c637534f",
"name": "widevineoption",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyWidevineConfiguration",
"widevineTemplate": "{\"allowed_track_types\":\"SD_HD\",\"content_key_specs\":[{\"track_type\":\"SD\",\"security_level\":1,\"required_output_protection\":{\"hdcp\":\"HDCP_V2\"}}],\"policy_overrides\":{\"can_play\":true,\"can_persist\":true,\"can_renew\":false}}"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "urn:issuer",
"audience": "urn:audience",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyRsaTokenKey",
"exponent": "",
"modulus": ""
},
"alternateVerificationKeys": [
{
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
}
],
"requiredClaims": [],
"restrictionTokenType": "Jwt"
}
}
]
}
}
Definiciones
ContentKeyPolicy
Un recurso de directiva de clave de contenido.
Nombre |
Tipo |
Description |
id
|
string
|
Identificador de recurso completo del recurso. Por ejemplo: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
Nombre del recurso.
|
properties.created
|
string
|
Fecha de creación de la directiva
|
properties.description
|
string
|
Descripción de la directiva.
|
properties.lastModified
|
string
|
Fecha de la última modificación de la directiva
|
properties.options
|
ContentKeyPolicyOption[]
|
Opciones de la directiva de clave.
|
properties.policyId
|
string
|
Identificador de directiva heredado.
|
systemData
|
systemData
|
Metadatos del sistema relacionados con este recurso.
|
type
|
string
|
Tipo de recurso. Por ejemplo, "Microsoft.Compute/virtualMachines" o "Microsoft.Storage/storageAccounts"
|
ContentKeyPolicyClearKeyConfiguration
Representa una configuración para claves que no son DRM.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration
|
Discriminador de tipos derivados.
|
ContentKeyPolicyFairPlayConfiguration
Especifica una configuración para las licencias de FairPlay.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration
|
Discriminador de tipos derivados.
|
ask
|
string
|
Clave que se debe usar como clave secreta de aplicación de FairPlay. Esto debe estar codificado en base64.
|
fairPlayPfx
|
string
|
Representación en Base64 del certificado FairPlay en formato PKCS 12 (pfx) (incluida la clave privada).
|
fairPlayPfxPassword
|
string
|
Contraseña que cifra el certificado FairPlay en formato PKCS 12 (pfx).
|
offlineRentalConfiguration
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
|
Directiva de alquiler sin conexión
|
rentalAndLeaseKeyType
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
|
Tipo de clave de alquiler y concesión.
|
rentalDuration
|
integer
|
Duración del alquiler. Debe ser mayor o igual que 0.
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
Nombre |
Tipo |
Description |
playbackDurationSeconds
|
integer
|
Duración de la reproducción
|
storageDurationSeconds
|
integer
|
Duración del almacenamiento
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
Tipo de clave de alquiler y concesión.
Nombre |
Tipo |
Description |
DualExpiry
|
string
|
Expiración dual para el alquiler sin conexión.
|
PersistentLimited
|
string
|
La clave de contenido se puede conservar y la duración válida está limitada por el valor de Duración del alquiler.
|
PersistentUnlimited
|
string
|
La clave de contenido se puede conservar con una duración ilimitada
|
Undefined
|
string
|
No se especifica la duración de la clave.
|
Unknown
|
string
|
Representa un ContentKeyPolicyFairPlayRentalAndLeaseKeyType que no está disponible en la versión actual de la API.
|
ContentKeyPolicyOpenRestriction
Representa una restricción abierta. La licencia o la clave se entregarán en cada solicitud.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyOpenRestriction
|
Discriminador de tipos derivados.
|
ContentKeyPolicyOption
Representa una opción de directiva.
Nombre |
Tipo |
Description |
configuration
|
ContentKeyPolicyConfiguration:
|
Configuración de entrega de claves.
|
name
|
string
|
Descripción de la opción de directiva.
|
policyOptionId
|
string
|
Identificador de opción de directiva heredado.
|
restriction
|
ContentKeyPolicyRestriction:
|
Requisitos que se deben cumplir para entregar claves con esta configuración
|
ContentKeyPolicyPlayReadyConfiguration
Especifica una configuración para las licencias de PlayReady.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration
|
Discriminador de tipos derivados.
|
licenses
|
ContentKeyPolicyPlayReadyLicense[]
|
Las licencias de PlayReady.
|
responseCustomData
|
string
|
Datos de respuesta personalizados.
|
Especifica que el identificador de clave de contenido está en el encabezado PlayReady.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader
|
Discriminador de tipos derivados.
|
ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
Especifica que el identificador de clave de contenido se especifica en la configuración de PlayReady.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
|
Discriminador de tipos derivados.
|
keyId
|
string
|
Identificador de clave de contenido.
|
ContentKeyPolicyPlayReadyContentType
Tipo de contenido PlayReady.
Nombre |
Tipo |
Description |
UltraVioletDownload
|
string
|
Tipo de contenido de descarga ultravioleta.
|
UltraVioletStreaming
|
string
|
Tipo de contenido de streaming ultravioleta.
|
Unknown
|
string
|
Representa un ContentKeyPolicyPlayReadyContentType que no está disponible en la versión actual de la API.
|
Unspecified
|
string
|
Tipo de contenido no especificado.
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
Configura los bits de control Explicit Analog Television Output Restriction. Para obtener más información, consulte Reglas de cumplimiento de PlayReady.
Nombre |
Tipo |
Description |
bestEffort
|
boolean
|
Indica si esta restricción se aplica según el mejor esfuerzo.
|
configurationData
|
integer
|
Configura los bits de control de restricción. Debe estar comprendido entre 0 y 3 inclusive.
|
ContentKeyPolicyPlayReadyLicense
La licencia de PlayReady
Nombre |
Tipo |
Description |
allowTestDevices
|
boolean
|
Marca que indica si los dispositivos de prueba pueden usar la licencia.
|
beginDate
|
string
|
La fecha de inicio de la licencia
|
contentKeyLocation
|
ContentKeyPolicyPlayReadyContentKeyLocation:
|
Ubicación de la clave de contenido.
|
contentType
|
ContentKeyPolicyPlayReadyContentType
|
Tipo de contenido de PlayReady.
|
expirationDate
|
string
|
Fecha de expiración de la licencia.
|
gracePeriod
|
string
|
Período de gracia de licencia.
|
licenseType
|
ContentKeyPolicyPlayReadyLicenseType
|
Tipo de licencia.
|
playRight
|
ContentKeyPolicyPlayReadyPlayRight
|
La licencia PlayRight
|
relativeBeginDate
|
string
|
Fecha de inicio relativa de la licencia.
|
relativeExpirationDate
|
string
|
Fecha de expiración relativa de la licencia.
|
securityLevel
|
SecurityLevel
|
Nivel de seguridad.
|
ContentKeyPolicyPlayReadyLicenseType
Tipo de licencia.
Nombre |
Tipo |
Description |
NonPersistent
|
string
|
Licencia no persistente.
|
Persistent
|
string
|
Licencia persistente. Permite la reproducción sin conexión.
|
Unknown
|
string
|
Representa un ContentKeyPolicyPlayReadyLicenseType que no está disponible en la versión actual de la API.
|
ContentKeyPolicyPlayReadyPlayRight
Configura la opción Play Right en la licencia de PlayReady.
Nombre |
Tipo |
Description |
agcAndColorStripeRestriction
|
integer
|
Configura Control de ganancia automática (AGC) y Franja de color en la licencia. Debe estar comprendido entre 0 y 3 inclusive.
|
allowPassingVideoContentToUnknownOutput
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
|
Configura los valores de control de salida desconocidos de la licencia.
|
analogVideoOpl
|
integer
|
Especifica el nivel de protección de salida para el audio digital comprimido.
|
compressedDigitalAudioOpl
|
integer
|
Especifica el nivel de protección de salida para el audio digital comprimido.
|
compressedDigitalVideoOpl
|
integer
|
Especifica el nivel de protección de salida para el vídeo digital comprimido.
|
digitalVideoOnlyContentRestriction
|
boolean
|
Habilita la restricción image para la restricción de vídeo de componente analógico en la licencia.
|
explicitAnalogTelevisionOutputRestriction
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
|
Configura la restricción explícita de salida de televisión analógica en la licencia. Los datos de configuración deben estar comprendidos entre 0 y 3 incluidos.
|
firstPlayExpiration
|
string
|
Cantidad de tiempo que la licencia es válida después de que la licencia se use por primera vez para reproducir contenido.
|
imageConstraintForAnalogComponentVideoRestriction
|
boolean
|
Habilita la restricción image para la restricción de vídeo de componente analógico en la licencia.
|
imageConstraintForAnalogComputerMonitorRestriction
|
boolean
|
Habilita la restricción image para la restricción de vídeo de componente analógico en la licencia.
|
scmsRestriction
|
integer
|
Configura el Sistema de administración de copias serie (SCMS) en la licencia. Debe estar comprendido entre 0 y 3 inclusive.
|
uncompressedDigitalAudioOpl
|
integer
|
Especifica el nivel de protección de salida para el audio digital sin comprimir.
|
uncompressedDigitalVideoOpl
|
integer
|
Especifica el nivel de protección de salida para el vídeo digital sin comprimir.
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
Configura los valores de control de salida desconocidos de la licencia.
Nombre |
Tipo |
Description |
Allowed
|
string
|
Se permite pasar la parte de vídeo del contenido protegido a una salida desconocida.
|
AllowedWithVideoConstriction
|
string
|
Se permite pasar la parte de vídeo del contenido protegido a una salida desconocida, pero con una resolución restringida.
|
NotAllowed
|
string
|
No se permite pasar la parte de vídeo del contenido protegido a una salida desconocida.
|
Unknown
|
string
|
Representa un ContentKeyPolicyPlayReadyUnknownOutputPassingOption que no está disponible en la versión actual de la API.
|
ContentKeyPolicyRestrictionTokenType
Tipo de token.
Nombre |
Tipo |
Description |
Jwt
|
string
|
JSON Web Token.
|
Swt
|
string
|
Token web simple.
|
Unknown
|
string
|
Representa un ContentKeyPolicyRestrictionTokenType que no está disponible en la versión actual de la API.
|
ContentKeyPolicyRsaTokenKey
Especifica una clave RSA para la validación de tokens.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyRsaTokenKey
|
Discriminador de tipos derivados.
|
exponent
|
string
|
Exponente de parámetros RSA
|
modulus
|
string
|
Módulo de parámetros RSA
|
ContentKeyPolicySymmetricTokenKey
Especifica una clave simétrica para la validación de tokens.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicySymmetricTokenKey
|
Discriminador de tipos derivados.
|
keyValue
|
string
|
Valor de clave de la clave
|
ContentKeyPolicyTokenClaim
Representa una notificación de token.
Nombre |
Tipo |
Description |
claimType
|
string
|
Tipo de notificación de token.
|
claimValue
|
string
|
Valor de notificación de token.
|
ContentKeyPolicyTokenRestriction
Representa una restricción de token. El token proporcionado debe coincidir con estos requisitos para la entrega correcta de licencias o claves.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyTokenRestriction
|
Discriminador de tipos derivados.
|
alternateVerificationKeys
|
ContentKeyPolicyRestrictionTokenKey[]:
|
Lista de claves de verificación alternativas.
|
audience
|
string
|
Audiencia del token.
|
issuer
|
string
|
Emisor del token.
|
openIdConnectDiscoveryDocument
|
string
|
Documento de detección de Conexión de OpenID.
|
primaryVerificationKey
|
ContentKeyPolicyRestrictionTokenKey:
|
Clave de comprobación principal.
|
requiredClaims
|
ContentKeyPolicyTokenClaim[]
|
Lista de notificaciones de token necesarias.
|
restrictionTokenType
|
ContentKeyPolicyRestrictionTokenType
|
Tipo de token.
|
ContentKeyPolicyUnknownConfiguration
Representa una contentKeyPolicyConfiguration que no está disponible en la versión actual de la API.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownConfiguration
|
Discriminador de tipos derivados.
|
ContentKeyPolicyUnknownRestriction
Representa una contentKeyPolicyRestriction que no está disponible en la versión actual de la API.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownRestriction
|
Discriminador de tipos derivados.
|
ContentKeyPolicyWidevineConfiguration
Especifica una configuración para las licencias de Widevine.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyWidevineConfiguration
|
Discriminador de tipos derivados.
|
widevineTemplate
|
string
|
Plantilla de Widevine.
|
ContentKeyPolicyX509CertificateTokenKey
Especifica un certificado para la validación de tokens.
Nombre |
Tipo |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey
|
Discriminador de tipos derivados.
|
rawBody
|
string
|
El campo de datos sin procesar de un certificado en formato PKCS 12 (X509Certificate2 en .NET)
|
createdByType
Tipo de identidad que creó el recurso.
Nombre |
Tipo |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
Información adicional sobre el error de administración de recursos.
Nombre |
Tipo |
Description |
info
|
object
|
Información adicional.
|
type
|
string
|
Tipo de información adicional.
|
ErrorDetail
Detalle del error.
Nombre |
Tipo |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Información adicional del error.
|
code
|
string
|
Código de error.
|
details
|
ErrorDetail[]
|
Los detalles del error.
|
message
|
string
|
El mensaje de error.
|
target
|
string
|
Destino del error.
|
ErrorResponse
Respuesta de error
Nombre |
Tipo |
Description |
error
|
ErrorDetail
|
Objeto de error.
|
SecurityLevel
Nivel de seguridad.
Nombre |
Tipo |
Description |
SL150
|
string
|
Para los clientes en desarrollo o pruebas. Sin protección contra el uso no autorizado.
|
SL2000
|
string
|
Para dispositivos y aplicaciones protegidos que consumen contenido comercial. Protección de software o hardware.
|
SL3000
|
string
|
Solo para dispositivos protegidos. Protección de hardware.
|
Unknown
|
string
|
Representa un securityLevel que no está disponible en la versión actual de la API.
|
systemData
Metadatos relacionados con la creación y la última modificación del recurso.
Nombre |
Tipo |
Description |
createdAt
|
string
|
Marca de tiempo de creación de recursos (UTC).
|
createdBy
|
string
|
Identidad que creó el recurso.
|
createdByType
|
createdByType
|
Tipo de identidad que creó el recurso.
|
lastModifiedAt
|
string
|
Marca de tiempo de la última modificación del recurso (UTC)
|
lastModifiedBy
|
string
|
Identidad que modificó por última vez el recurso.
|
lastModifiedByType
|
createdByType
|
Tipo de identidad que modificó por última vez el recurso.
|