Créer ou mettre à jour une stratégie de clé de contenu
Créer ou mettre à jour une stratégie de clé de contenu dans le compte Media Services
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}?api-version=2022-08-01
Paramètres URI
Nom |
Dans |
Obligatoire |
Type |
Description |
accountName
|
path |
True
|
string
|
Nom du compte Media Services.
|
contentKeyPolicyName
|
path |
True
|
string
|
Nom de la stratégie de clé de contenu.
|
resourceGroupName
|
path |
True
|
string
|
Nom du groupe de ressources dans l’abonnement Azure.
|
subscriptionId
|
path |
True
|
string
|
Identificateur unique d’un abonnement Microsoft Azure.
|
api-version
|
query |
True
|
string
|
Version de l’API à utiliser avec la demande du client.
|
Corps de la demande
Nom |
Obligatoire |
Type |
Description |
properties.options
|
True
|
ContentKeyPolicyOption[]
|
Options de la stratégie de clé.
|
properties.description
|
|
string
|
Description de la stratégie.
|
Réponses
Exemples
Creates a Content Key Policy with ClearKey option and Token Restriction
Exemple de requête
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://zcusa.951200.xyz/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
Exemple de réponse
{
"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
Exemple de requête
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://zcusa.951200.xyz/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
Exemple de réponse
{
"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
Exemple de requête
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://zcusa.951200.xyz/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
Exemple de réponse
{
"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
Exemple de requête
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://zcusa.951200.xyz/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
Exemple de réponse
{
"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"
}
}
]
}
}
Définitions
ContentKeyPolicy
Une ressource de stratégie de clé de contenu.
Nom |
Type |
Description |
id
|
string
|
ID de ressource complet pour la ressource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
nom de la ressource.
|
properties.created
|
string
|
Date de création de la stratégie.
|
properties.description
|
string
|
Description de la stratégie.
|
properties.lastModified
|
string
|
Date de la dernière modification de la stratégie.
|
properties.options
|
ContentKeyPolicyOption[]
|
Options de la stratégie de clé.
|
properties.policyId
|
string
|
ID de stratégie hérité.
|
systemData
|
systemData
|
Métadonnées système relatives à cette ressource.
|
type
|
string
|
Type de la ressource. Par exemple, « Microsoft.Compute/virtualMachines » ou « Microsoft.Storage/storageAccounts »
|
ContentKeyPolicyClearKeyConfiguration
Représente une configuration pour les clés non DRM.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration
|
Discriminateur pour les types dérivés.
|
ContentKeyPolicyFairPlayConfiguration
Spécifie une configuration pour les licences FairPlay.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration
|
Discriminateur pour les types dérivés.
|
ask
|
string
|
Clé qui doit être utilisée comme clé secrète d’application FairPlay. Cela doit être encodé en base64.
|
fairPlayPfx
|
string
|
Représentation Base64 du certificat FairPlay au format PKCS 12 (pfx) (clé privée comprise).
|
fairPlayPfxPassword
|
string
|
Mot de passe de chiffrement du certificat FairPlay au format PKCS 12 (pfx).
|
offlineRentalConfiguration
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
|
Stratégie de location hors connexion
|
rentalAndLeaseKeyType
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
|
Type de clé de location et de bail.
|
rentalDuration
|
integer
|
Durée de location. Doit être supérieur ou égal à 0.
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
Nom |
Type |
Description |
playbackDurationSeconds
|
integer
|
Durée de lecture
|
storageDurationSeconds
|
integer
|
Durée de stockage
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
Type de clé de location et de bail.
Nom |
Type |
Description |
DualExpiry
|
string
|
Double expiration pour la location hors connexion.
|
PersistentLimited
|
string
|
La clé de contenu peut être conservée et la durée valide est limitée par la valeur Durée de location
|
PersistentUnlimited
|
string
|
La clé de contenu peut être conservée avec une durée illimitée
|
Undefined
|
string
|
La durée de la clé n’est pas spécifiée.
|
Unknown
|
string
|
Représente un ContentKeyPolicyFairPlayRentalAndLeaseKeyType qui n’est pas disponible dans la version actuelle de l’API.
|
ContentKeyPolicyOpenRestriction
Représente une restriction ouverte. La licence ou la clé sera remise à chaque demande.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyOpenRestriction
|
Discriminateur pour les types dérivés.
|
ContentKeyPolicyOption
Représente une option de stratégie.
Nom |
Type |
Description |
configuration
|
ContentKeyPolicyConfiguration:
|
Configuration de remise de clés.
|
name
|
string
|
Description de l’option de stratégie.
|
policyOptionId
|
string
|
ID d’option de stratégie hérité.
|
restriction
|
ContentKeyPolicyRestriction:
|
Conditions requises pour fournir des clés avec cette configuration
|
ContentKeyPolicyPlayReadyConfiguration
Spécifie une configuration pour les licences PlayReady.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration
|
Discriminateur pour les types dérivés.
|
licenses
|
ContentKeyPolicyPlayReadyLicense[]
|
Licences PlayReady.
|
responseCustomData
|
string
|
Données de réponse personnalisées.
|
Spécifie que l’ID de clé de contenu se trouve dans l’en-tête PlayReady.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader
|
Discriminateur pour les types dérivés.
|
ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
Spécifie que l’ID de clé de contenu est spécifié dans la configuration PlayReady.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
|
Discriminateur pour les types dérivés.
|
keyId
|
string
|
ID de clé de contenu.
|
ContentKeyPolicyPlayReadyContentType
Type de contenu PlayReady.
Nom |
Type |
Description |
UltraVioletDownload
|
string
|
Type de contenu de téléchargement ultraviolet.
|
UltraVioletStreaming
|
string
|
Type de contenu de streaming ultraviolet.
|
Unknown
|
string
|
Représente un ContentKeyPolicyPlayReadyContentType qui n’est pas disponible dans la version actuelle de l’API.
|
Unspecified
|
string
|
Type de contenu non spécifié.
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
Configure les bits de contrôle de restriction de sortie de la télévision analogique explicite. Pour plus d’informations, consultez règles de conformité PlayReady.
Nom |
Type |
Description |
bestEffort
|
boolean
|
Indique si cette restriction est appliquée sur la base du meilleur effort.
|
configurationData
|
integer
|
Configure les bits de contrôle de restriction. Doit être compris entre 0 et 3 inclus.
|
ContentKeyPolicyPlayReadyLicense
La licence PlayReady
Nom |
Type |
Description |
allowTestDevices
|
boolean
|
Indicateur indiquant si les appareils de test peuvent utiliser la licence.
|
beginDate
|
string
|
Date de début de la licence
|
contentKeyLocation
|
ContentKeyPolicyPlayReadyContentKeyLocation:
|
Emplacement de la clé de contenu.
|
contentType
|
ContentKeyPolicyPlayReadyContentType
|
Type de contenu PlayReady.
|
expirationDate
|
string
|
Date d’expiration de la licence.
|
gracePeriod
|
string
|
Période de grâce de la licence.
|
licenseType
|
ContentKeyPolicyPlayReadyLicenseType
|
Type de licence.
|
playRight
|
ContentKeyPolicyPlayReadyPlayRight
|
La licence PlayRight
|
relativeBeginDate
|
string
|
Date de début relative de la licence.
|
relativeExpirationDate
|
string
|
Date d’expiration relative de la licence.
|
securityLevel
|
SecurityLevel
|
Niveau de sécurité.
|
ContentKeyPolicyPlayReadyLicenseType
Type de licence.
Nom |
Type |
Description |
NonPersistent
|
string
|
Licence non persistante.
|
Persistent
|
string
|
Licence permanente. Autorise la lecture hors connexion.
|
Unknown
|
string
|
Représente un ContentKeyPolicyPlayReadyLicenseType qui n’est pas disponible dans la version actuelle de l’API.
|
ContentKeyPolicyPlayReadyPlayRight
Configure le droit de lecture dans la licence PlayReady.
Nom |
Type |
Description |
agcAndColorStripeRestriction
|
integer
|
Configure le contrôle de gain automatique (AGC) et color stripe dans la licence. Doit être compris entre 0 et 3 inclus.
|
allowPassingVideoContentToUnknownOutput
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
|
Configure les paramètres de gestion des sorties inconnus de la licence.
|
analogVideoOpl
|
integer
|
Spécifie le niveau de protection de sortie pour l’audio numérique compressé.
|
compressedDigitalAudioOpl
|
integer
|
Spécifie le niveau de protection de sortie pour l’audio numérique compressé.
|
compressedDigitalVideoOpl
|
integer
|
Spécifie le niveau de protection de sortie pour la vidéo numérique compressée.
|
digitalVideoOnlyContentRestriction
|
boolean
|
Active la contrainte d’image pour la restriction vidéo de composant analogique dans la licence.
|
explicitAnalogTelevisionOutputRestriction
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
|
Configure la restriction de sortie de télévision analogique explicite dans la licence. Les données de configuration doivent être comprises entre 0 et 3 inclus.
|
firstPlayExpiration
|
string
|
Durée de validité de la licence après la première utilisation de la licence pour lire du contenu.
|
imageConstraintForAnalogComponentVideoRestriction
|
boolean
|
Active la contrainte d’image pour la restriction vidéo de composant analogique dans la licence.
|
imageConstraintForAnalogComputerMonitorRestriction
|
boolean
|
Active la contrainte d’image pour la restriction vidéo de composant analogique dans la licence.
|
scmsRestriction
|
integer
|
Configure le système SCMS (Serial Copy Management System) dans la licence. Doit être compris entre 0 et 3 inclus.
|
uncompressedDigitalAudioOpl
|
integer
|
Spécifie le niveau de protection de sortie pour l’audio numérique non compressé.
|
uncompressedDigitalVideoOpl
|
integer
|
Spécifie le niveau de protection de sortie pour la vidéo numérique non compressée.
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
Configure les paramètres de gestion des sorties inconnus de la licence.
Nom |
Type |
Description |
Allowed
|
string
|
Le passage de la partie vidéo du contenu protégé à une sortie inconnue est autorisé.
|
AllowedWithVideoConstriction
|
string
|
Le passage de la partie vidéo du contenu protégé à une sortie inconnue est autorisé, mais avec une résolution limitée.
|
NotAllowed
|
string
|
Le passage de la partie vidéo du contenu protégé à une sortie inconnue n’est pas autorisé.
|
Unknown
|
string
|
Représente un ContentKeyPolicyPlayReadyUnknownOutputPassingOption qui n’est pas disponible dans la version actuelle de l’API.
|
ContentKeyPolicyRestrictionTokenType
Type de jeton.
Nom |
Type |
Description |
Jwt
|
string
|
Jeton web JSON.
|
Swt
|
string
|
Jeton web simple.
|
Unknown
|
string
|
Représente un ContentKeyPolicyRestrictionTokenType qui n’est pas disponible dans la version actuelle de l’API.
|
ContentKeyPolicyRsaTokenKey
Spécifie une clé RSA pour la validation de jeton
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyRsaTokenKey
|
Discriminateur pour les types dérivés.
|
exponent
|
string
|
Exposant de paramètre RSA
|
modulus
|
string
|
Module de paramètre RSA
|
ContentKeyPolicySymmetricTokenKey
Spécifie une clé symétrique pour la validation de jeton.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicySymmetricTokenKey
|
Discriminateur pour les types dérivés.
|
keyValue
|
string
|
Valeur de clé de la clé
|
ContentKeyPolicyTokenClaim
Représente une revendication de jeton.
Nom |
Type |
Description |
claimType
|
string
|
Type de revendication de jeton.
|
claimValue
|
string
|
Valeur de revendication de jeton.
|
ContentKeyPolicyTokenRestriction
Représente une restriction de jeton. Le jeton fourni doit correspondre à ces exigences pour une licence ou une remise de clé réussie.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyTokenRestriction
|
Discriminateur pour les types dérivés.
|
alternateVerificationKeys
|
ContentKeyPolicyRestrictionTokenKey[]:
|
Liste des clés de vérification alternatives.
|
audience
|
string
|
Audience du jeton.
|
issuer
|
string
|
Émetteur de jeton.
|
openIdConnectDiscoveryDocument
|
string
|
Document de découverte de connexion OpenID.
|
primaryVerificationKey
|
ContentKeyPolicyRestrictionTokenKey:
|
Clé de vérification primaire.
|
requiredClaims
|
ContentKeyPolicyTokenClaim[]
|
Liste des revendications de jeton requises.
|
restrictionTokenType
|
ContentKeyPolicyRestrictionTokenType
|
Type de jeton.
|
ContentKeyPolicyUnknownConfiguration
Représente un ContentKeyPolicyConfiguration qui n’est pas disponible dans la version actuelle de l’API.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownConfiguration
|
Discriminateur pour les types dérivés.
|
ContentKeyPolicyUnknownRestriction
Représente un ContentKeyPolicyRestriction qui n’est pas disponible dans la version actuelle de l’API.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownRestriction
|
Discriminateur pour les types dérivés.
|
ContentKeyPolicyWidevineConfiguration
Spécifie une configuration pour les licences Widevine.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyWidevineConfiguration
|
Discriminateur pour les types dérivés.
|
widevineTemplate
|
string
|
Modèle Widevine.
|
ContentKeyPolicyX509CertificateTokenKey
Spécifie un certificat pour la validation de jeton.
Nom |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey
|
Discriminateur pour les types dérivés.
|
rawBody
|
string
|
Champ de données brutes d’un certificat au format PKCS 12 (X509Certificate2 dans .NET)
|
createdByType
Type d’identité qui a créé la ressource.
Nom |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
Informations supplémentaires sur l’erreur de gestion des ressources.
Nom |
Type |
Description |
info
|
object
|
Informations supplémentaires
|
type
|
string
|
Type d’informations supplémentaires.
|
ErrorDetail
Détail de l’erreur.
Nom |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
Informations supplémentaires sur l’erreur.
|
code
|
string
|
Code d'erreur.
|
details
|
ErrorDetail[]
|
Détails de l’erreur.
|
message
|
string
|
Message d’erreur.
|
target
|
string
|
Cible d’erreur.
|
ErrorResponse
Réponse d’erreur
SecurityLevel
Niveau de sécurité.
Nom |
Type |
Description |
SL150
|
string
|
Pour les clients en cours de développement ou de test. Aucune protection contre toute utilisation non autorisée.
|
SL2000
|
string
|
Pour les appareils renforcés et les applications consommant du contenu commercial. Protection logicielle ou matérielle.
|
SL3000
|
string
|
Pour les appareils renforcés uniquement. Protection matérielle.
|
Unknown
|
string
|
Représente un SecurityLevel qui n’est pas disponible dans la version actuelle de l’API.
|
systemData
Métadonnées relatives à la création et à la dernière modification de la ressource.
Nom |
Type |
Description |
createdAt
|
string
|
Horodatage de la création de ressources (UTC).
|
createdBy
|
string
|
Identité qui a créé la ressource.
|
createdByType
|
createdByType
|
Type d’identité qui a créé la ressource.
|
lastModifiedAt
|
string
|
Horodatage de la dernière modification de la ressource (UTC)
|
lastModifiedBy
|
string
|
Identité qui a modifié la dernière ressource.
|
lastModifiedByType
|
createdByType
|
Type d’identité qui a modifié la dernière ressource.
|