Create or update an Content Key Policy
Create or update a Content Key Policy in the Media Services account
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}?api-version=2022-08-01
URI Parameters
Name |
In |
Required |
Type |
Description |
accountName
|
path |
True
|
string
|
The Media Services account name.
|
contentKeyPolicyName
|
path |
True
|
string
|
The Content Key Policy name.
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group within the Azure subscription.
|
subscriptionId
|
path |
True
|
string
|
The unique identifier for a Microsoft Azure subscription.
|
api-version
|
query |
True
|
string
|
The version of the API to be used with the client request.
|
Request Body
Name |
Required |
Type |
Description |
properties.options
|
True
|
ContentKeyPolicyOption[]
|
The Key Policy options.
|
properties.description
|
|
string
|
A description for the Policy.
|
Responses
Examples
Creates a Content Key Policy with ClearKey option and Token Restriction
Sample request
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
Sample response
{
"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
Sample request
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
Sample response
{
"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
Sample request
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
Sample response
{
"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
Sample request
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
Sample response
{
"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"
}
}
]
}
}
Definitions
ContentKeyPolicy
A Content Key Policy resource.
Name |
Type |
Description |
id
|
string
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
The name of the resource
|
properties.created
|
string
|
The creation date of the Policy
|
properties.description
|
string
|
A description for the Policy.
|
properties.lastModified
|
string
|
The last modified date of the Policy
|
properties.options
|
ContentKeyPolicyOption[]
|
The Key Policy options.
|
properties.policyId
|
string
|
The legacy Policy ID.
|
systemData
|
systemData
|
The system metadata relating to this resource.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
ContentKeyPolicyClearKeyConfiguration
Represents a configuration for non-DRM keys.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration
|
The discriminator for derived types.
|
ContentKeyPolicyFairPlayConfiguration
Specifies a configuration for FairPlay licenses.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration
|
The discriminator for derived types.
|
ask
|
string
|
The key that must be used as FairPlay Application Secret key. This needs to be base64 encoded.
|
fairPlayPfx
|
string
|
The Base64 representation of FairPlay certificate in PKCS 12 (pfx) format (including private key).
|
fairPlayPfxPassword
|
string
|
The password encrypting FairPlay certificate in PKCS 12 (pfx) format.
|
offlineRentalConfiguration
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
|
Offline rental policy
|
rentalAndLeaseKeyType
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
|
The rental and lease key type.
|
rentalDuration
|
integer
|
The rental duration. Must be greater than or equal to 0.
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
Name |
Type |
Description |
playbackDurationSeconds
|
integer
|
Playback duration
|
storageDurationSeconds
|
integer
|
Storage duration
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
The rental and lease key type.
Name |
Type |
Description |
DualExpiry
|
string
|
Dual expiry for offline rental.
|
PersistentLimited
|
string
|
Content key can be persisted and the valid duration is limited by the Rental Duration value
|
PersistentUnlimited
|
string
|
Content key can be persisted with an unlimited duration
|
Undefined
|
string
|
Key duration is not specified.
|
Unknown
|
string
|
Represents a ContentKeyPolicyFairPlayRentalAndLeaseKeyType that is unavailable in current API version.
|
ContentKeyPolicyOpenRestriction
Represents an open restriction. License or key will be delivered on every request.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyOpenRestriction
|
The discriminator for derived types.
|
ContentKeyPolicyOption
Represents a policy option.
Name |
Type |
Description |
configuration
|
ContentKeyPolicyConfiguration:
|
The key delivery configuration.
|
name
|
string
|
The Policy Option description.
|
policyOptionId
|
string
|
The legacy Policy Option ID.
|
restriction
|
ContentKeyPolicyRestriction:
|
The requirements that must be met to deliver keys with this configuration
|
ContentKeyPolicyPlayReadyConfiguration
Specifies a configuration for PlayReady licenses.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration
|
The discriminator for derived types.
|
licenses
|
ContentKeyPolicyPlayReadyLicense[]
|
The PlayReady licenses.
|
responseCustomData
|
string
|
The custom response data.
|
Specifies that the content key ID is in the PlayReady header.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader
|
The discriminator for derived types.
|
ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
Specifies that the content key ID is specified in the PlayReady configuration.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
|
The discriminator for derived types.
|
keyId
|
string
|
The content key ID.
|
ContentKeyPolicyPlayReadyContentType
The PlayReady content type.
Name |
Type |
Description |
UltraVioletDownload
|
string
|
Ultraviolet download content type.
|
UltraVioletStreaming
|
string
|
Ultraviolet streaming content type.
|
Unknown
|
string
|
Represents a ContentKeyPolicyPlayReadyContentType that is unavailable in current API version.
|
Unspecified
|
string
|
Unspecified content type.
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
Configures the Explicit Analog Television Output Restriction control bits. For further details see the PlayReady Compliance Rules.
Name |
Type |
Description |
bestEffort
|
boolean
|
Indicates whether this restriction is enforced on a Best Effort basis.
|
configurationData
|
integer
|
Configures the restriction control bits. Must be between 0 and 3 inclusive.
|
ContentKeyPolicyPlayReadyLicense
The PlayReady license
Name |
Type |
Description |
allowTestDevices
|
boolean
|
A flag indicating whether test devices can use the license.
|
beginDate
|
string
|
The begin date of license
|
contentKeyLocation
|
ContentKeyPolicyPlayReadyContentKeyLocation:
|
The content key location.
|
contentType
|
ContentKeyPolicyPlayReadyContentType
|
The PlayReady content type.
|
expirationDate
|
string
|
The expiration date of license.
|
gracePeriod
|
string
|
The grace period of license.
|
licenseType
|
ContentKeyPolicyPlayReadyLicenseType
|
The license type.
|
playRight
|
ContentKeyPolicyPlayReadyPlayRight
|
The license PlayRight
|
relativeBeginDate
|
string
|
The relative begin date of license.
|
relativeExpirationDate
|
string
|
The relative expiration date of license.
|
securityLevel
|
SecurityLevel
|
The security level.
|
ContentKeyPolicyPlayReadyLicenseType
The license type.
Name |
Type |
Description |
NonPersistent
|
string
|
Non persistent license.
|
Persistent
|
string
|
Persistent license. Allows offline playback.
|
Unknown
|
string
|
Represents a ContentKeyPolicyPlayReadyLicenseType that is unavailable in current API version.
|
ContentKeyPolicyPlayReadyPlayRight
Configures the Play Right in the PlayReady license.
Name |
Type |
Description |
agcAndColorStripeRestriction
|
integer
|
Configures Automatic Gain Control (AGC) and Color Stripe in the license. Must be between 0 and 3 inclusive.
|
allowPassingVideoContentToUnknownOutput
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
|
Configures Unknown output handling settings of the license.
|
analogVideoOpl
|
integer
|
Specifies the output protection level for compressed digital audio.
|
compressedDigitalAudioOpl
|
integer
|
Specifies the output protection level for compressed digital audio.
|
compressedDigitalVideoOpl
|
integer
|
Specifies the output protection level for compressed digital video.
|
digitalVideoOnlyContentRestriction
|
boolean
|
Enables the Image Constraint For Analog Component Video Restriction in the license.
|
explicitAnalogTelevisionOutputRestriction
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
|
Configures the Explicit Analog Television Output Restriction in the license. Configuration data must be between 0 and 3 inclusive.
|
firstPlayExpiration
|
string
|
The amount of time that the license is valid after the license is first used to play content.
|
imageConstraintForAnalogComponentVideoRestriction
|
boolean
|
Enables the Image Constraint For Analog Component Video Restriction in the license.
|
imageConstraintForAnalogComputerMonitorRestriction
|
boolean
|
Enables the Image Constraint For Analog Component Video Restriction in the license.
|
scmsRestriction
|
integer
|
Configures the Serial Copy Management System (SCMS) in the license. Must be between 0 and 3 inclusive.
|
uncompressedDigitalAudioOpl
|
integer
|
Specifies the output protection level for uncompressed digital audio.
|
uncompressedDigitalVideoOpl
|
integer
|
Specifies the output protection level for uncompressed digital video.
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
Configures Unknown output handling settings of the license.
Name |
Type |
Description |
Allowed
|
string
|
Passing the video portion of protected content to an Unknown Output is allowed.
|
AllowedWithVideoConstriction
|
string
|
Passing the video portion of protected content to an Unknown Output is allowed but with constrained resolution.
|
NotAllowed
|
string
|
Passing the video portion of protected content to an Unknown Output is not allowed.
|
Unknown
|
string
|
Represents a ContentKeyPolicyPlayReadyUnknownOutputPassingOption that is unavailable in current API version.
|
ContentKeyPolicyRestrictionTokenType
The type of token.
Name |
Type |
Description |
Jwt
|
string
|
JSON Web Token.
|
Swt
|
string
|
Simple Web Token.
|
Unknown
|
string
|
Represents a ContentKeyPolicyRestrictionTokenType that is unavailable in current API version.
|
ContentKeyPolicyRsaTokenKey
Specifies a RSA key for token validation
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyRsaTokenKey
|
The discriminator for derived types.
|
exponent
|
string
|
The RSA Parameter exponent
|
modulus
|
string
|
The RSA Parameter modulus
|
ContentKeyPolicySymmetricTokenKey
Specifies a symmetric key for token validation.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicySymmetricTokenKey
|
The discriminator for derived types.
|
keyValue
|
string
|
The key value of the key
|
ContentKeyPolicyTokenClaim
Represents a token claim.
Name |
Type |
Description |
claimType
|
string
|
Token claim type.
|
claimValue
|
string
|
Token claim value.
|
ContentKeyPolicyTokenRestriction
Represents a token restriction. Provided token must match these requirements for successful license or key delivery.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyTokenRestriction
|
The discriminator for derived types.
|
alternateVerificationKeys
|
ContentKeyPolicyRestrictionTokenKey[]:
|
A list of alternative verification keys.
|
audience
|
string
|
The audience for the token.
|
issuer
|
string
|
The token issuer.
|
openIdConnectDiscoveryDocument
|
string
|
The OpenID connect discovery document.
|
primaryVerificationKey
|
ContentKeyPolicyRestrictionTokenKey:
|
The primary verification key.
|
requiredClaims
|
ContentKeyPolicyTokenClaim[]
|
A list of required token claims.
|
restrictionTokenType
|
ContentKeyPolicyRestrictionTokenType
|
The type of token.
|
ContentKeyPolicyUnknownConfiguration
Represents a ContentKeyPolicyConfiguration that is unavailable in the current API version.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownConfiguration
|
The discriminator for derived types.
|
ContentKeyPolicyUnknownRestriction
Represents a ContentKeyPolicyRestriction that is unavailable in the current API version.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownRestriction
|
The discriminator for derived types.
|
ContentKeyPolicyWidevineConfiguration
Specifies a configuration for Widevine licenses.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyWidevineConfiguration
|
The discriminator for derived types.
|
widevineTemplate
|
string
|
The Widevine template.
|
ContentKeyPolicyX509CertificateTokenKey
Specifies a certificate for token validation.
Name |
Type |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey
|
The discriminator for derived types.
|
rawBody
|
string
|
The raw data field of a certificate in PKCS 12 format (X509Certificate2 in .NET)
|
createdByType
The type of identity that created the resource.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
SecurityLevel
The security level.
Name |
Type |
Description |
SL150
|
string
|
For clients under development or test. No protection against unauthorized use.
|
SL2000
|
string
|
For hardened devices and applications consuming commercial content. Software or hardware protection.
|
SL3000
|
string
|
For hardened devices only. Hardware protection.
|
Unknown
|
string
|
Represents a SecurityLevel that is unavailable in current API version.
|
systemData
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
|
The timestamp of resource last modification (UTC)
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|