I have created a website that will host educational material. Among the 'material' it displays will be videos (mp4) and podcasts (mp3). After some research, it has become apparent that Azure Media Services can satisfy my needs. After configuring this new Azure resource I now have :
a) an Azure Media Service Account b) an Azure Storage Account c) a Streaming Endpoint
I have uploaded a test file (mp3) through the Media Service Account 'Assets' page. I can see that, on upload, a unique container has been created inside the associated Storage Account. The file lives as a blob inside this container.
The only remaining step is to use the streaming endpoint to make the file accessible in my web application (i.e. I need to get this mp3 to show in my template).
And here is where a problem arises.
Azure Media Services pulls its files from an associated Storage Account. I am unable to stream the file because it is part of private -- not public -- Storage Account.
I've been given some reference code by a friend. He is loading a video via Azure Media Services. His Storage Account is public. He has embedded the following code into his template.
His code :
<video width="80%" controls>
<source src="https://cmskidsstorage.blob.core.windows.net/asset-4a9acdd3-28a6-48ab-9309-9a5a2a452926/CMS ALT_1 Final 102418.mp4?sv=2017-04-17&sr=c&si=89e8aa51-dd64-4290-8c4d-d1eb961999c0&sig=0J6ZCivW3PZDbZ29lbrGkiO0q05mIW0cOe5Q0AfNqGY%3D&st=2019-03-20T15%3A47%3A57Z&se=2119-03-20T15%3A47%3A57Z" type="video/mp4">
Your browser does not support HTML5 video.
</video>
I've attempted to do the same with my audio file. My Storage Account is private and protected by two keys. My code:
<audio width="80%" controls>
<source src="https://myafoclientdocs.blob.core.windows.net/asset-93e7f4b7-1958-498b-8ab9-3800835641d9/01_The Key to Preserving Wealth for Generations_Jay Hughes_new.mp3" type="audio/mpeg">
Your browser does not support HTML5 video.
</audio>
His video streams fine. My audio doesn't. I receive this error: 409 (Public access is not permitted on this storage account).
My Azure Media Service is linked to private Azure Storage Container. How can I stream assets that live in privatized storage?
The error occurs Azure Storage account has not been configured to grant public access. Azure Storage accounts are private by default, and accessing their contents requires authorization.
You can use SAS-token to access the private Azure storage account with media service. you can get the Shared Access Signature token by portal:
Portal -> Storage account -> Shared access signature -> Check the allowed resource type -> Generate SAS and connection string.
Finally, you can use the SAS token URI in your HTML code to stream the audio file.
Reference:
azure - azcopy sync failing with "409 Public access is not permitted on this storage account." on private container - Stack Overflow