Skip to main content

BLOB STORAGE

Blob stands for Binary large object. we can store files , text , videos etc.

Once we create a storage account, we can create containers ex: image where we can place the image files.

The image img1 can be accessed by using the above url. The storage account name has to be uniques because in order to access the blobs the we need to a unique url.. that is
http[s]://storagename.blob.core.windows,net



Virtual Directories instead of hierarchical structure

Blob storage doesnt support a heirarchical structure, so we can create nested folders to group our files. but we can name the files based on whatever way we want to group the files. Ex: 2020/personal/images/img.jpg

In short , there are no folders. It creates virtual directories and we can access the blobs using the url based on the path.

TYPES


1. Block Blobs: we cant append data to existing ones, but we can replace the old file with a new one. Ex: image , video etc. So if we store the log file as a block blob then we wont be able to append values to it.. it will create a new upload, so block blob type shudnt be specified for such instances.

2. Append Blob: Use append blobs for storing log files as we can append contents.

3. Page Blob: For VM's









 So anytime you build a virtual machine, it's got virtual disks, those virtual disks will be stored as page blobs, and these page blobs are optimized for random read/write operations. Now when it comes to working with other file types, like images and movies, like we were talking about before, those would be stored as block blobs. So block blobs are compromised of multiple blocks of data and, for example, a storage client like the C# storage client we're going to use coming up, has the ability to break up a file into multiple chunks or multiple blocks, and upload those chunks in parallel. So it's optimized for those upload scenarios, and of course, that decreases the upload time. So again, it's going to be the one that you probably use the most. But also keep in mind we have the concept of append blobs, and these are typically used with text files or log files where it's common that you actually are appending a line item to the end of a file, so this is really common with log files

While creating a storage account , we can choose a general account and then we would be able to use the same account for table storage also. if the performance is set to standard then the data will be stored on magnetic disk whereas premium will be stored on ssd storage.  Choose access tier to cool (pay less) normally used when queries arent very frequent.

Azure Blob storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that does not adhere to a particular data model or definition, such as text or binary data. Blob storage offers three types of resources:


Nugets:

1. windowsazure.storage
2. microsoft.windowsazure.configurationmanager (used to read from config files)


Steps
1. get the access keys and copy them to the appsettings file. I have added them under "connection".
2. .Net standard 2.0 supports c# 7.3 , so select 2.1 version if c# 8 was intended.


Access Levels



 You can control public access for your blobs with the public access level that you can set on your containers. By default, the public access level is private, which means your container and your blobs are not visible to the public. Authentication is required to access your container and your blobs, and the URL at the bottom won't return your blob. When you set the public access level to blob, you grant public read access to all the blobs in that container. Now the URL at the bottom returns the content of the logo. png blob, but users need to know the URL to get the blob. They can't find out which blobs exist in your container. And exactly for this scenario, to find out which blobs exist in a container, there is a third public access level that is called container. With that level, anonymous users have still read access to all the blobs in the container, but in addition, they can list the blobs in the container without authentication.















Comments

Popular posts from this blog

App Role assignment to service principal --

 Using Ms Graph Rest API's Permissions One of the following permissions is required to call this API. To learn more, including how to choose permissions, see  Permissions . Permission type Permissions (from least to most privileged) Delegated (work or school account) AppRoleAssignment.ReadWrite.All and Application.Read.All, AppRoleAssignment.ReadWrite.All and Directory.Read.All, Application.ReadWrite.All, Directory.ReadWrite.All Delegated (personal Microsoft account) Not supported. Application AppRoleAssignment.ReadWrite.All and Application.Read.All, AppRoleAssignment.ReadWrite.All and Directory.Read.All, Application.ReadWrite.All, Directory.ReadWrite.All Create 2 app registrations. App role owner will contain the app role that will be assigned to a service principal. The  reader role in approleowner will be added to the approlesubscriber Setup postman to use the Oauth auth flow to get a token for MS Graph. ClientId:   Application (client) ID for approlesubscrib...

ASp.net core 3.1 identity

It is just an extension to cookie authentication. We get a UI, Tables, helper classes, two factor authentication etc. Even EF and its database constructs. So instead of writing code for all of this we can just use these in built features. Extending Default Identity Classes Add a class that inherits from    public class AppUser : IdentityUser     {         public string Behavior { get; set; }     } Also change the user type in login partial.cs under shared folder Then add migrations and update db using migrations. We can customize further.  services.AddDefaultIdentity<AppUser>(options =>              {                 options.SignIn.RequireConfirmedAccount = true;                 options.Password.RequireDigit = false;           ...

Get user groups

 string[] scopes = new string[] { "https://graph.microsoft.com/.default" };             string clientId = "";             string tenantId = "";             string secret = "";                        var options = new TokenCredentialOptions             {                 AuthorityHost = AzureAuthorityHosts.AzurePublicCloud             };             // https://learn.microsoft.com/dotnet/api/azure.identity.clientsecretcredential             try             {                 var clientSecretCredential = new ClientSecretCredential(                        ...