Tworzenie lub aktualizowanie zasad klucza zawartości
Tworzenie lub aktualizowanie zasad klucza zawartości na koncie usługi Media Services
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies/{contentKeyPolicyName}?api-version=2022-08-01
Parametry identyfikatora URI
Nazwa |
W |
Wymagane |
Typ |
Opis |
accountName
|
path |
True
|
string
|
Nazwa konta usługi Media Services.
|
contentKeyPolicyName
|
path |
True
|
string
|
Nazwa zasad klucza zawartości.
|
resourceGroupName
|
path |
True
|
string
|
Nazwa grupy zasobów w ramach subskrypcji platformy Azure.
|
subscriptionId
|
path |
True
|
string
|
Unikatowy identyfikator subskrypcji platformy Microsoft Azure.
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API do użycia z żądaniem klienta.
|
Treść żądania
Nazwa |
Wymagane |
Typ |
Opis |
properties.options
|
True
|
ContentKeyPolicyOption[]
|
Opcje zasad klucza.
|
properties.description
|
|
string
|
Opis zasad.
|
Odpowiedzi
Przykłady
Creates a Content Key Policy with ClearKey option and Token Restriction
Przykładowe żądanie
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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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
Przykładowa odpowiedź
{
"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
Przykładowe żądanie
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
Przykładowa odpowiedź
{
"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"
}
}
]
}
}
Definicje
ContentKeyPolicy
Zasób zasad klucza zawartości.
Nazwa |
Typ |
Opis |
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Ex — /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
Nazwa zasobu
|
properties.created
|
string
|
Data utworzenia zasad
|
properties.description
|
string
|
Opis zasad.
|
properties.lastModified
|
string
|
Data ostatniej modyfikacji zasad
|
properties.options
|
ContentKeyPolicyOption[]
|
Opcje zasad klucza.
|
properties.policyId
|
string
|
Starszy identyfikator zasad.
|
systemData
|
systemData
|
Metadane systemowe dotyczące tego zasobu.
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
ContentKeyPolicyClearKeyConfiguration
Reprezentuje konfigurację kluczy innych niż DRM.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration
|
Dyskryminujący dla typów pochodnych.
|
ContentKeyPolicyFairPlayConfiguration
Określa konfigurację licencji FairPlay.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration
|
Dyskryminujący dla typów pochodnych.
|
ask
|
string
|
Klucz, który musi być używany jako klucz tajny aplikacji FairPlay. Musi to być zakodowane w formacie base64.
|
fairPlayPfx
|
string
|
Reprezentacja certyfikatu FairPlay w formacie PKCS 12 (pfx) (w tym klucza prywatnego).
|
fairPlayPfxPassword
|
string
|
Hasło szyfrujące certyfikat FairPlay w formacie PKCS 12 (pfx).
|
offlineRentalConfiguration
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
|
Zasady wynajmu w trybie offline
|
rentalAndLeaseKeyType
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
|
Typ klucza wynajmu i dzierżawy.
|
rentalDuration
|
integer
|
Czas trwania wynajmu. Musi być równa 0 lub większa.
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
Nazwa |
Typ |
Opis |
playbackDurationSeconds
|
integer
|
Czas trwania odtwarzania
|
storageDurationSeconds
|
integer
|
Okres przechowywania
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
Typ klucza wynajmu i dzierżawy.
Nazwa |
Typ |
Opis |
DualExpiry
|
string
|
Podwójne wygaśnięcie w przypadku wynajmu w trybie offline.
|
PersistentLimited
|
string
|
Klucz zawartości można utrwalić, a prawidłowy czas trwania jest ograniczony przez wartość Czas trwania wynajmu
|
PersistentUnlimited
|
string
|
Klucz zawartości można utrwalić z nieograniczonym czasem trwania
|
Undefined
|
string
|
Nie określono czasu trwania klucza.
|
Unknown
|
string
|
Reprezentuje właściwość ContentKeyPolicyFairPlayRentalAndLeaseKeyType, która jest niedostępna w bieżącej wersji interfejsu API.
|
ContentKeyPolicyOpenRestriction
Reprezentuje otwarte ograniczenie. Licencja lub klucz zostaną dostarczone na każde żądanie.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyOpenRestriction
|
Dyskryminujący dla typów pochodnych.
|
ContentKeyPolicyOption
Reprezentuje opcję zasad.
Nazwa |
Typ |
Opis |
configuration
|
ContentKeyPolicyConfiguration:
|
Konfiguracja dostarczania klucza.
|
name
|
string
|
Opis opcji zasad.
|
policyOptionId
|
string
|
Starszy identyfikator opcji zasad.
|
restriction
|
ContentKeyPolicyRestriction:
|
Wymagania, które należy spełnić, aby dostarczać klucze przy użyciu tej konfiguracji
|
ContentKeyPolicyPlayReadyConfiguration
Określa konfigurację licencji PlayReady.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration
|
Dyskryminujący dla typów pochodnych.
|
licenses
|
ContentKeyPolicyPlayReadyLicense[]
|
Licencje PlayReady.
|
responseCustomData
|
string
|
Niestandardowe dane odpowiedzi.
|
Określa, że identyfikator klucza zawartości znajduje się w nagłówku PlayReady.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader
|
Dyskryminujący dla typów pochodnych.
|
ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
Określa, że identyfikator klucza zawartości jest określony w konfiguracji PlayReady.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
|
Dyskryminujący dla typów pochodnych.
|
keyId
|
string
|
Identyfikator klucza zawartości.
|
ContentKeyPolicyPlayReadyContentType
Typ zawartości PlayReady.
Nazwa |
Typ |
Opis |
UltraVioletDownload
|
string
|
Typ zawartości pobierania ultrafioletu.
|
UltraVioletStreaming
|
string
|
Typ zawartości przesyłania strumieniowego ultrafioletu.
|
Unknown
|
string
|
Reprezentuje właściwość ContentKeyPolicyPlayReadyContentType, która jest niedostępna w bieżącej wersji interfejsu API.
|
Unspecified
|
string
|
Nieokreślony typ zawartości.
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
Konfiguruje bity kontroli ograniczeń jawnej telewizji analogowych. Aby uzyskać więcej informacji, zobacz Reguły zgodności PlayReady.
Nazwa |
Typ |
Opis |
bestEffort
|
boolean
|
Wskazuje, czy to ograniczenie jest wymuszane na podstawie najlepszego nakładu pracy.
|
configurationData
|
integer
|
Konfiguruje bity kontroli ograniczeń. Musi należeć do zakresu od 0 do 3 włącznie.
|
ContentKeyPolicyPlayReadyLicense
Licencja PlayReady
Nazwa |
Typ |
Opis |
allowTestDevices
|
boolean
|
Flaga wskazująca, czy urządzenia testowe mogą korzystać z licencji.
|
beginDate
|
string
|
Data rozpoczęcia licencji
|
contentKeyLocation
|
ContentKeyPolicyPlayReadyContentKeyLocation:
|
Lokalizacja klucza zawartości.
|
contentType
|
ContentKeyPolicyPlayReadyContentType
|
Typ zawartości PlayReady.
|
expirationDate
|
string
|
Data wygaśnięcia licencji.
|
gracePeriod
|
string
|
Okres prolongaty licencji.
|
licenseType
|
ContentKeyPolicyPlayReadyLicenseType
|
Typ licencji.
|
playRight
|
ContentKeyPolicyPlayReadyPlayRight
|
Licencja PlayRight
|
relativeBeginDate
|
string
|
Względna data rozpoczęcia licencji.
|
relativeExpirationDate
|
string
|
Względna data wygaśnięcia licencji.
|
securityLevel
|
SecurityLevel
|
Poziom zabezpieczeń.
|
ContentKeyPolicyPlayReadyLicenseType
Typ licencji.
Nazwa |
Typ |
Opis |
NonPersistent
|
string
|
Licencja nietrwalna.
|
Persistent
|
string
|
Licencja trwała. Umożliwia odtwarzanie w trybie offline.
|
Unknown
|
string
|
Reprezentuje właściwość ContentKeyPolicyPlayReadyLicenseType, która jest niedostępna w bieżącej wersji interfejsu API.
|
ContentKeyPolicyPlayReadyPlayRight
Konfiguruje prawo odtwarzania w licencji PlayReady.
Nazwa |
Typ |
Opis |
agcAndColorStripeRestriction
|
integer
|
Konfiguruje automatyczną kontrolę przyrostu (AGC) i pasek kolorów w licencji. Musi należeć do zakresu od 0 do 3 włącznie.
|
allowPassingVideoContentToUnknownOutput
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
|
Konfiguruje ustawienia obsługi nieznanych danych wyjściowych licencji.
|
analogVideoOpl
|
integer
|
Określa poziom ochrony danych wyjściowych dla skompresowanego dźwięku cyfrowego.
|
compressedDigitalAudioOpl
|
integer
|
Określa poziom ochrony danych wyjściowych dla skompresowanego dźwięku cyfrowego.
|
compressedDigitalVideoOpl
|
integer
|
Określa poziom ochrony danych wyjściowych skompresowanego cyfrowego wideo.
|
digitalVideoOnlyContentRestriction
|
boolean
|
Włącza ograniczenie obrazu dla ograniczeń wideo składników analogowych w licencji.
|
explicitAnalogTelevisionOutputRestriction
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
|
Konfiguruje ograniczenie danych wyjściowych jawnej telewizji analogowych w licencji. Dane konfiguracji muszą należeć do zakresu od 0 do 3 włącznie.
|
firstPlayExpiration
|
string
|
Czas ważności licencji po pierwszym użyciu licencji do odtwarzania zawartości.
|
imageConstraintForAnalogComponentVideoRestriction
|
boolean
|
Włącza ograniczenie obrazu dla ograniczeń wideo składników analogowych w licencji.
|
imageConstraintForAnalogComputerMonitorRestriction
|
boolean
|
Włącza ograniczenie obrazu dla ograniczeń wideo składników analogowych w licencji.
|
scmsRestriction
|
integer
|
Konfiguruje system zarządzania kopiowaniem szeregowym (SCMS) w licencji. Musi należeć do zakresu od 0 do 3 włącznie.
|
uncompressedDigitalAudioOpl
|
integer
|
Określa poziom ochrony danych wyjściowych dla nieskompresowanego dźwięku cyfrowego.
|
uncompressedDigitalVideoOpl
|
integer
|
Określa poziom ochrony danych wyjściowych dla nieskompresowanego cyfrowego wideo.
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
Konfiguruje ustawienia obsługi nieznanych danych wyjściowych licencji.
Nazwa |
Typ |
Opis |
Allowed
|
string
|
Przekazywanie części chronionej zawartości wideo do nieznanych danych wyjściowych jest dozwolone.
|
AllowedWithVideoConstriction
|
string
|
Przekazywanie części chronionej zawartości wideo do nieznanych danych wyjściowych jest dozwolone, ale z ograniczonym rozwiązaniem.
|
NotAllowed
|
string
|
Przekazywanie części chronionej zawartości wideo do nieznanych danych wyjściowych jest niedozwolone.
|
Unknown
|
string
|
Reprezentuje element ContentKeyPolicyPlayReadyUnknownOutputPassingOption, który jest niedostępny w bieżącej wersji interfejsu API.
|
ContentKeyPolicyRestrictionTokenType
Typ tokenu.
Nazwa |
Typ |
Opis |
Jwt
|
string
|
Token internetowy JSON.
|
Swt
|
string
|
Prosty token internetowy.
|
Unknown
|
string
|
Reprezentuje właściwość ContentKeyPolicyRestrictionTokenType, która jest niedostępna w bieżącej wersji interfejsu API.
|
ContentKeyPolicyRsaTokenKey
Określa klucz RSA do weryfikacji tokenu
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyRsaTokenKey
|
Dyskryminujący dla typów pochodnych.
|
exponent
|
string
|
Wykładnik parametru RSA
|
modulus
|
string
|
Modulus parametru RSA
|
ContentKeyPolicySymmetricTokenKey
Określa klucz symetryczny na potrzeby walidacji tokenu.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicySymmetricTokenKey
|
Dyskryminujący dla typów pochodnych.
|
keyValue
|
string
|
Wartość klucza klucza
|
ContentKeyPolicyTokenClaim
Reprezentuje oświadczenie tokenu.
Nazwa |
Typ |
Opis |
claimType
|
string
|
Typ oświadczenia tokenu.
|
claimValue
|
string
|
Wartość oświadczenia tokenu.
|
ContentKeyPolicyTokenRestriction
Reprezentuje ograniczenie tokenu. Podany token musi być zgodny z tymi wymaganiami dotyczącymi pomyślnego dostarczania licencji lub klucza.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyTokenRestriction
|
Dyskryminujący dla typów pochodnych.
|
alternateVerificationKeys
|
ContentKeyPolicyRestrictionTokenKey[]:
|
Lista alternatywnych kluczy weryfikacji.
|
audience
|
string
|
Odbiorcy tokenu.
|
issuer
|
string
|
Wystawca tokenu.
|
openIdConnectDiscoveryDocument
|
string
|
Dokument OpenID connect discovery.
|
primaryVerificationKey
|
ContentKeyPolicyRestrictionTokenKey:
|
Podstawowy klucz weryfikacyjny.
|
requiredClaims
|
ContentKeyPolicyTokenClaim[]
|
Lista wymaganych oświadczeń tokenu.
|
restrictionTokenType
|
ContentKeyPolicyRestrictionTokenType
|
Typ tokenu.
|
ContentKeyPolicyUnknownConfiguration
Reprezentuje właściwość ContentKeyPolicyConfiguration, która jest niedostępna w bieżącej wersji interfejsu API.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownConfiguration
|
Dyskryminujący dla typów pochodnych.
|
ContentKeyPolicyUnknownRestriction
Reprezentuje właściwość ContentKeyPolicyRestriction niedostępną w bieżącej wersji interfejsu API.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownRestriction
|
Dyskryminujący dla typów pochodnych.
|
ContentKeyPolicyWidevineConfiguration
Określa konfigurację licencji Widevine.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyWidevineConfiguration
|
Dyskryminujący dla typów pochodnych.
|
widevineTemplate
|
string
|
Szablon Widevine.
|
ContentKeyPolicyX509CertificateTokenKey
Określa certyfikat weryfikacji tokenu.
Nazwa |
Typ |
Opis |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey
|
Dyskryminujący dla typów pochodnych.
|
rawBody
|
string
|
Pole nieprzetworzonych danych certyfikatu w formacie PKCS 12 (X509Certificate2 na platformie .NET)
|
createdByType
Typ tożsamości, która utworzyła zasób.
Nazwa |
Typ |
Opis |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
Dodatkowe informacje o błędzie zarządzania zasobami.
Nazwa |
Typ |
Opis |
info
|
object
|
Dodatkowe informacje.
|
type
|
string
|
Dodatkowy typ informacji.
|
ErrorDetail
Szczegóły błędu.
Nazwa |
Typ |
Opis |
additionalInfo
|
ErrorAdditionalInfo[]
|
Dodatkowe informacje o błędzie.
|
code
|
string
|
Kod błędu.
|
details
|
ErrorDetail[]
|
Szczegóły błędu.
|
message
|
string
|
Komunikat o błędzie.
|
target
|
string
|
Element docelowy błędu.
|
ErrorResponse
Odpowiedź na błąd
SecurityLevel
Poziom zabezpieczeń.
Nazwa |
Typ |
Opis |
SL150
|
string
|
W przypadku klientów w ramach programowania lub testowania. Brak ochrony przed nieautoryzowanym użyciem.
|
SL2000
|
string
|
W przypadku urządzeń ze wzmocnionym zabezpieczeniami i aplikacji korzystających z zawartości komercyjnej. Ochrona oprogramowania lub sprzętu.
|
SL3000
|
string
|
Tylko w przypadku urządzeń ze wzmocnionym zabezpieczeniami. Ochrona sprzętowa.
|
Unknown
|
string
|
Reprezentuje element SecurityLevel, który jest niedostępny w bieżącej wersji interfejsu API.
|
systemData
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
Nazwa |
Typ |
Opis |
createdAt
|
string
|
Sygnatura czasowa tworzenia zasobu (UTC).
|
createdBy
|
string
|
Tożsamość, która utworzyła zasób.
|
createdByType
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
lastModifiedAt
|
string
|
Sygnatura czasowa ostatniej modyfikacji zasobu (UTC)
|
lastModifiedBy
|
string
|
Tożsamość, która ostatnio zmodyfikowała zasób.
|
lastModifiedByType
|
createdByType
|
Typ tożsamości, która ostatnio zmodyfikowała zasób.
|