콘텐츠 키 정책 나열
계정에서 콘텐츠 키 정책 Lists
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies?api-version=2022-08-01
With optional parameters:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies?api-version=2022-08-01&$filter={$filter}&$top={$top}&$orderby={$orderby}
URI 매개 변수
Name |
In(다음 안에) |
필수 |
형식 |
Description |
accountName
|
path |
True
|
string
|
Media Services 계정 이름입니다.
|
resourceGroupName
|
path |
True
|
string
|
Azure 구독 내의 리소스 그룹 이름입니다.
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure 구독의 고유 식별자입니다.
|
api-version
|
query |
True
|
string
|
클라이언트 요청과 함께 사용할 API의 버전입니다.
|
$filter
|
query |
|
string
|
반환된 항목 집합을 제한합니다.
|
$orderby
|
query |
|
string
|
결과 컬렉션을 정렬할 키를 지정합니다.
|
$top
|
query |
|
integer
int32
|
컬렉션에서 반환되는 항목 수를 제한하는 음수가 아닌 정수 n을 지정합니다. 서비스는 지정된 값 n보다 크지만 최대 사용 가능한 항목 수를 반환합니다.
|
응답
예제
Lists all Content Key Policies
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/contentKeyPolicies?api-version=2022-08-01
/** Samples for ContentKeyPolicies List. */
public final class Main {
/*
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-all.json
*/
/**
* Sample code: Lists all Content Key Policies.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void listsAllContentKeyPolicies(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager
.contentKeyPolicies()
.list("contosorg", "contosomedia", null, null, null, com.azure.core.util.Context.NONE);
}
}
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 contentkeypolicieslistall.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.list(
resource_group_name="contoso",
account_name="contosomedia",
)
for item in response:
print(item)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-all.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/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-list-all.json
func ExampleContentKeyPoliciesClient_NewListPager_listsAllContentKeyPolicies() {
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)
}
pager := clientFactory.NewContentKeyPoliciesClient().NewListPager("contoso", "contosomedia", &armmediaservices.ContentKeyPoliciesClientListOptions{Filter: nil,
Top: nil,
Orderby: nil,
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.ContentKeyPolicyCollection = armmediaservices.ContentKeyPolicyCollection{
// Value: []*armmediaservices.ContentKeyPolicy{
// {
// Name: to.Ptr("PolicyWithClearKeyOptionAndTokenRestriction"),
// Type: to.Ptr("Microsoft.Media/mediaservices/contentKeyPolicies"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithClearKeyOptionAndTokenRestriction"),
// Properties: &armmediaservices.ContentKeyPolicyProperties{
// Description: to.Ptr("A policy with one ClearKey option and Open Restriction."),
// Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-01T00:00:00.000Z"); return t}()),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-01T00:00:00.000Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"),
// },
// PolicyOptionID: to.Ptr("a3448d09-567a-4642-8309-d17e846be59f"),
// Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
// AlternateVerificationKeys: []armmediaservices.ContentKeyPolicyRestrictionTokenKeyClassification{
// },
// Audience: to.Ptr("urn:test"),
// Issuer: to.Ptr("http://testacs"),
// PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
// KeyValue: []byte(""),
// },
// RequiredClaims: []*armmediaservices.ContentKeyPolicyTokenClaim{
// {
// ClaimType: to.Ptr("urn:microsoft:azure:mediaservices:contentkeyidentifier"),
// },
// {
// ClaimType: to.Ptr("DRM"),
// ClaimValue: to.Ptr("Widevine"),
// }},
// RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeJwt),
// },
// }},
// PolicyID: to.Ptr("8352435b-ebea-4681-aae7-e19277771f64"),
// },
// },
// {
// Name: to.Ptr("PolicyWithMultipleOptions"),
// Type: to.Ptr("Microsoft.Media/mediaservices/contentKeyPolicies"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithMultipleOptions"),
// Properties: &armmediaservices.ContentKeyPolicyProperties{
// Description: to.Ptr("A policy with multiple options."),
// Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-12-01T00:00:00.000Z"); return t}()),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-02T00:00:00.000Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"),
// },
// PolicyOptionID: to.Ptr("caf1e28c-8288-4301-8c46-c0f9312c512f"),
// Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
// AlternateVerificationKeys: []armmediaservices.ContentKeyPolicyRestrictionTokenKeyClassification{
// },
// Audience: to.Ptr("urn:test"),
// Issuer: to.Ptr("http://testacs"),
// PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
// KeyValue: []byte(""),
// },
// RequiredClaims: []*armmediaservices.ContentKeyPolicyTokenClaim{
// {
// ClaimType: to.Ptr("urn:microsoft:azure:mediaservices:contentkeyidentifier"),
// },
// {
// ClaimType: to.Ptr("DRM"),
// ClaimValue: to.Ptr("Widevine"),
// }},
// RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeJwt),
// },
// },
// {
// 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("da346259-0cd6-4609-89dc-15ac131bd92f"),
// Restriction: &armmediaservices.ContentKeyPolicyOpenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyOpenRestriction"),
// },
// }},
// PolicyID: to.Ptr("ed7f3d1b-cfa7-4181-b966-e0b3027eec3a"),
// },
// },
// {
// 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("A policy with one PlayReady option and Open Restriction."),
// 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, "2012-11-01T00:00:00.000Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Configuration: &armmediaservices.ContentKeyPolicyPlayReadyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration"),
// Licenses: []*armmediaservices.ContentKeyPolicyPlayReadyLicense{
// {
// AllowTestDevices: to.Ptr(false),
// ContentKeyLocation: &armmediaservices.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"),
// },
// ContentType: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyContentTypeUnspecified),
// LicenseType: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyLicenseTypeNonPersistent),
// PlayRight: &armmediaservices.ContentKeyPolicyPlayReadyPlayRight{
// AllowPassingVideoContentToUnknownOutput: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed),
// DigitalVideoOnlyContentRestriction: to.Ptr(false),
// ImageConstraintForAnalogComponentVideoRestriction: to.Ptr(false),
// ImageConstraintForAnalogComputerMonitorRestriction: to.Ptr(false),
// },
// SecurityLevel: to.Ptr(armmediaservices.SecurityLevelSL2000),
// }},
// ResponseCustomData: to.Ptr("testCustomData"),
// },
// PolicyOptionID: to.Ptr("294a833f-f128-48be-9edf-8d1bb5b35ff3"),
// 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 Lists the Content Key Policies in the account
*
* @summary Lists the Content Key Policies in the account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-all.json
*/
async function listsAllContentKeyPolicies() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.contentKeyPolicies.list(resourceGroupName, accountName)) {
resArray.push(item);
}
console.log(resArray);
}
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-list-all.json
// this example is just showing the usage of "ContentKeyPolicies_List" 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 and iterate over the result
await foreach (ContentKeyPolicyResource item in collection.GetAllAsync())
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
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
{
"value": [
{
"name": "PolicyWithClearKeyOptionAndTokenRestriction",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithClearKeyOptionAndTokenRestriction",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "8352435b-ebea-4681-aae7-e19277771f64",
"created": "2017-12-01T00:00:00Z",
"lastModified": "2017-11-01T00:00:00Z",
"description": "A policy with one ClearKey option and Open Restriction.",
"options": [
{
"policyOptionId": "a3448d09-567a-4642-8309-d17e846be59f",
"name": null,
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "http://testacs",
"audience": "urn:test",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
},
"alternateVerificationKeys": [],
"requiredClaims": [
{
"claimType": "urn:microsoft:azure:mediaservices:contentkeyidentifier",
"claimValue": null
},
{
"claimType": "DRM",
"claimValue": "Widevine"
}
],
"restrictionTokenType": "Jwt",
"openIdConnectDiscoveryDocument": null
}
}
]
}
},
{
"name": "PolicyWithMultipleOptions",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithMultipleOptions",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "ed7f3d1b-cfa7-4181-b966-e0b3027eec3a",
"created": "2015-12-01T00:00:00Z",
"lastModified": "2016-12-02T00:00:00Z",
"description": "A policy with multiple options.",
"options": [
{
"policyOptionId": "caf1e28c-8288-4301-8c46-c0f9312c512f",
"name": null,
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "http://testacs",
"audience": "urn:test",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
},
"alternateVerificationKeys": [],
"requiredClaims": [
{
"claimType": "urn:microsoft:azure:mediaservices:contentkeyidentifier",
"claimValue": null
},
{
"claimType": "DRM",
"claimValue": "Widevine"
}
],
"restrictionTokenType": "Jwt",
"openIdConnectDiscoveryDocument": null
}
},
{
"policyOptionId": "da346259-0cd6-4609-89dc-15ac131bd92f",
"name": null,
"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": "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": "2012-11-01T00:00:00Z",
"description": "A policy with one PlayReady option and Open Restriction.",
"options": [
{
"policyOptionId": "294a833f-f128-48be-9edf-8d1bb5b35ff3",
"name": null,
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration",
"licenses": [
{
"allowTestDevices": false,
"beginDate": null,
"expirationDate": null,
"relativeBeginDate": null,
"relativeExpirationDate": null,
"gracePeriod": null,
"playRight": {
"firstPlayExpiration": null,
"scmsRestriction": null,
"agcAndColorStripeRestriction": null,
"explicitAnalogTelevisionOutputRestriction": null,
"digitalVideoOnlyContentRestriction": false,
"imageConstraintForAnalogComponentVideoRestriction": false,
"imageConstraintForAnalogComputerMonitorRestriction": false,
"allowPassingVideoContentToUnknownOutput": "NotAllowed",
"uncompressedDigitalVideoOpl": null,
"compressedDigitalVideoOpl": null,
"analogVideoOpl": null,
"compressedDigitalAudioOpl": null,
"uncompressedDigitalAudioOpl": null
},
"licenseType": "NonPersistent",
"contentKeyLocation": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"
},
"contentType": "Unspecified",
"securityLevel": "SL2000"
}
],
"responseCustomData": "testCustomData"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"
}
}
]
}
}
]
}
Lists Content Key Policies ordered by last modified.
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/contentKeyPolicies?api-version=2022-08-01&$orderby=properties/lastModified
/** Samples for ContentKeyPolicies List. */
public final class Main {
/*
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-by-lastModified.json
*/
/**
* Sample code: Lists Content Key Policies ordered by last modified.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void listsContentKeyPoliciesOrderedByLastModified(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager
.contentKeyPolicies()
.list("contosorg", "contosomedia", null, null, "properties/lastModified", com.azure.core.util.Context.NONE);
}
}
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 contentkeypolicieslistbylast_modified.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.list(
resource_group_name="contoso",
account_name="contosomedia",
)
for item in response:
print(item)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-by-lastModified.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-list-by-lastModified.json
func ExampleContentKeyPoliciesClient_NewListPager_listsContentKeyPoliciesOrderedByLastModified() {
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)
}
pager := clientFactory.NewContentKeyPoliciesClient().NewListPager("contoso", "contosomedia", &armmediaservices.ContentKeyPoliciesClientListOptions{Filter: nil,
Top: nil,
Orderby: to.Ptr("properties/lastModified"),
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.ContentKeyPolicyCollection = armmediaservices.ContentKeyPolicyCollection{
// Value: []*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("A policy with one PlayReady option and Open Restriction."),
// 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, "2012-11-01T00:00:00.000Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Configuration: &armmediaservices.ContentKeyPolicyPlayReadyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration"),
// Licenses: []*armmediaservices.ContentKeyPolicyPlayReadyLicense{
// {
// AllowTestDevices: to.Ptr(false),
// ContentKeyLocation: &armmediaservices.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"),
// },
// ContentType: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyContentTypeUnspecified),
// LicenseType: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyLicenseTypeNonPersistent),
// PlayRight: &armmediaservices.ContentKeyPolicyPlayReadyPlayRight{
// AllowPassingVideoContentToUnknownOutput: to.Ptr(armmediaservices.ContentKeyPolicyPlayReadyUnknownOutputPassingOptionNotAllowed),
// DigitalVideoOnlyContentRestriction: to.Ptr(false),
// ImageConstraintForAnalogComponentVideoRestriction: to.Ptr(false),
// ImageConstraintForAnalogComputerMonitorRestriction: to.Ptr(false),
// },
// SecurityLevel: to.Ptr(armmediaservices.SecurityLevelSL2000),
// }},
// ResponseCustomData: to.Ptr("testCustomData"),
// },
// PolicyOptionID: to.Ptr("294a833f-f128-48be-9edf-8d1bb5b35ff3"),
// Restriction: &armmediaservices.ContentKeyPolicyOpenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyOpenRestriction"),
// },
// }},
// PolicyID: to.Ptr("a9bacd1d-60f5-4af3-8d2b-cf46ca5c9b04"),
// },
// },
// {
// Name: to.Ptr("PolicyWithMultipleOptions"),
// Type: to.Ptr("Microsoft.Media/mediaservices/contentKeyPolicies"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithMultipleOptions"),
// Properties: &armmediaservices.ContentKeyPolicyProperties{
// Description: to.Ptr("A policy with multiple options."),
// Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-12-01T00:00:00.000Z"); return t}()),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-12-02T00:00:00.000Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"),
// },
// PolicyOptionID: to.Ptr("caf1e28c-8288-4301-8c46-c0f9312c512f"),
// Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
// AlternateVerificationKeys: []armmediaservices.ContentKeyPolicyRestrictionTokenKeyClassification{
// },
// Audience: to.Ptr("urn:test"),
// Issuer: to.Ptr("http://testacs"),
// PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
// KeyValue: []byte(""),
// },
// RequiredClaims: []*armmediaservices.ContentKeyPolicyTokenClaim{
// {
// ClaimType: to.Ptr("urn:microsoft:azure:mediaservices:contentkeyidentifier"),
// },
// {
// ClaimType: to.Ptr("DRM"),
// ClaimValue: to.Ptr("Widevine"),
// }},
// RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeJwt),
// },
// },
// {
// 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("da346259-0cd6-4609-89dc-15ac131bd92f"),
// Restriction: &armmediaservices.ContentKeyPolicyOpenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyOpenRestriction"),
// },
// }},
// PolicyID: to.Ptr("ed7f3d1b-cfa7-4181-b966-e0b3027eec3a"),
// },
// },
// {
// Name: to.Ptr("PolicyWithClearKeyOptionAndTokenRestriction"),
// Type: to.Ptr("Microsoft.Media/mediaservices/contentKeyPolicies"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithClearKeyOptionAndTokenRestriction"),
// Properties: &armmediaservices.ContentKeyPolicyProperties{
// Description: to.Ptr("A policy with one ClearKey option and Open Restriction."),
// Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-01T00:00:00.000Z"); return t}()),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-11-01T00:00:00.000Z"); return t}()),
// Options: []*armmediaservices.ContentKeyPolicyOption{
// {
// Configuration: &armmediaservices.ContentKeyPolicyClearKeyConfiguration{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"),
// },
// PolicyOptionID: to.Ptr("a3448d09-567a-4642-8309-d17e846be59f"),
// Restriction: &armmediaservices.ContentKeyPolicyTokenRestriction{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicyTokenRestriction"),
// AlternateVerificationKeys: []armmediaservices.ContentKeyPolicyRestrictionTokenKeyClassification{
// },
// Audience: to.Ptr("urn:test"),
// Issuer: to.Ptr("http://testacs"),
// PrimaryVerificationKey: &armmediaservices.ContentKeyPolicySymmetricTokenKey{
// ODataType: to.Ptr("#Microsoft.Media.ContentKeyPolicySymmetricTokenKey"),
// KeyValue: []byte(""),
// },
// RequiredClaims: []*armmediaservices.ContentKeyPolicyTokenClaim{
// {
// ClaimType: to.Ptr("urn:microsoft:azure:mediaservices:contentkeyidentifier"),
// },
// {
// ClaimType: to.Ptr("DRM"),
// ClaimValue: to.Ptr("Widevine"),
// }},
// RestrictionTokenType: to.Ptr(armmediaservices.ContentKeyPolicyRestrictionTokenTypeJwt),
// },
// }},
// PolicyID: to.Ptr("8352435b-ebea-4681-aae7-e19277771f64"),
// },
// }},
// }
}
}
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 Lists the Content Key Policies in the account
*
* @summary Lists the Content Key Policies in the account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-by-lastModified.json
*/
async function listsContentKeyPoliciesOrderedByLastModified() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const orderby = "properties/lastModified";
const options = { orderby };
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.contentKeyPolicies.list(resourceGroupName, accountName, options)) {
resArray.push(item);
}
console.log(resArray);
}
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-list-by-lastModified.json
// this example is just showing the usage of "ContentKeyPolicies_List" 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 and iterate over the result
string orderby = "properties/lastModified";
await foreach (ContentKeyPolicyResource item in collection.GetAllAsync(orderby: orderby))
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
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
{
"value": [
{
"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": "2012-11-01T00:00:00Z",
"description": "A policy with one PlayReady option and Open Restriction.",
"options": [
{
"policyOptionId": "294a833f-f128-48be-9edf-8d1bb5b35ff3",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration",
"licenses": [
{
"allowTestDevices": false,
"playRight": {
"digitalVideoOnlyContentRestriction": false,
"imageConstraintForAnalogComponentVideoRestriction": false,
"imageConstraintForAnalogComputerMonitorRestriction": false,
"allowPassingVideoContentToUnknownOutput": "NotAllowed"
},
"licenseType": "NonPersistent",
"contentKeyLocation": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader"
},
"contentType": "Unspecified",
"securityLevel": "SL2000"
}
],
"responseCustomData": "testCustomData"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyOpenRestriction"
}
}
]
}
},
{
"name": "PolicyWithMultipleOptions",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithMultipleOptions",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "ed7f3d1b-cfa7-4181-b966-e0b3027eec3a",
"created": "2015-12-01T00:00:00Z",
"lastModified": "2016-12-02T00:00:00Z",
"description": "A policy with multiple options.",
"options": [
{
"policyOptionId": "caf1e28c-8288-4301-8c46-c0f9312c512f",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "http://testacs",
"audience": "urn:test",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
},
"alternateVerificationKeys": [],
"requiredClaims": [
{
"claimType": "urn:microsoft:azure:mediaservices:contentkeyidentifier"
},
{
"claimType": "DRM",
"claimValue": "Widevine"
}
],
"restrictionTokenType": "Jwt"
}
},
{
"policyOptionId": "da346259-0cd6-4609-89dc-15ac131bd92f",
"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": "PolicyWithClearKeyOptionAndTokenRestriction",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/contentKeyPolicies/PolicyWithClearKeyOptionAndTokenRestriction",
"type": "Microsoft.Media/mediaservices/contentKeyPolicies",
"properties": {
"policyId": "8352435b-ebea-4681-aae7-e19277771f64",
"created": "2017-12-01T00:00:00Z",
"lastModified": "2017-11-01T00:00:00Z",
"description": "A policy with one ClearKey option and Open Restriction.",
"options": [
{
"policyOptionId": "a3448d09-567a-4642-8309-d17e846be59f",
"configuration": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration"
},
"restriction": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicyTokenRestriction",
"issuer": "http://testacs",
"audience": "urn:test",
"primaryVerificationKey": {
"@odata.type": "#Microsoft.Media.ContentKeyPolicySymmetricTokenKey",
"keyValue": ""
},
"alternateVerificationKeys": [],
"requiredClaims": [
{
"claimType": "urn:microsoft:azure:mediaservices:contentkeyidentifier"
},
{
"claimType": "DRM",
"claimValue": "Widevine"
}
],
"restrictionTokenType": "Jwt"
}
}
]
}
}
]
}
Lists Content Key Policies with created and last modified filters.
Sample Request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/contentKeyPolicies?api-version=2022-08-01&$filter=properties/lastModified gt 2016-06-01 and properties/created lt 2013-07-01
/** Samples for ContentKeyPolicies List. */
public final class Main {
/*
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-in-date-range.json
*/
/**
* Sample code: Lists Content Key Policies with created and last modified filters.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void listsContentKeyPoliciesWithCreatedAndLastModifiedFilters(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager
.contentKeyPolicies()
.list(
"contosorg",
"contosomedia",
"properties/lastModified gt 2016-06-01 and properties/created lt 2013-07-01",
null,
null,
com.azure.core.util.Context.NONE);
}
}
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 contentkeypolicieslistindaterange.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.list(
resource_group_name="contoso",
account_name="contosomedia",
)
for item in response:
print(item)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-in-date-range.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-list-in-date-range.json
func ExampleContentKeyPoliciesClient_NewListPager_listsContentKeyPoliciesWithCreatedAndLastModifiedFilters() {
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)
}
pager := clientFactory.NewContentKeyPoliciesClient().NewListPager("contoso", "contosomedia", &armmediaservices.ContentKeyPoliciesClientListOptions{Filter: to.Ptr("properties/lastModified gt 2016-06-01 and properties/created lt 2013-07-01"),
Top: nil,
Orderby: nil,
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.ContentKeyPolicyCollection = armmediaservices.ContentKeyPolicyCollection{
// Value: []*armmediaservices.ContentKeyPolicy{
// },
// }
}
}
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 Lists the Content Key Policies in the account
*
* @summary Lists the Content Key Policies in the account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/content-key-policies-list-in-date-range.json
*/
async function listsContentKeyPoliciesWithCreatedAndLastModifiedFilters() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const filter = "properties/lastModified gt 2016-06-01 and properties/created lt 2013-07-01";
const options = { filter };
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.contentKeyPolicies.list(resourceGroupName, accountName, options)) {
resArray.push(item);
}
console.log(resArray);
}
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-list-in-date-range.json
// this example is just showing the usage of "ContentKeyPolicies_List" 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 and iterate over the result
string filter = "properties/lastModified gt 2016-06-01 and properties/created lt 2013-07-01";
await foreach (ContentKeyPolicyResource item in collection.GetAllAsync(filter: filter))
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
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
{
"value": []
}
정의
ContentKeyPolicy
콘텐츠 키 정책 리소스입니다.
Name |
형식 |
Description |
id
|
string
|
리소스에 대한 정규화된 리소스 ID입니다. 예 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
리소스의 이름입니다.
|
properties.created
|
string
|
정책을 만든 날짜입니다.
|
properties.description
|
string
|
정책에 대한 설명입니다.
|
properties.lastModified
|
string
|
정책을 마지막으로 수정한 날짜입니다.
|
properties.options
|
ContentKeyPolicyOption[]
|
키 정책 옵션입니다.
|
properties.policyId
|
string
|
레거시 정책 ID입니다.
|
systemData
|
systemData
|
이 리소스와 관련된 시스템 메타데이터입니다.
|
type
|
string
|
리소스 형식입니다. 예: "Microsoft.Compute/virtualMachines" 또는 "Microsoft.Storage/storageAccounts"
|
ContentKeyPolicyClearKeyConfiguration
DRM이 아닌 키에 대한 구성을 나타냅니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration
|
파생 형식에 대한 판별자입니다.
|
ContentKeyPolicyCollection
ContentKeyPolicy 항목의 컬렉션입니다.
Name |
형식 |
Description |
@odata.nextLink
|
string
|
컬렉션의 다음 페이지에 대한 링크입니다(컬렉션에 하나의 응답으로 반환할 결과가 너무 많은 경우).
|
value
|
ContentKeyPolicy[]
|
ContentKeyPolicy 항목의 컬렉션입니다.
|
ContentKeyPolicyFairPlayConfiguration
FairPlay 라이선스에 대한 구성을 지정합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyFairPlayConfiguration
|
파생 형식에 대한 판별자입니다.
|
ask
|
string
|
FairPlay 애플리케이션 비밀 키로 사용해야 하는 키입니다. 이는 base64로 인코딩되어야 합니다.
|
fairPlayPfx
|
string
|
PKCS 12(pfx) 형식(프라이빗 키 포함)으로 FairPlay 인증서의 Base64 표현입니다.
|
fairPlayPfxPassword
|
string
|
PKCS 12(pfx) 형식의 FairPlay 인증서를 암호화하는 암호입니다.
|
offlineRentalConfiguration
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
|
오프라인 임대 정책
|
rentalAndLeaseKeyType
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
|
임대 및 임대 키 유형입니다.
|
rentalDuration
|
integer
|
대여 기간입니다. 0보다 크거나 같아야 합니다.
|
ContentKeyPolicyFairPlayOfflineRentalConfiguration
Name |
형식 |
Description |
playbackDurationSeconds
|
integer
|
재생 기간
|
storageDurationSeconds
|
integer
|
스토리지 기간
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
임대 및 임대 키 유형입니다.
Name |
형식 |
Description |
DualExpiry
|
string
|
오프라인 임대에 대한 이중 만료.
|
PersistentLimited
|
string
|
콘텐츠 키를 유지할 수 있으며 유효한 기간은 임대 기간 값으로 제한됩니다.
|
PersistentUnlimited
|
string
|
콘텐츠 키는 무제한으로 유지할 수 있습니다.
|
Undefined
|
string
|
키 기간이 지정되지 않았습니다.
|
Unknown
|
string
|
현재 API 버전에서 사용할 수 없는 ContentKeyPolicyFairPlayRentalAndLeaseKeyType을 나타냅니다.
|
ContentKeyPolicyOpenRestriction
열린 제한을 나타냅니다. 라이선스 또는 키는 모든 요청에 따라 전달됩니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyOpenRestriction
|
파생 형식에 대한 판별자입니다.
|
ContentKeyPolicyOption
정책 옵션을 나타냅니다.
Name |
형식 |
Description |
configuration
|
ContentKeyPolicyConfiguration:
|
키 배달 구성입니다.
|
name
|
string
|
정책 옵션 설명입니다.
|
policyOptionId
|
string
|
레거시 정책 옵션 ID입니다.
|
restriction
|
ContentKeyPolicyRestriction:
|
이 구성을 사용하여 키를 제공하기 위해 충족해야 하는 요구 사항
|
ContentKeyPolicyPlayReadyConfiguration
PlayReady 라이선스에 대한 구성을 지정합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration
|
파생 형식에 대한 판별자입니다.
|
licenses
|
ContentKeyPolicyPlayReadyLicense[]
|
PlayReady 라이선스.
|
responseCustomData
|
string
|
사용자 지정 응답 데이터입니다.
|
콘텐츠 키 ID가 PlayReady 헤더에 있음을 지정합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader
|
파생 형식에 대한 판별자입니다.
|
ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
콘텐츠 키 ID가 PlayReady 구성에 지정되도록 지정합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
|
파생 형식에 대한 판별자입니다.
|
keyId
|
string
|
콘텐츠 키 ID입니다.
|
ContentKeyPolicyPlayReadyContentType
PlayReady 콘텐츠 형식입니다.
Name |
형식 |
Description |
UltraVioletDownload
|
string
|
자외선 다운로드 콘텐츠 형식입니다.
|
UltraVioletStreaming
|
string
|
자외선 스트리밍 콘텐츠 형식입니다.
|
Unknown
|
string
|
현재 API 버전에서 사용할 수 없는 ContentKeyPolicyPlayReadyContentType을 나타냅니다.
|
Unspecified
|
string
|
지정되지 않은 콘텐츠 형식입니다.
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
명시적 아날로그 텔레비전 출력 제한 제어 비트를 구성합니다. 자세한 내용은 PlayReady 준수 규칙을 참조하세요.
Name |
형식 |
Description |
bestEffort
|
boolean
|
이 제한이 최상의 노력으로 적용되는지 여부를 나타냅니다.
|
configurationData
|
integer
|
제한 컨트롤 비트를 구성합니다. 0에서 3 사이여야 합니다.
|
ContentKeyPolicyPlayReadyLicense
PlayReady 라이선스
ContentKeyPolicyPlayReadyLicenseType
라이선스 유형입니다.
Name |
형식 |
Description |
NonPersistent
|
string
|
비영구 라이선스.
|
Persistent
|
string
|
영구 라이선스. 오프라인 재생을 허용합니다.
|
Unknown
|
string
|
현재 API 버전에서 사용할 수 없는 ContentKeyPolicyPlayReadyLicenseType을 나타냅니다.
|
ContentKeyPolicyPlayReadyPlayRight
PlayReady 라이선스에서 Play Right를 구성합니다.
Name |
형식 |
Description |
agcAndColorStripeRestriction
|
integer
|
라이선스에서 AGC(자동 게인 제어) 및 Color Stripe를 구성합니다. 0에서 3 사이여야 합니다.
|
allowPassingVideoContentToUnknownOutput
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
|
라이선스의 알 수 없는 출력 처리 설정을 구성합니다.
|
analogVideoOpl
|
integer
|
압축된 디지털 오디오의 출력 보호 수준을 지정합니다.
|
compressedDigitalAudioOpl
|
integer
|
압축된 디지털 오디오의 출력 보호 수준을 지정합니다.
|
compressedDigitalVideoOpl
|
integer
|
압축된 디지털 비디오의 출력 보호 수준을 지정합니다.
|
digitalVideoOnlyContentRestriction
|
boolean
|
라이선스에서 아날로그 구성 요소 비디오 제한에 대한 이미지 제약 조건을 사용하도록 설정합니다.
|
explicitAnalogTelevisionOutputRestriction
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
|
라이선스에 명시적 아날로그 텔레비전 출력 제한을 구성합니다. 구성 데이터는 0에서 3 사이여야 합니다.
|
firstPlayExpiration
|
string
|
라이선스가 콘텐츠를 재생하는 데 처음 사용된 후 라이선스가 유효한 시간입니다.
|
imageConstraintForAnalogComponentVideoRestriction
|
boolean
|
라이선스에서 아날로그 구성 요소 비디오 제한에 대한 이미지 제약 조건을 사용하도록 설정합니다.
|
imageConstraintForAnalogComputerMonitorRestriction
|
boolean
|
라이선스에서 아날로그 구성 요소 비디오 제한에 대한 이미지 제약 조건을 사용하도록 설정합니다.
|
scmsRestriction
|
integer
|
라이선스에서 SCMS(직렬 복사 관리 시스템)를 구성합니다. 0에서 3 사이여야 합니다.
|
uncompressedDigitalAudioOpl
|
integer
|
압축되지 않은 디지털 오디오의 출력 보호 수준을 지정합니다.
|
uncompressedDigitalVideoOpl
|
integer
|
압축되지 않은 디지털 비디오의 출력 보호 수준을 지정합니다.
|
ContentKeyPolicyPlayReadyUnknownOutputPassingOption
라이선스의 알 수 없는 출력 처리 설정을 구성합니다.
Name |
형식 |
Description |
Allowed
|
string
|
보호된 콘텐츠의 비디오 부분을 알 수 없는 출력에 전달할 수 있습니다.
|
AllowedWithVideoConstriction
|
string
|
보호된 콘텐츠의 비디오 부분을 알 수 없는 출력에 전달하는 것은 허용되지만 해상도는 제한됩니다.
|
NotAllowed
|
string
|
보호된 콘텐츠의 비디오 부분을 알 수 없는 출력에 전달할 수 없습니다.
|
Unknown
|
string
|
현재 API 버전에서 사용할 수 없는 ContentKeyPolicyPlayReadyUnknownOutputPassingOption을 나타냅니다.
|
ContentKeyPolicyRestrictionTokenType
토큰의 형식입니다.
Name |
형식 |
Description |
Jwt
|
string
|
JSON 웹 토큰.
|
Swt
|
string
|
단순 웹 토큰입니다.
|
Unknown
|
string
|
현재 API 버전에서 사용할 수 없는 ContentKeyPolicyRestrictionTokenType을 나타냅니다.
|
ContentKeyPolicyRsaTokenKey
토큰 유효성 검사에 대한 RSA 키를 지정합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyRsaTokenKey
|
파생 형식에 대한 판별자입니다.
|
exponent
|
string
|
RSA 매개 변수 지수
|
modulus
|
string
|
RSA 매개 변수 모듈러스
|
ContentKeyPolicySymmetricTokenKey
토큰 유효성 검사에 대칭 키를 지정합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicySymmetricTokenKey
|
파생 형식에 대한 판별자입니다.
|
keyValue
|
string
|
키의 키 값
|
ContentKeyPolicyTokenClaim
토큰 클레임을 나타냅니다.
Name |
형식 |
Description |
claimType
|
string
|
토큰 클레임 유형입니다.
|
claimValue
|
string
|
토큰 클레임 값입니다.
|
ContentKeyPolicyTokenRestriction
토큰 제한을 나타냅니다. 제공된 토큰은 성공적인 라이선스 또는 키 배달을 위해 이러한 요구 사항과 일치해야 합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyTokenRestriction
|
파생 형식에 대한 판별자입니다.
|
alternateVerificationKeys
|
ContentKeyPolicyRestrictionTokenKey[]:
|
대체 확인 키 목록입니다.
|
audience
|
string
|
토큰의 대상 그룹입니다.
|
issuer
|
string
|
토큰 발급자입니다.
|
openIdConnectDiscoveryDocument
|
string
|
OpenID 연결 검색 문서입니다.
|
primaryVerificationKey
|
ContentKeyPolicyRestrictionTokenKey:
|
기본 확인 키입니다.
|
requiredClaims
|
ContentKeyPolicyTokenClaim[]
|
필요한 토큰 클레임 목록입니다.
|
restrictionTokenType
|
ContentKeyPolicyRestrictionTokenType
|
토큰의 형식입니다.
|
ContentKeyPolicyUnknownConfiguration
현재 API 버전에서 사용할 수 없는 ContentKeyPolicyConfiguration을 나타냅니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownConfiguration
|
파생 형식에 대한 판별자입니다.
|
ContentKeyPolicyUnknownRestriction
현재 API 버전에서 사용할 수 없는 ContentKeyPolicyRestriction을 나타냅니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownRestriction
|
파생 형식에 대한 판별자입니다.
|
ContentKeyPolicyWidevineConfiguration
Widevine 라이선스에 대한 구성을 지정합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyWidevineConfiguration
|
파생 형식에 대한 판별자입니다.
|
widevineTemplate
|
string
|
Widevine 템플릿입니다.
|
ContentKeyPolicyX509CertificateTokenKey
토큰 유효성 검사에 대한 인증서를 지정합니다.
Name |
형식 |
Description |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey
|
파생 형식에 대한 판별자입니다.
|
rawBody
|
string
|
PKCS 12 형식의 인증서 원시 데이터 필드(.NET의 X509Certificate2)
|
createdByType
리소스를 만든 ID의 형식입니다.
Name |
형식 |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
리소스 관리 오류 추가 정보입니다.
Name |
형식 |
Description |
info
|
object
|
추가 정보입니다.
|
type
|
string
|
추가 정보 유형입니다.
|
ErrorDetail
오류 세부 정보입니다.
Name |
형식 |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
오류 추가 정보입니다.
|
code
|
string
|
오류 코드입니다.
|
details
|
ErrorDetail[]
|
오류 세부 정보입니다.
|
message
|
string
|
오류 메시지입니다.
|
target
|
string
|
오류 대상입니다.
|
ErrorResponse
오류 응답
SecurityLevel
보안 수준입니다.
Name |
형식 |
Description |
SL150
|
string
|
개발 또는 테스트 중인 클라이언트의 경우. 무단 사용에 대한 보호가 없습니다.
|
SL2000
|
string
|
상업용 콘텐츠를 사용하는 강화된 디바이스 및 애플리케이션의 경우. 소프트웨어 또는 하드웨어 보호.
|
SL3000
|
string
|
강화된 디바이스에만 해당합니다. 하드웨어 보호.
|
Unknown
|
string
|
현재 API 버전에서 사용할 수 없는 SecurityLevel을 나타냅니다.
|
systemData
리소스 만들기 및 마지막 수정과 관련된 메타데이터입니다.
Name |
형식 |
Description |
createdAt
|
string
|
UTC(리소스 만들기)의 타임스탬프입니다.
|
createdBy
|
string
|
리소스를 만든 ID입니다.
|
createdByType
|
createdByType
|
리소스를 만든 ID의 형식입니다.
|
lastModifiedAt
|
string
|
리소스 마지막 수정의 타임스탬프(UTC)
|
lastModifiedBy
|
string
|
리소스를 마지막으로 수정한 ID입니다.
|
lastModifiedByType
|
createdByType
|
리소스를 마지막으로 수정한 ID 유형입니다.
|