Create an Azure Media Services account

To start encrypting, encoding, analyzing, managing, and streaming media content in Azure, you need to create a Media Services account. The Media Services account needs to be associated with one or more storage accounts.

Note

The Media Services account and all associated storage accounts must be in the same Azure subscription. It is strongly recommended to use storage accounts in the same location as the Media Services account to avoid additional latency and data egress costs.

This article describes steps for creating a new Azure Media Services account using the Azure CLI.

Prerequisites

An active Azure subscription. If you don't have an Azure subscription, create a free account before you begin.

CLI Shell

It is recommended to use Azure Cloud Shell to execute CLI commands. Cloud Shell is a free, interactive shell that you can use to run the steps in this article. Common Azure tools are preinstalled and configured in Cloud Shell for you to use with your account. It provides the flexibility of choosing the shell experience that best suits the way you work. Linux users can opt for a Bash experience, while Windows users can opt for PowerShell.

You can also install the CLI locally. See Install the Azure CLI for instructions for your platform.

Sign in

Using a local install of the CLI requires signing in to Azure. This step is not required for Azure Cloud Shell. Sign in with the az login command.

If the CLI can open your default browser, it will do so and load a sign-in page. Otherwise, you need to open a browser page and follow the instructions on the command line to enter an authorization code after navigating to https://aka.ms/devicelogin in your browser.

Specify location of files

Many Media Services CLI commands allow you to pass a parameter with a file name. If you are using Cloud Shell, you can upload your file to your clouddrive (using Bash or PowerShell).

Upload files

Whether you are using a local CLI or Cloud Shell, you need to specify the file path according to the OS or Cloud Shell (Bash or PowerShell) that you are using. Below are some examples:

Relative path to the file (all OS)

  • @"mytestfile.json"
  • @"../mytestfile.json"

Absolute file path on Linux/Mac and Windows OS

  • @ "/usr/home/mytestfile.json"
  • @"c:\tmp\user\mytestfile.json"

Use {file} if the command is asking for a path to the file. For example, az ams transform create -a amsaccount -g resourceGroup -n custom --preset .\customPreset.json.
Use @{file} if the command is going to load the specified file. For example, az ams account-filter create -a amsaccount -g resourceGroup -n filterName --tracks @tracks.json.

Set the Azure subscription

In the following command, provide the Azure subscription ID that you want to use for the Media Services account. You can see a list of subscriptions that you have access to by navigating to Subscriptions.

az account set --subscription mySubscriptionId

Create a Media Services account

You first need to create a Media Services account. This section shows what you need for the account creation using the Azure CLI.

Create a resource group

Create a resource group using the following command. An Azure resource group is a logical container into which resources like Azure Media Services accounts and the associated Storage accounts are deployed and managed.

You can substitute amsResourceGroup with your value.

az group create --name amsResourceGroup --location westus2

Create a storage account

When creating a Media Services account, you need to supply the name of an Azure Storage account resource. The specified storage account is attached to your Media Services account. For more information about how storage accounts are used in Media Services, see Storage accounts.

You must have one Primary storage account and you can have any number of Secondary storage accounts associated with your Media Services account. Media Services supports General-purpose v2 (GPv2) or General-purpose v1 (GPv1) accounts. Blob only accounts are not allowed as Primary. If you want to learn more about storage accounts, see Azure Storage account options.

In this example, we create a General Purpose v2, Standard LRS account. If you want to experiment with storage accounts, use --sku Standard_LRS. However, when picking a SKU for production you should consider, --sku Standard_RAGRS, which provides geographic replication for business continuity. For more information, see storage accounts.

The following command creates a Storage account that is going to be associated with the Media Services account. In the script below, you can substitute storageaccountforams with your value. amsResourceGroup must match the value you gave for the resource group in the previous step. The storage account name must have length less than 24.

az storage account create --name storageaccountforams \  
  --kind StorageV2 \
  --sku Standard_LRS \
  -l westus2 \
  -g amsResourceGroup

Create a Media Services account

The following Azure CLI command creates a new Media Services account. You can replace the following values: amsaccount storageaccountforams (must match the value you gave for your storage account), and amsResourceGroup (must match the value you gave for the resource group).

az ams account create --name amsaccount \
  -l westus2 \
  -g amsResourceGroup --storage-account storageaccountforams

Next steps

See also

Azure CLI