How to Read blob file from Microsoft Azure Storage with .NET Core

In order to read a blob file from a Microsoft Azure Blob Storage, you need to know the following:

  • The storage account connection string. This is the long string that looks like this:
    DefaultEndpointsProtocol=https;
    AccountName=someaccounfname;
    AccountKey=AVeryLongCrypticalStringThatContainsALotOfChars==
  • The blob storage container name. This is the name in the list of “Blobs”.
  • The blob file name. This is the name of the blob inside the container. A file name can be in form of a path, as blobs are structured as a file structure inside the container. For ecample: folder/folder/file.extension

You also need this NuGet package:

Windows.Azure.Storage

The code is pretty simple:

using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
 
public string GetBlob(string containerName, string fileName)
{
  string connectionString = $"yourconnectionstring";
 
  // Setup the connection to the storage account
  CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
   
  // Connect to the blob storage
  CloudBlobClient serviceClient = storageAccount.CreateCloudBlobClient();
  // Connect to the blob container
  CloudBlobContainer container = serviceClient.GetContainerReference($"{containerName}");
  // Connect to the blob file
  CloudBlockBlob blob = container.GetBlockBlobReference($"{fileName}");
  // Get the blob file as text
  string contents = blob.DownloadTextAsync().Result;
   
  return contents;
}

The usage is equally easy:

GetBlob(“containername”, “my/file.json”);

How to split string in SQL Server

There could be many method but here are two simple one;

DECLARE @ValueToSplit NVARCHAR(50) = N'12345VA [987]'

--This is classical method to split string
SELECT
	SUBSTRING(@ValueToSplit, 0, CHARINDEX('[', @ValueToSplit)) AS [FIRST],
	SUBSTRING(@ValueToSplit, CHARINDEX('[', @ValueToSplit)+1, LEN(@ValueToSplit)) AS [SECOND]

--This function can be used in SQL 2016 onward
SELECT split.*
FROM
(
	SELECT ROW_NUMBER() OVER(ORDER BY (SELECT 1)) RowNumber, value AS TextValue FROM STRING_SPLIT(@ValueToSplit,'[')
) split
WHERE 1=1
AND split.RowNumber = 1

Here are the results;

Microservice and Idempotent method

Idempotent method is the one that results in same behavior either in a single or mutiple calls. For example a delete method will delete a resource
and return 204 first time. on subsequent calls it will return 404. return codes has nothting to do with idempotent behavior but the fact is that
behavior of call will always be the same.

+———+——+————+
| Method | Safe | Idempotent |
+———+——+————+
| CONNECT | no | no |
| DELETE | no | yes |
| GET | yes | yes |
| HEAD | yes | yes |
| OPTIONS | yes | yes |
| POST | no | no |
| PUT | no | yes |
| TRACE | yes | yes |
+———+——+————+

An overview of Azure SQL Database and SQL Managed Instance security capabilities

This article outlines the basics of securing the data tier of an application using Azure SQL Database and Azure SQL Managed Instance. The security strategy described follows the layered defense-in-depth approach as shown in the picture below, and moves from the outside in:

You can read more about this here;

https://docs.microsoft.com/en-gb/azure/azure-sql/database/security-overview#transport-layer-security-tls-encryption-in-transit

The 7Ws Framework

1-Who is involved?
Person or organization of interest to the enterprise. That is, “Who is important to the business?” Often a ‘who’ is associated with a role such as Customer or Vendor
For example Employee, Patient, Gambler, Suspect, Customer, Vendor, Student, Passenger, Competitor. An invoice can have this info; Who sold it

2-What did they do? To what is it done?
Product or service of interest to the enterprise. It often refers to what the organization makes that keeps it in business. That is, “What is important to the business?”. For example Product, Service, Raw Material, Finished Good, Course, Song, Photograph. An invoice can have this info; What was sold

3-When did it happen?
Calendar or time interval of interest to the enterprise. That is, “When is the business in operation?”. For example Time, Date, Month, Quarter, Year, Calendar, Semester, Fiscal Period, Minute. An invoice can have this info; When was it sold

4-Where did it happen?
Location of interest to the enterprise. Location can refer to actual places as well as electronic places. That is, “Where is business conducted?. For example
Mailing Address, Distribution Point, Website URL, IP Address. An invoice can have this info; Where was it shipped

5-Why did it happen?
Event or transaction of interest to the enterprise. These events keep the business afloat. That is, “Why is the business in business?”. For example
Order, Return, Complaint, Withdrawal, Deposit, Compliment, Inquiry, Trade, Claim. An invoice can have this info; This happened because of an Order

6-How did it happen – in what manner?
Documentation of the event of interest to the enterprise. Documents record the events, such as a Purchase Order recording an Order event. That is, “How does the business stay in business?”. For example Invoice, Contract, Agreement, Account, Purchase Order, Speeding Ticket. An invoice can have this info; How many items were sold

7-How many or much was recorded – how can it be measured?
How much of documentation is recorded and what’s the left over. An invoice can have this info; How much items were sold

The 7Ws are interrogatives question forming words.
Fact table represents verbs. Dimensions that surround them are nouns. Out of 7Ws, 5Ws are dimension and 6th, 7th one is fact.