Copy blobs into an asset 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.


This sample in this repo shows how to copy existing blobs from a storage account into a new Azure Media Services v2 asset.

The sample shows two ways to copy blobs into assets:

  • Copy blobs from an asset in one AMS account into a new asset in another AMS account.
  • Copy blobs from some storage account into a new asset in an AMS account.

The code sample in this repo shows how to connect using the Service principal authentication method.

NOTE The Service principal authentication method should be used for server, web services, APIs type of applications. For more information, see Access the AMS API with Azure AD authentication.

Running this sample

NOTE Make sure you use the latest Azure Media Services .NET SDK.

  1. Download the solution.
  2. Clean the solution.
  3. Rebuild the solution.
  4. Update the values of elements in the appSettings section of the app.config file. For more information, see Access the Azure Media Services API with Azure AD authentication.
    <!--Used by "copy blobs between two AMS accounts" code. -->
    <add key="AMSSourceAADTenantDomain" value="tenant"/>
    <add key="AMSSourceRESTAPIEndpoint" value="endpoint"/>

    <add key="SourceAMSClientId" value="clientID"/>
    <add key="SourceAMSClientSecret" value="clientSecret"/>

    <add key="SourceAssetID" value="nb:cid:UUID:6dd1aaa0-5787-4a2a-9263-7bab9318bf49"/>

    <add key="AMSDestAADTenantDomain" value="tenant"/>
    <add key="AMSDestRESTAPIEndpoint" value="endpoint"/>

    <add key="DestAMSClientId" value="clientID"/>
    <add key="DestAMSClientSecret" value="clientSecret"/>

    <add key="DestStorageAccountName" value="name"/>
    <add key="DestStorageAccountKey" value="key"/>

    <!-- Used by "copy blobs from a storage account into an AMS account" code. -->
    <add key="SourceStorageAccountName" value="name" />
    <add key="SourceStorageAccountKey" value="key" />
    <add key="NameOfBlobContainerYouWantToCopy" value="BlobContainerName"/>
    <add key="AMSAADTenantDomain" value="tenant"/>
    <add key="AMSRESTAPIEndpoint" value="endpoint"/>
    <add key="AMSClientId" value="clientID"/>
    <add key="AMSClientSecret" value="clientSecret"/>
    <add key="AMSStorageAccountName" value="name"/>
    <add key="AMSStorageAccountKey" value="key"/>

About the code

You can find detailed information about this code in the Copying an Existing Blob into a Media Services Asset article.

Use tools to copy blobs into assets

You can also use the following tools to copy blobs into assets.

More information

You can view AMS learning paths here: