Windows Azure Powershell for Media Services
Yesterday we published first set of powershell cmdlets to help manage Windows Azure Media Services. In this article I want give quick overview of what first set of media services related cmdlets are covering.
Before going into details I’d like to list set of cmdlets we shipped:
- New-AzureMediaServicesAccount
- New-AzureMediaServicesKey
- Get-AzureMediaServicesAccount
- Remove-AzureMediaServicesAccount
Installing Windows Azure Powershell
The recommended way to install the Windows Azure PowerShell cmdlets is via the Microsoft Web Platform Installer. After installing and launching the Web Platform Installer, select Windows Azure PowerShell and follow the prompts to install the cmdlets. The Web Platform Installer will install all dependencies for the Windows Azure PowerShell cmdlets
.
Alternatively you can get latest from github and build project.You can details instructions visiting https://github.com/WindowsAzure/azure-sdk-tools/wiki/Windows-Azure-PowerShell-Developer-Guide
Import Publisher setting file and selecting subscription to work with
Before you can deploy applications by using a PowerShell cmdlet, you must download your subscription information (by using Get-AzurePublishSettingsFile) and then import those settings (by using Import-AzurePublishSettingsFile).After you done with installation next step will be to open powershell and import publisher settings for your azure subsriptions
PS C:\> Get-AzurePublishSettingsFile
PS C:\> Import-AzurePublishSettingsFile -PublishSettingsFile "C:\temp\George.publishsettings"
Now powershell knows what subscription you have and you need to specify under which subscription you will work with media services.
To get list of available subscriptions:
PS C:\> Get-AzureSubscription
To select specific one:
Select-AzureSubscription "Windows Azure MSDN - Visual Studio Ultimate"
Creating Windows Azure Media Service Account
To create new Azure Media Services Account use New-AzureMediaServicesAccount cmdlet providing name of account, datacenter location where it will be created and storage account name. Please note that storage account name should belong to same subscription where you creating media service account.
Let me first get all list of mu\y storage names and pick one I want to use:
PS C:\> Get-AzureStorageAccount VERBOSE: 6:42:19 AM - Begin Operation: Get-AzureStorageAccount VERBOSE: 6:42:24 AM - Completed Operation: Get-AzureStorageAccount StorageAccountDescription : AffinityGroup : Location : West US GeoReplicationEnabled : True GeoPrimaryLocation : West US GeoSecondaryLocation : Label : trifonov1 StorageAccountStatus : Created StatusOfPrimary : StatusOfSecondary : Endpoints : {http://trifonov1.blob.core.windows.net/, http://trifonov1.queue.core.windows.net/, http://trifonov1.table.core.windows.net/} StorageAccountName : trifonov1 OperationDescription : Get-AzureStorageAccount OperationId : 3ca6e179-9dae-4585-9b43-fa79d14270da OperationStatus : Succeeded
Now when I know what account to pick I can provide storage account name ,location to New-AzureMediaServicesAccount cmdlet and also pick desired account name
PS C:\> New-AzureMediaServicesAccount -Name "mymediademo" -StorageAccountName "trifonov1" -Location "West US"
Get list of your Windows Azure Media Services accounts or details of selected one
Once you created single or multiple accounts you can list information by using Get-AzureMediaServicesAccount
PS C:\> Get-AzureMediaServicesAccount
By providing Name parameter you will get more detailed information including account keys
PS C:\> Get-AzureMediaServicesAccount -Name sprintdemo
Rotating Azure Media Service accounts keys
If you want update a account key you can use cmdlet New-AzureMediaServicesKey .
You need to provide account name, specify if you want to get new Primary or Secondary key . Specifying -Force switch will tell powershell not to ask confirmation question
PS C:\> New-AzureMediaServicesKey -Name "sprintdemo" -KeyType "Primary" -Force
Deleting your account
Done experimenting with Azure Media Services simply execute
PS C:\> Remove-AzureMediaServicesAccount -Name "sprintdemo" -Force