Skip to content

azurermMediaStreamingPolicy

Manages a Streaming Policy.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "media-resources",
  }
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "GRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "examplestoracc",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermMediaServicesAccountExample =
  new azurerm.mediaServicesAccount.MediaServicesAccount(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "examplemediaacc",
    resource_group_name: azurermResourceGroupExample.name,
    storage_account: [
      {
        id: azurermStorageAccountExample.id,
        is_primary: true,
      },
    ],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMediaServicesAccountExample.overrideLogicalId("example");
const azurermMediaContentKeyPolicyExample =
  new azurerm.mediaContentKeyPolicy.MediaContentKeyPolicy(this, "example_3", {
    media_services_account_name: azurermMediaServicesAccountExample.name,
    name: "example",
    policy_option: [
      {
        fairplay_configuration: [
          {
            ask: "bb566284cc124a21c435a92cd3c108c4",
            pfx: "MIIG7gIBAzCCBqoGCSqGSIb3DQEHAaCCBpsEggaXMIIGkzCCA7wGCSqGSIb3DQEHAaCCA60EggOpMIIDpTCCA6EGCyqGSIb3DQEMCgECoIICtjCCArIwHAYKKoZIhvcNAQwBAzAOBAiV65vFfxLDVgICB9AEggKQx2dxWefICYodVhRLSQVMJRYy5QkM1VySPAXGP744JHrb+s0Y8i/6a+a5itZGlXw3kvxyflHtSsuuBC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ByACAAdgAxAC4AMDCCAs8GCSqGSIb3DQEHBqCCAsAwggK8AgEAMIICtQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQMwDgQISS7mG/riQJkCAgfQgIICiPSGg5axP4JM+GmiVEqOHTVAPw2AM8OPnn1q0mIw54oC2WOJw3FFThYHmxTQzQ1feVmnkVCv++eFp+BYTcWTa+ehl/3/Nvr5uLTzDxmCShacKwoWXOKtSLh6mmgydvMqSf6xv1bPsloodtrRxhprI2lBNBW2uw8az9eLdvURYmhjGPf9klEy/6OCA5jDT5XZMunwiQT5mYNMF7wAQ5PCz2dJQqm1n72A6nUHPkHEusN7iH/+mv5d3iaKxn7/ShxLKHfjMd+r/gv27ylshVHiN4mVStAg+MiLrVvr5VH46p6oosImvS3ZO4D5wTmh/6wtus803qN4QB/Y9n4rqEJ4Dn619h+6O7FChzWkx7kvYIzIxvfnj1PCFTEjUwc7jbuF013W/z9zQi2YEq9AzxMcGro0zjdt2sf30zXSfaRNt0UHHRDkLo7yFUJG5Ka1uWU8paLuXUUiiMUf24Bsfdg2A2n+3Qa7g25OvAM1QTpMwmMWL9sY2hxVUGIKVrnj8c4EKuGJjVDXrze5g9O/LfZr5VSjGu5KsN0eYI3mcePF7XM0azMtTNQYVRmeWxYW+XvK5MaoLEkrFG8C5+JccIlN588jowVIPqP321S/EyFiAmrRdAWkqrc9KH+/eINCFqjut2YPkCaTM9mnJAAqWgggUWkrOKT/ByS6IAQwyEBNFbY0TWyxKt6vZL1EW/6HgZCsxeYycNhnPr2qJNZZMNzmdMRp2GRLcfBH8KFw1rAyua0VJoTLHb23ZAsEY74BrEEiK9e/oOjXkHzQjlmrfQ9rSN2eQpRrn0W8I229WmBO2suG+AQ3aY8kDtBMkjmJno7txUh1K5D6tJTO7MQp343A2AhyJkhYA7NPnDA7MB8wBwYFKw4DAhoEFPO82HDlCzlshWlnMoQPStm62TMEBBQsPmvwbZ5OlwC9+NDF1AC+t67WTgICB9A=",
            pfx_password: "password",
            rental_and_lease_key_type: "PersistentUnlimited",
            rental_duration_seconds: 2249,
          },
        ],
        name: "fairPlay",
        open_restriction_enabled: true,
      },
    ],
    resource_group_name: azurermResourceGroupExample.name,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMediaContentKeyPolicyExample.overrideLogicalId("example");
const azurermMediaStreamingPolicyExample =
  new azurerm.mediaStreamingPolicy.MediaStreamingPolicy(this, "example_4", {
    common_encryption_cbcs: [
      {
        drm_fairplay: [
          {
            allow_persistent_license: true,
            custom_license_acquisition_url_template:
              "https://contoso.com/{AssetAlternativeId}/fairplay/{ContentKeyId}",
          },
        ],
        enabled_protocols: [
          {
            dash: true,
            download: false,
            hls: false,
            smooth_streaming: false,
          },
        ],
      },
    ],
    common_encryption_cenc: [
      {
        clear_track: [
          {
            condition: [
              {
                operation: "Equal",
                property: "FourCC",
                value: "hev2",
              },
            ],
          },
        ],
        default_content_key: [
          {
            label: "aesDefaultKey",
            policy_name: azurermMediaContentKeyPolicyExample.name,
          },
        ],
        drm_playready: [
          {
            custom_attributes: "PlayReady CustomAttributes",
            custom_license_acquisition_url_template:
              "https://contoso.com/{AssetAlternativeId}/playready/{ContentKeyId}",
          },
        ],
        drm_widevine_custom_license_acquisition_url_template:
          "https://contoso.com/{AssetAlternativeId}/widevine/{ContentKeyId}",
        enabled_protocols: [
          {
            dash: true,
            download: false,
            hls: false,
            smooth_streaming: false,
          },
        ],
      },
    ],
    media_services_account_name: azurermMediaServicesAccountExample.name,
    name: "Policy-1",
    resource_group_name: azurermResourceGroupExample.name,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMediaStreamingPolicyExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • mediaServicesAccountName - (Required) The Media Services account name. Changing this forces a new Streaming Policy to be created.

  • name - (Required) The name which should be used for this Streaming Policy. Changing this forces a new Streaming Policy to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Streaming Policy should exist. Changing this forces a new Streaming Policy to be created.


  • commonEncryptionCbcs - (Optional) A commonEncryptionCbcs block as defined below. Changing this forces a new Streaming Policy to be created.

  • commonEncryptionCenc - (Optional) A commonEncryptionCenc block as defined below. Changing this forces a new Streaming Policy to be created.

  • defaultContentKeyPolicyName - (Optional) Default Content Key used by current Streaming Policy. Changing this forces a new Streaming Policy to be created.

  • envelopeEncryption - (Optional) A envelopeEncryption block as defined below. Changing this forces a new Streaming Policy to be created.

  • noEncryptionEnabledProtocols - (Optional) A noEncryptionEnabledProtocols block as defined below. Changing this forces a new Streaming Policy to be created.


A commonEncryptionCbcs block supports the following:

  • clearKeyEncryption - (Optional) A clearKeyEncryption block as defined below. Changing this forces a new Streaming Policy to be created.

  • defaultContentKey - (Optional) A defaultContentKey block as defined below. Changing this forces a new Streaming Policy to be created.

  • drmFairplay - (Optional) A drmFairplay block as defined below. Changing this forces a new Streaming Policy to be created.

  • enabledProtocols - (Optional) A enabledProtocols block as defined below. Changing this forces a new Streaming Policy to be created.


A commonEncryptionCenc block supports the following:

  • clearKeyEncryption - (Optional) A clearKeyEncryption block as defined below. Changing this forces a new Streaming Policy to be created.

  • clearTrack - (Optional) One or more clearTrack blocks as defined below. Changing this forces a new Streaming Policy to be created.

  • contentKeyToTrackMapping - (Optional) One or more contentKeyToTrackMapping blocks as defined below. Changing this forces a new Streaming Policy to be created.

  • defaultContentKey - (Optional) A defaultContentKey block as defined below. Changing this forces a new Streaming Policy to be created.

  • drmPlayready - (Optional) A drmPlayready block as defined below. Changing this forces a new Streaming Policy to be created.

  • drmWidevineCustomLicenseAcquisitionUrlTemplate - (Optional) The URL template for the custom service that delivers licenses to the end user. This is not required when using Azure Media Services for issuing licenses. Changing this forces a new Streaming Policy to be created.

  • enabledProtocols - (Optional) A enabledProtocols block as defined below. Changing this forces a new Streaming Policy to be created.


A clearKeyEncryption block supports the following:

  • customKeysAcquisitionUrlTemplate - (Required) The URL template for the custom service that delivers content keys to the end user. This is not required when using Azure Media Services for issuing keys. Changing this forces a new Streaming Policy to be created.

-> Note Either clearKeyEncryption or drm must be specified.


A clearTrack block supports the following:

  • condition - (Required) One or more condition blocks as defined below. Changing this forces a new Streaming Policy to be created.

A condition block supports the following:

  • operation - (Required) The track property condition operation. Possible value is equal. Changing this forces a new Streaming Policy to be created.

  • property - (Required) The track property type. Possible value is fourCc. Changing this forces a new Streaming Policy to be created.

  • value - (Required) The track property value. Changing this forces a new Streaming Policy to be created.


A contentKeyToTrackMapping block supports the following:

  • label - (Optional) Specifies the content key when creating a Streaming Locator. Changing this forces a new Streaming Policy to be created.

  • policyName - (Optional) The policy used by the default key. Changing this forces a new Streaming Policy to be created.

  • track - (Optional) One or more track blocks as defined below. Changing this forces a new Streaming Policy to be created.


A defaultContentKey block supports the following:

  • label - (Optional) Label can be used to specify Content Key when creating a Streaming Locator. Changing this forces a new Streaming Policy to be created.

  • policyName - (Optional) Policy used by Default Key. Changing this forces a new Streaming Policy to be created.


A drmFairplay block supports the following:

  • allowPersistentLicense - (Optional) All license to be persistent or not. Changing this forces a new Streaming Policy to be created.

  • customLicenseAcquisitionUrlTemplate - (Optional) The URL template for the custom service that delivers licenses to the end user. This is not required when using Azure Media Services for issuing licenses. Changing this forces a new Streaming Policy to be created.


A drmPlayready block supports the following:

  • customAttributes - (Optional) Custom attributes for PlayReady. Changing this forces a new Streaming Policy to be created.

  • customLicenseAcquisitionUrlTemplate - (Optional) The URL template for the custom service that delivers licenses to the end user. This is not required when using Azure Media Services for issuing licenses. Changing this forces a new Streaming Policy to be created.


A enabledProtocols block supports the following:

  • dash - (Optional) Enable DASH protocol or not. Changing this forces a new Streaming Policy to be created.

  • download - (Optional) Enable Download protocol or not. Changing this forces a new Streaming Policy to be created.

  • hls - (Optional) Enable HLS protocol or not. Changing this forces a new Streaming Policy to be created.

  • smoothStreaming - (Optional) Enable SmoothStreaming protocol or not. Changing this forces a new Streaming Policy to be created.


A envelopeEncryption block supports the following:

  • customKeysAcquisitionUrlTemplate - (Optional) The URL template for the custom service that delivers content keys to the end user. This is not required when using Azure Media Services for issuing keys. Changing this forces a new Streaming Policy to be created.

  • defaultContentKey - (Optional) A defaultContentKey block as defined above. Changing this forces a new Streaming Policy to be created.

  • enabledProtocols - (Optional) A enabledProtocols block as defined above. Changing this forces a new Streaming Policy to be created.


A noEncryptionEnabledProtocols block supports the following:

  • dash - (Optional) Enable DASH protocol or not. Changing this forces a new Streaming Policy to be created.

  • download - (Optional) Enable Download protocol or not. Changing this forces a new Streaming Policy to be created.

  • hls - (Optional) Enable HLS protocol or not. Changing this forces a new Streaming Policy to be created.

  • smoothStreaming - (Optional) Enable SmoothStreaming protocol or not. Changing this forces a new Streaming Policy to be created.


A track block supports the following:

  • condition - (Required) One or more condition blocks as defined below. Changing this forces a new Streaming Policy to be created.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Streaming Policy.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Streaming Policy.
  • read - (Defaults to 5 minutes) Used when retrieving the Streaming Policy.
  • delete - (Defaults to 30 minutes) Used when deleting the Streaming Policy.

Import

Streaming Policies can be imported using the resourceId, e.g.

terraform import azurerm_media_streaming_policy.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Media/mediaServices/account1/streamingPolicies/policy1