Use Azure computer vision API on images stored on BlobStore - azure

I am trying to integrate Azure computer vision api's, and I would like to access the images stored on Azure blob storage.
The documentation mentions about running vision API's on remote URLs, however I am not able run them on- URL of images stored on Azure blob storage.
Is it possible to run Azure Computer vision APIs on images stored on Blob storage ?

I can reproduce this problem if I change my blob container access level to private(anonymous access) it will show bad request. So I suppose the problem is the image url is not accessible.
So one solution is change the access level to Blob or Container, then you image blob url will be accessible.
Another solution is Hong Ooi provide, use the sas url to access the image blob. And about how to generate sas url, the simplest way is generate it from the portal like below pic, click the Generate SAStoken and URL, it will give you the sas url. If you want a sample code, you could refer to this:Create a service SAS for a container or blob with .NET.

Related

Azure Storage Blob with CodeIgnitor

I'd have a PHP {codeigniter} application that i want to migrate to its storage service from AWS S3 to Blob Storage,The application uploads all media files to S3 bucket and S3 generates a link that is stored to the database in which the media file can be accessed from,I want to do the same with azure Blobs storage.I'm facing technical hindrance as i can't find the right resources {libraries/code samples} achieve this goal.Tried the Azure PHP SKD but it didn't work out.
Actually, there is a detailed sample for using Azure Storage PHP SDK. You may refer to: https://github.com/Azure/azure-storage-php/blob/master/samples/BlobSamples.php
To run that sample, you just need to replace the following place with your own value:
$connectionString = 'DefaultEndpointsProtocol=https;AccountName=<yourAccount>;AccountKey=<yourKey>';
Suggestion:
I see that you want to generate an access url and store it in database. I am not familiar with AWS S3, but with Azure Storage you may need to set public access level on container or blob.
Otherwise, you can not access the blob directly. You may need to created a SAS token.

Viewing Stored Images in Azure Blobs

I have images that are stored in Blobs in Azure. Now I want to display them on a website. What would be the easiest way to display these images ?
Each blob has its own Url which you can retrieve from the Azure Portal or by using the Azure Storage Explorer.
You could save the Urls in your database and display them directly on your website like you would any other image Url.
If your web site requires a CDN, you could add an Azure CDN on top of your blob storage Like this.
Consider using SAS (shared access signature). it's short lived url and gives ability to view image for certian period. you can also provide permissions at granular level.
https://learn.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1
The easiest way is to change the blob container Public access level to Blob or container, then you can visit all the images in the container via link like "https://your_storage_account_name.blob.core.windows.net/your_container_name/your_image.JPG".
You can follow steps below:
1.In azure portal, nav to your storage account -> select the container which stores your image -> change the Public Access Level:
2.After set public access level, then you can use this link I mentioned above to visit your image. In your case, you can just put this link to your website.

save an image from URL to Azure storage directly

I am a newbie in the Azure storage. Is there any way to save an image from URL to Azure storage directly without downloading the image?
Copy Blob REST API can satisfy your requirement, you just need to specify the image URL as the source Blob.
If you're developing with C#, you can leverage StartCopy method.
If you're developing with node.js, you can leverage startCopyBlob method.

Uploading and accessing images with Azure

I want to upload some static images that I will later access via some mobile apps. I have an Azure Account that I rarely use so I thought that was the best place and therefore I uploaded them to a "File Share" within Azure Storage.
I naievely thought I could them just access those files via a simple web request url
https://myplace.file.core.windows.net/app/images/bnb/shop/bugle_200_2.jpg
All this gets me is a BadRequest error. I realize that I could create a Shared Access Signature (SAS) for every file but that seems total overkill.
Is there a better Azure feature to use? I do not want to have to use the Azure APIs to get at these files
Adding a few more points to #CtrlDot's excellent answer.
I completely agree that you should use Blob Storage for storing static content.
On the container permissions, I would actually recommend setting the permission (ACL) to Blob so that user can only view the blob they have the URL for and not enumerate all blobs in a container (setting container ACL to Container will enable the users to list blobs in a container which may not be a desired behaviour for you).
Other than these, there are two distinct advantage of using Blob Storage:
Custom domain: You can map blob storage to a custom domain (e.g. static content.mywebsite.com) and use that to serve the content instead of using Azure Blob Storage standard endpoint (your account.blob.core.windows.net).
CDN: You can also CDN enable your blob storage endpoint. The content will then be replicated across many CDN nodes spread throughout the globe and will be served from a node near to your user thus improving the user experience.
I think the service you should be looking to use is blob storage, not file storage. File storage, as per the documentation, is meant more for SMB shares.
When you setup Azure blob storage, you have a couple of different options. If there is nothing sensitive/secure about these static images, you could consider making a public container and simply accessing the files like that.
If you require authentication, then you need to either use azure storage access keys, or azure storage access tokens. Of the two, the storage access tokens are by far the most secure.
You wouldn't need to create a SAS token for each file, rather, grant it read permission to the container. Once again, you will have to tailor this to the security/sensitivity needs of your application.

Azure Cloud Web Service, storage options

We are migrating our PHP website to Azure Cloud Web Service (Web Role).
Currently the website saves user submitted image files to the filesystem via drive letter access. These images are then served via a url e.g. content.example.com.
What options have I got id I want persistent file storage on an Azure Cloud Web Service.
I am currently assessing BLOB Storage for this.
Thanks
Blob storage is the right answer. Although you could convert your images in base64 and save them in Azure Sql as well, it is really not recommended.
Check: Azure, best way to store and deploy static content (e.g. images/css)? or Where to store things like user pictures using Azure? Blob Storage?
One of the options to reduce re-writing of your application is to mount blob-storage as a network drive. Here is some information how to do it: http://blogs.msdn.com/b/windowsazurestorage/archive/2014/05/12/introducing-microsoft-azure-file-service.aspx
Mounting of the drives can be done on Web-Role start-up task and can be scripted.

Resources