コンテンツ キー ポリシーの一覧表示
アカウントのコンテンツ キー ポリシーをListsする
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/contentKeyPolicies?api-version=2022-08-01
省略可能なパラメーターを含む:
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 パラメーター
名前 |
/ |
必須 |
型 |
説明 |
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
要求のサンプル
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://video2.skills-academy.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
応答のサンプル
{
"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.
要求のサンプル
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://video2.skills-academy.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
応答のサンプル
{
"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.
要求のサンプル
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://video2.skills-academy.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
定義
ContentKeyPolicy
コンテンツ キー ポリシー リソース。
名前 |
型 |
説明 |
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 以外のキーの構成を表します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyClearKeyConfiguration
|
派生型の識別子。
|
ContentKeyPolicyCollection
ContentKeyPolicy 項目のコレクション。
名前 |
型 |
説明 |
@odata.nextLink
|
string
|
コレクションの次のページへのリンク (1 つの応答で返される結果がコレクションに多すぎる場合)。
|
value
|
ContentKeyPolicy[]
|
ContentKeyPolicy 項目のコレクション。
|
ContentKeyPolicyFairPlayConfiguration
FairPlay ライセンスの構成を指定します。
名前 |
型 |
説明 |
@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
名前 |
型 |
説明 |
playbackDurationSeconds
|
integer
|
再生時間
|
storageDurationSeconds
|
integer
|
保管期間
|
ContentKeyPolicyFairPlayRentalAndLeaseKeyType
レンタル キーとリース キーの種類。
名前 |
型 |
説明 |
DualExpiry
|
string
|
オフライン レンタルのデュアル有効期限。
|
PersistentLimited
|
string
|
コンテンツ キーは永続化でき、有効な期間はレンタル期間の値によって制限されます
|
PersistentUnlimited
|
string
|
コンテンツ キーは、無制限の期間で保持できます
|
Undefined
|
string
|
キーの期間が指定されていません。
|
Unknown
|
string
|
現在の API バージョンでは使用できない ContentKeyPolicyFairPlayRentalAndLeaseKeyType を表します。
|
ContentKeyPolicyOpenRestriction
開いている制限を表します。 ライセンスまたはキーは、すべての要求で配信されます。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyOpenRestriction
|
派生型の識別子。
|
ContentKeyPolicyOption
ポリシー オプションを表します。
名前 |
型 |
説明 |
configuration
|
ContentKeyPolicyConfiguration:
|
キー配信の構成。
|
name
|
string
|
ポリシー オプションの説明。
|
policyOptionId
|
string
|
従来のポリシー オプション ID。
|
restriction
|
ContentKeyPolicyRestriction:
|
この構成でキーを配信するために満たす必要がある要件
|
ContentKeyPolicyPlayReadyConfiguration
PlayReady ライセンスの構成を指定します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyConfiguration
|
派生型の識別子。
|
licenses
|
ContentKeyPolicyPlayReadyLicense[]
|
PlayReady ライセンス。
|
responseCustomData
|
string
|
カスタム応答データ。
|
コンテンツ キー ID が PlayReady ヘッダーにあることを指定します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromHeader
|
派生型の識別子。
|
ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
PlayReady 構成でコンテンツ キー ID を指定することを指定します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyPlayReadyContentEncryptionKeyFromKeyIdentifier
|
派生型の識別子。
|
keyId
|
string
|
コンテンツ キー ID。
|
ContentKeyPolicyPlayReadyContentType
PlayReady コンテンツ タイプ。
名前 |
型 |
説明 |
UltraVioletDownload
|
string
|
Uvt ダウンロード コンテンツ タイプ。
|
UltraVioletStreaming
|
string
|
紫外線ストリーミング コンテンツ タイプ。
|
Unknown
|
string
|
現在の API バージョンでは使用できない ContentKeyPolicyPlayReadyContentType を表します。
|
Unspecified
|
string
|
指定されていないコンテンツ タイプ。
|
ContentKeyPolicyPlayReadyExplicitAnalogTelevisionRestriction
明示的なアナログ テレビ出力制限制御ビットを構成します。 詳細については、「PlayReady コンプライアンス規則」を参照してください。
名前 |
型 |
説明 |
bestEffort
|
boolean
|
この制限がベスト エフォートベースで適用されるかどうかを示します。
|
configurationData
|
integer
|
制限制御ビットを構成します。 0 ~ 3 の範囲にする必要があります。
|
ContentKeyPolicyPlayReadyLicense
PlayReady ライセンス
ContentKeyPolicyPlayReadyLicenseType
ライセンスの種類。
名前 |
型 |
説明 |
NonPersistent
|
string
|
非永続的なライセンス。
|
Persistent
|
string
|
永続的なライセンス。 オフライン再生を許可します。
|
Unknown
|
string
|
現在の API バージョンでは使用できない ContentKeyPolicyPlayReadyLicenseType を表します。
|
ContentKeyPolicyPlayReadyPlayRight
PlayReady ライセンスで Play Right を構成します。
名前 |
型 |
説明 |
agcAndColorStripeRestriction
|
integer
|
ライセンスで自動ゲイン制御 (AGC) とカラー ストライプを構成します。 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
ライセンスの不明な出力処理設定を構成します。
名前 |
型 |
説明 |
Allowed
|
string
|
保護されたコンテンツのビデオ部分を不明な出力に渡すことが許可されます。
|
AllowedWithVideoConstriction
|
string
|
保護されたコンテンツのビデオ部分を不明な出力に渡すことはできますが、解像度は制限されています。
|
NotAllowed
|
string
|
保護されたコンテンツのビデオ部分を不明な出力に渡すことは許可されません。
|
Unknown
|
string
|
現在の API バージョンでは使用できない ContentKeyPolicyPlayReadyUnknownOutputPassingOption を表します。
|
ContentKeyPolicyRestrictionTokenType
トークンの種類。
名前 |
型 |
説明 |
Jwt
|
string
|
JSON Web トークン。
|
Swt
|
string
|
単純な Web トークン。
|
Unknown
|
string
|
現在の API バージョンでは使用できない ContentKeyPolicyRestrictionTokenType を表します。
|
ContentKeyPolicyRsaTokenKey
トークン検証用の RSA キーを指定します
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyRsaTokenKey
|
派生型の識別子。
|
exponent
|
string
|
RSA パラメーター指数
|
modulus
|
string
|
RSA パラメーターの剰余
|
ContentKeyPolicySymmetricTokenKey
トークン検証の対称キーを指定します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicySymmetricTokenKey
|
派生型の識別子。
|
keyValue
|
string
|
キーのキー値
|
ContentKeyPolicyTokenClaim
トークン要求を表します。
名前 |
型 |
説明 |
claimType
|
string
|
トークン要求の種類。
|
claimValue
|
string
|
トークン要求の値。
|
ContentKeyPolicyTokenRestriction
トークン制限を表します。 指定されたトークンは、ライセンスまたはキーの配信を成功させるために、これらの要件と一致している必要があります。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyTokenRestriction
|
派生型の識別子。
|
alternateVerificationKeys
|
ContentKeyPolicyRestrictionTokenKey[]:
|
代替検証キーの一覧。
|
audience
|
string
|
トークンの対象ユーザー。
|
issuer
|
string
|
トークン発行者。
|
openIdConnectDiscoveryDocument
|
string
|
OpenID 接続検出ドキュメント。
|
primaryVerificationKey
|
ContentKeyPolicyRestrictionTokenKey:
|
プライマリ検証キー。
|
requiredClaims
|
ContentKeyPolicyTokenClaim[]
|
必要なトークン要求の一覧。
|
restrictionTokenType
|
ContentKeyPolicyRestrictionTokenType
|
トークンの種類。
|
ContentKeyPolicyUnknownConfiguration
現在の API バージョンでは使用できない ContentKeyPolicyConfiguration を表します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownConfiguration
|
派生型の識別子。
|
ContentKeyPolicyUnknownRestriction
現在の API バージョンでは使用できない ContentKeyPolicyRestriction を表します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyUnknownRestriction
|
派生型の識別子。
|
ContentKeyPolicyWidevineConfiguration
Widevine ライセンスの構成を指定します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyWidevineConfiguration
|
派生型の識別子。
|
widevineTemplate
|
string
|
Widevine テンプレート。
|
ContentKeyPolicyX509CertificateTokenKey
トークン検証の証明書を指定します。
名前 |
型 |
説明 |
@odata.type
|
string:
#Microsoft.Media.ContentKeyPolicyX509CertificateTokenKey
|
派生型の識別子。
|
rawBody
|
string
|
PKCS 12 形式の証明書の生データ フィールド (.NET の X509Certificate2)
|
createdByType
リソースを作成した ID の種類。
名前 |
型 |
説明 |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
リソース管理エラーの追加情報。
名前 |
型 |
説明 |
info
|
object
|
追加情報。
|
type
|
string
|
追加情報の種類。
|
ErrorDetail
エラーの詳細。
名前 |
型 |
説明 |
additionalInfo
|
ErrorAdditionalInfo[]
|
エラーの追加情報。
|
code
|
string
|
エラー コード。
|
details
|
ErrorDetail[]
|
エラーの詳細です。
|
message
|
string
|
エラー メッセージ。
|
target
|
string
|
エラーのターゲット。
|
ErrorResponse
エラー応答
SecurityLevel
セキュリティ レベル。
名前 |
型 |
説明 |
SL150
|
string
|
開発中またはテスト中のクライアントの場合。 不正使用に対する保護はありません。
|
SL2000
|
string
|
商用コンテンツを使用する強化されたデバイスとアプリケーションの場合。 ソフトウェアまたはハードウェアの保護。
|
SL3000
|
string
|
強化されたデバイスの場合のみ。 ハードウェア保護。
|
Unknown
|
string
|
現在の API バージョンでは使用できない SecurityLevel を表します。
|
systemData
リソースの作成と最後の変更に関連するメタデータ。
名前 |
型 |
説明 |
createdAt
|
string
|
リソース作成のタイムスタンプ (UTC)。
|
createdBy
|
string
|
リソースを作成した ID。
|
createdByType
|
createdByType
|
リソースを作成した ID の種類。
|
lastModifiedAt
|
string
|
リソースの最終変更のタイムスタンプ (UTC)
|
lastModifiedBy
|
string
|
リソースを最後に変更した ID。
|
lastModifiedByType
|
createdByType
|
リソースを最後に変更した ID の種類。
|