Dynamically encrypt assets with AES-128 using Azure Media Services v2


You can find the latest and most extensive Media Services v3 .NET samples in the Azure Media Services v3 repository.


The sample in this repo shows how to use Azure Media Services v2 to dynamically encrypt your content with AES 128-bit clear encryption keys.

How To Run This Sample

To run this sample you will need:

  • Visual Studio
  • An Azure subscription

Step 1: Clone or download this repository

Step 2: Update the app.config file

Update the appSettings section of the app.config file with appropriate values. For more information, see this topic.

		<add key="AMSAADTenantDomain" value="tenant"/>
		<add key="AMSRESTAPIEndpoint" value="endpoint"/>
		<add key="AMSClientId" value="id"/>
		<add key="AMSClientSecret" value="secret"/>

		<add key="Issuer" value="http://testacs.com" />
		<add key="Audience" value="urn:test" />

Step 3: Start a streaming endpoint

Make sure to start the streaming endpoint. For more information, see: streaming endpoints.

Step 4: Run the sample

Clean the solution, rebuild the solution, and run it.

About the code

For detailed information about the sample, see Using AES-128 Dynamic Encryption and Key Delivery Service.

More information

You can view AMS learning paths here: