1
votes

Trying to develop a Xamarin Forms mobile application which displays blobs stored in Azure-Storage container through the api.

Current process goes like this API > Azure-Storage Blob > Displayed in Xamarin mobile application.

Connecting to azure storage using Storage Account Key.

Problem is, blobs are not displaying in the mobile application when public access setting on the container is set to 'private'. If the container public access setting is set to 'blob' then the photos display in the xamarin Mobile app.

Photo For illustration purposes.Photo of issue

Code is below.

string storageConnectionString 
Environment.GetEnvironmentVariable("storageconnectionstring");

CloudStorageAccount storageAccount;
if (CloudStorageAccount.TryParse(storageConnectionString, out 
storageAccount))
{
// If the connection string is valid, proceed with operations against 
Blob storage here.
...
}
else
{
//Error
}
[enter image description here][1]CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();

How can i make the container private whilst still displaying the blobs in the mobile application?

2
you seem to be leaving out a lot of relevant code about how you're accessing the blob data and displaying the images. We can't tell you what's wrong if we can't see what you're doingJason

2 Answers

0
votes

I think you might be using the wrong kind of connection to Azure blob storage.

You need to be using a shared key.

shared key authentication with azure blob storage

You will need to generate a new shared access signature.

create a new SAS

I hope this points you in the right direction.

0
votes

Many thanks for your help @justjoshin.

SAS is the answer. From there you can generate a SAS token which you append after the blob url to display it even if the container is private.

Hope this helps anyone else.

Best