Export (0) Print
Expand All

Working with Azure Storage

Updated: February 25, 2015

When you create a new Microsoft Azure Media Services account, you are also asked to select a Microsoft Azure Storage account that will be used to store your media content.

Media Services uses Assets to manage, encode, and stream your media content.  Assets contain asset files (AssetFiles) - digital files (including video, audio, images, thumbnail collections, text tracks and closed caption files) and the metadata about these files. An asset is mapped to a blob container in a storage account; asset files are stored as blobs in that container. A storage account can contain an unlimited number of blob containers, as long as their total size is under 500TB per storage account. A Media Service account can associate with one or more storage accounts.

When you delete a Media Services account, the associated storage accounts are not deleted automatically.

In most cases, you will interact with Media Services through APIs or Azure Management Portal and let Media Services manage the interaction with the specified storage account. However, there are scenarios in which you may want to manage and configure Azure Storage yourself. This topic discusses these scenarios.

You should not attempt to change the contents of blob containers that were generated by Media Services without using Media Service APIs.

When geo-redundant storage is enabled on your storage account, its blob, table and queue data is being replicated to a secondary region hundreds of miles away from the primary region. So in the case of a major disaster in the primary region, your data is still durable. When a new storage account is created, geo-redundant storage is enabled by default.

For more information, see Azure Storage Redundancy Options and How to: Manage storage account replication.

For pricing information for storage account replication, see Storage Pricing Details.

When a new storage account is created, Azure generates two 512-bit storage access keys, which are used to authenticate access to your storage account. To keep your storage connections more secure, it is recommended to periodically regenerate and rotate your storage access keys. Two access keys (primary and secondary) are provided in order to enable you to maintain connections to the storage account using one access key while you regenerate the other access key. For more information, see How to: View, copy, and regenerate storage access keys.

Media Services has dependency on one of the storage keys. By default, the primary key is used, but you can specify to use either primary or secondary storage key. Whenever you decide to regenerate a storage key, you must make sure to synchronize the update with Media Services. It is recommended to roll your keys as described below.

The following procedure describes how to rotate storage keys.

  1. Assuming Media Services references the primary key, update Media Services to use the secondary storage account key (as shown after these steps).

  2. Wait for 30 minutes before performing any operations using Media Services.

  3. Regenerate the primary storage account key (as shown in How to: View, copy, and regenerate storage access keys).

  4. Update Media Services to use the new primary storage account key.

    Use the same steps to regenerate the secondary access key.

You can use one of the following two methods to synchronize the regenerated storage key with Media Services.

  • Using Azure Portal: select your Media Service account, and click on the “MANAGE KEYS” icon on the bottom of the portal window. Depending on which storage key you want for the Media Services to synchronize with, select the synchronize primary key or synchronize secondary key button.

  • Using Media Services management REST API: Update Storage Account Key.

    The following code example shows how to construct the https://endpoint/<subscriptionId>/services/mediaservices/Accounts/<accountName>/StorageAccounts/<storageAccountName>/Key request in order to synchronize the specified storage key with Media Services.

    public void UpdateMediaServicesWithStorageAccountKey(string mediaServicesAccount, string storageAccountName, string storageAccountKey)
        var clientCert = GetCertificate(CertThumbprint);
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("{0}/{1}/services/mediaservices/Accounts/{2}/StorageAccounts/{3}/Key",
            Endpoint, SubscriptionId, mediaServicesAccount, storageAccountName));
        request.Method = "PUT";
        request.ContentType = "application/json; charset=utf-8";
        request.Headers.Add("x-ms-version", "2011-10-01");
        request.Headers.Add("Accept-Encoding: gzip, deflate");
        using (var streamWriter = new StreamWriter(request.GetRequestStream()))
        using (var response = (HttpWebResponse)request.GetResponse())
            string jsonResponse;
            Stream receiveStream = response.GetResponseStream();
            Encoding encode = Encoding.GetEncoding("utf-8");
            if (receiveStream != null)
                var readStream = new StreamReader(receiveStream, encode);
                jsonResponse = readStream.ReadToEnd();

Each storage account is limited to 500 TB. To expand your storage beyond the limitations of 500TB per storage account, you can choose to attach multiple storage accounts to a single Media Services account. Ability to attach multiple storage accounts to a Media Services account provides the following benefits:

  • Load balancing your assets across multiple storage accounts.

  • Scaling Media Services for large amounts of content storage and processing.

  • Isolating your mezzanine (source) file storage from your streaming or DRM protected file storage.

For more information, see the following topics\samples:

Managing Media Services Assets across Multiple Storage Accounts

Managing assets across multiple storage accounts In Azure Media Services and defining load balancing strategy

How to: Manage Multiple Storage Accounts Attached to a Media Services Account.

For more information about storage limits and scalability, see Azure Storage Scalability and Performance Targets.

Currently, once you attach a storage account, you cannot detach it.

If you want to monitor your storage account (including metrics and diagnostic logs), you can configure storage monitoring. Being able to view metrics and logs makes it easy to see the types of errors that are occurring and diagnose problems. For more information, see How To Monitor a Storage Account and Using Metrics to Track Storage Usage. No monitoring data is collected (and the metrics charts on the dashboard are empty) until you configure monitoring for your storage account.

For more information, see the following topics: Metrics table schema and Log format.

If you already have existing blobs in some storage account and want to copy them into a Media Services asset, see the Copying an Existing Blob into a Media Services Asset topic.

© 2015 Microsoft