In our earlier article we have seen about what is Windows Azure Media Services and the different terminologies and operations that are involved with the same. Here in this tutorial we are going to see how to set up the Windows Azure Media Services Preview account to start developing the application with the Visual Studio 2010 IDE and deploy to the Azure environment. To get clear idea on the Windows Azure Media Services first I would suggest to get in with this article which describes clearly on the basic of the Media Services step by step “Getting Started with Windows Azure Media Services – #Meet Azure Edition”. [more]
Currently we have Windows Azure Media Services is in Preview and in order to use the environment we need to do some steps which provides us with the required keys basically the Account Key which is required to start using the Media Services with the code base.
Step 1 – Sign in to Windows Azure Portal using the link http://Windows.Azure.com with a valid subscription and register for the Media Services preview which will be available under the Preview Features section of Account tab as shown in the screen below. Since my subscription is already subscribed we will see You are active, else we can see a default message of Try it now.
Step 2 – Click on Try it Now will post the request to the Windows Azure team and we can see the request is queued, once we get the approval mail and status shows You are Active we can start using the Media Services from the code. Next step is to see if all the prerequisites are installed correctly (See the prerequisites specified in this article “Getting Started with Windows Azure Media Services – #Meet Azure Edition”). Install the missing software in order to avoid any interruption which setting up the Window Azure Media Services Account.
Step 3 – Start creating a Windows Azure Storage Services (Basically used to store the media content) within the list of regions where Windows Azure Media Services are available. The regions involved are (West Europe, Southeast Asia, East Asia, North Europe, West US, East US). To see the steps on how to create the Windows Azure Storage Services refer to the article “Windows Azure – Creating New Storage Account”. Once the storage is created we can see the storage listed as shown in the screen below.
Step 4 – Now install the Windows Azure Media Services SDK which can be downloaded from the link “Windows Azure Media Services SDK 1.0”. As a part of Prerequisites if the SDK is installed please leave this step and proceed to the next step.
Step 5 – Open Windows PowerShell v2.0 or greater (if you are proceeding with the setup on a Windows 8 Machine then it has inbuilt PowerShell v3.0 installed) so open the PowerShell ISE in administrator mode by right clicking and selecting “Run as Administrator” which opens the PowerShell in Administrator mode as shown in the screen below.
Step 6 – Next step is to change the directory to the path where we installed the Windows Azure Media Services SDK, use the below script to change to the path. Note to keep the path in “” so that you will not get error.
Script – cd “C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0”
Step 6 – Next step is very important that we are going to activate the Windows Azure media Account using the below script, this script first creates a Management Certificate internally and uploads to the Media Server once the script is executed. If the script is executed correctly we can see a new Browser opened with the steps on how to proceed after installation as shown in the screens below.
Script: PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> .\GetMediaServicesEnv.ps1
After successful registration of the media services account:
Once things are done correctly we can see a file (PublishSettings) prompted to download to the local machine, this file has the necessary information which are basically required while retrieving the account key. So Save the file to the local machine and the file contains the the management certificate details as shown in the screen below.
Step 7 – Next step is to get the endpoint information to which the service is pointed to, so use the below script (which has the path to the downloaded Management Certificate) and execute it in the Windows PowerShell as shown in the screen below. On successful execution we will be getting the management service endpoint, certificate thumbprint, and the subscription Id of the Windows Azure account.
PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> .\SetMediaServicesEnv.ps1 -path “D:
Step 8: Run the below script by providing the details of the 3 parameter outputs which we obtained from our last script as shown in the screen below.
PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> $context = Get-MediaServicesManagem
entContext -managementserviceendpoint “https://management.core.windows.net/” -managementcertthumbprint “XXXXXXXXXXXXXXXXXXXXXXXX” -subscriptionid “XXXXXXXXXXXXXXXXXXXX”
Step 9 – Next step is to check on which particular region we are going to create the account, basically now Windows Azure Media Services are available in few of the regions where Microsoft keeps on working to increase the availability zones one by one. To get the list execute the below script and we can see the result listed, select one region from the list and keep it aside as shown in the screen below.
PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> Get-MediaServicesAvailableRegions –
Step 10 – This step is important, before we proceed with giving a Media Service account name for our application first we need to check if the Media Service name is available. Since this is globally available there is a possibility some one from different region can used the name, so to check if the Account Name is available or not run the below script with your favorite name in the string as shown in the script and screen below. We will get result as True or False based on the availability.
PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> Get-MediaServicesAccountAvailabilit
y -managementcontext $context -AccountName “F5debugMediaServices”
Step 11 – We can see the Account Name is available, now we are ready with all the required information. Execute the below script which creates the account with the Windows Azure Media Services as shown in the screen below.
PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> Add-MediaServicesAccount -Managemen
tContext $context -AccountName “F5debugMediaServices” -StorageAccountName “f5debugstorage” -StorageAccountKey “Primary or Secondary Key”-Region “US_East” –BlobStorageEndpoint http://storage.blob.core.windows.net/
Step 12 – On providing the information correctly and the scripts executed without any errors we can see the account gets created and we can see the Account ID and the Subscription details as shown in the screen below.
Step 13 – Now we need to retrieve the Account Key using which only we will be connecting to the Media Services from the code behind, to get the media services Account key run the below script as shown in the screen below. (Need to execute both the scripts)
PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> $accountdetails = Get-Mediaservices
accountdetails $context –AccountName “F5debugMediaServices”
PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> $accountdetails.accountkey
Step 14 – Once we get the Account key, to get the complete details of the account execute the below script as shown in the screen below which gives the account details as well as the account key.
PS C:\Program Files (x86)\Microsoft SDKs\Windows Azure Media Services\Services\v1.0> Get-MediaServicesAccounts $context
Now we are done with all the necessary steps to register the account and as well got the Account Name and Account Key which are used to connect to the Windows Azure Media Services from the code to programmatically do the manipulations as per the requirement. We will use these details and connect to the media server from the code in our next tutorial. Until then Happy Programming!!!