<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Azure Cloud Archives - Pritam&#039;s Blog</title>
	<atom:link href="https://www.pritambaldota.com/category/azure-cloud/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.pritambaldota.com/category/azure-cloud/</link>
	<description>cloud technology, enterprise architecture</description>
	<lastBuildDate>Sun, 23 Feb 2020 05:20:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>
	<item>
		<title>Reading string content from Azure Blob Storage using CSharp (C#)</title>
		<link>https://www.pritambaldota.com/reading-string-content-from-azure-blob-storage-using-csharp/</link>
		
		<dc:creator><![CDATA[Pritam Baldota]]></dc:creator>
		<pubDate>Sun, 16 Feb 2020 23:14:36 +0000</pubDate>
				<category><![CDATA[.Net Core]]></category>
		<category><![CDATA[Azure Blob Storage]]></category>
		<category><![CDATA[Azure Cloud]]></category>
		<category><![CDATA[Azure Blob Storage .net client library]]></category>
		<category><![CDATA[read azure blob content in .net]]></category>
		<category><![CDATA[read csv from azure blob storage in C#]]></category>
		<category><![CDATA[Reading string content from Azure Blob Storage using C# (CSharp)]]></category>
		<guid isPermaLink="false">http://pritambaldota.com/?p=249</guid>

					<description><![CDATA[<p>How to read string content from Azure Blob Storage using CSharp (C#) is very common scenario. For e.g if you want to read CSV blob.&#8230;</p>
<p>The post <a href="https://www.pritambaldota.com/reading-string-content-from-azure-blob-storage-using-csharp/">Reading string content from Azure Blob Storage using CSharp (C#)</a> appeared first on <a href="https://www.pritambaldota.com">Pritam&#039;s Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>How to read string content from Azure Blob Storage using CSharp (C#) is very common scenario. For e.g if you want to read CSV blob.  Azure Blob storage .Net client library v12 is recommended package, but there is no direct API to achieve this easily.</p>



<p>Microsoft released <a rel="noreferrer noopener" aria-label="Azure Blob storage client library v12 for .NET (opens in a new tab)" href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet" target="_blank">Azure Blob storage client library v12 for .NET</a> which is recommended library to work with Azure blob storage going forward. This new SDK is refactored into specific nuget packages based on resources. For e.g. if you want to work with Azure Blob Storage then use <a rel="noreferrer noopener" aria-label="Microsoft.Azure.Storage.Blob (opens in a new tab)" href="https://www.nuget.org/packages/Microsoft.Azure.Storage.Blob/" target="_blank">Microsoft.Azure.Storage.Blob</a> .Net Client package. You can install this via  <strong>dotnet add package Microsoft.Azure.Storage.Blob </strong>command. This package has differences in API signatures as compared to earlier <a rel="noreferrer noopener" aria-label="legacy v11 SDK (opens in a new tab)" href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet-legacy" target="_blank">legacy v11 SDK</a>.</p>



<p>To read serialized string content from blob, there is no direct API available for e.g. reading CSV content line by line. Instead of serialized string, the API will return response content Memory Stream. You can use <a rel="noreferrer noopener" aria-label="StreamReader  (opens in a new tab)" href="https://docs.microsoft.com/en-us/dotnet/api/system.io.streamreader?view=netcore-3.1" target="_blank">StreamReader </a>Api to read the stream at ones or line by line easily with  <a rel="noreferrer noopener" aria-label="ReadLineAsync() (opens in a new tab)" href="https://docs.microsoft.com/en-us/dotnet/api/system.io.streamreader.readlineasync?view=netcore-3.1#System_IO_StreamReader_ReadLineAsync" target="_blank">ReadLineAsync()</a> or <a rel="noreferrer noopener" aria-label="ReadToEndAsync() (opens in a new tab)" href="https://docs.microsoft.com/en-us/dotnet/api/system.io.streamreader.readtoendasync?view=netcore-3.1" target="_blank">ReadToEndAsync()</a> api from StreamReader class from <a href="https://docs.microsoft.com/en-us/dotnet/api/system.io?view=netcore-3.1">System.IO</a> namespace.</p>



<p> The Microsoft.Azure.Stroage.Blob SDK provides  the&nbsp;<a href="https://docs.microsoft.com/en-us/dotnet/api/azure.storage.blobs.blobserviceclient?view=azure-dotnet">BlobServiceClient</a>&nbsp;which allows you to manipulate Azure Storage service resources and blob containers.   </p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">BlobServiceClient blobServiceClient = new BlobServiceClient("connectionString");</pre>



<p>Once you get reference of BlobServiceClient, you can call GetBlobContainerClient() api from blob service client object to get the <a rel="noreferrer noopener" aria-label="BlobContainerClient (opens in a new tab)" href="https://docs.microsoft.com/en-us/dotnet/api/azure.storage.blobs.blobcontainerclient?view=azure-dotnet" target="_blank">BlobContainerClient</a> which  allows you to manipulate Azure Storage containers and their blobs. </p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient("containerName");</pre>



<p>After you get BloblContainerClient, you can get reference of specific blob by GetBlobClient() Api which create a new&nbsp;<a href="https://docs.microsoft.com/en-us/dotnet/api/azure.storage.blobs.blobclient?view=azure-dotnet">BlobClient</a>&nbsp;object by appending&nbsp;<code>blobName</code>&nbsp;to the end of&nbsp;<a href="https://docs.microsoft.com/en-us/dotnet/api/azure.storage.blobs.blobcontainerclient.uri?view=azure-dotnet#Azure_Storage_Blobs_BlobContainerClient_Uri">Uri</a>. </p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">BlobClient blobClient = containerClient.GetBlobClient("blobName.csv");</pre>



<p>You can later call DownloadAsyn() method on BlobClient to download the blob Response Stream, which you can read by StreamReader.ReadLineAsyn() api. </p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">var response = await blobClient.DownloadAsync();
  using (var streamReader= new StreamReader(response.Value.Content))
  {
    while (!streamReader.EndOfStream)
    {
      var line = await streamReader.ReadLineAsync();
      Console.WriteLine(line);
    }
  }</pre>



<p>Complete source code will be as below &#8211;</p>



<pre class="EnlighterJSRAW" data-enlighter-language="csharp" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">BlobServiceClient blobServiceClient = new BlobServiceClient("connectionString");
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient("containerName");
BlobClient blobClient = containerClient.GetBlobClient("blobName.csv");
if (await blobClient.ExistsAsync())
{
  var response = await blobClient.DownloadAsync();
  using (var streamReader= new StreamReader(response.Value.Content))
  {
    while (!streamReader.EndOfStream)
    {
      var line = await streamReader.ReadLineAsync();
      Console.WriteLine(line);
    }
  }
}</pre>



<p>Hopefully, this article helped you figure out how to get this working. </p>
<p>The post <a href="https://www.pritambaldota.com/reading-string-content-from-azure-blob-storage-using-csharp/">Reading string content from Azure Blob Storage using CSharp (C#)</a> appeared first on <a href="https://www.pritambaldota.com">Pritam&#039;s Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Deploy ASP.NET Core apps to Azure App Service with lesser cost</title>
		<link>https://www.pritambaldota.com/deploy-asp-net-core-apps-to-azure-app-service-with-lesser-cost/</link>
					<comments>https://www.pritambaldota.com/deploy-asp-net-core-apps-to-azure-app-service-with-lesser-cost/#comments</comments>
		
		<dc:creator><![CDATA[Pritam Baldota]]></dc:creator>
		<pubDate>Thu, 13 Feb 2020 03:40:57 +0000</pubDate>
				<category><![CDATA[.Net Core]]></category>
		<category><![CDATA[Azure Cloud]]></category>
		<category><![CDATA[Cost Optimization]]></category>
		<category><![CDATA[cost optimization azure]]></category>
		<category><![CDATA[deploy to azure web app with linux]]></category>
		<category><![CDATA[save money with azure web app]]></category>
		<guid isPermaLink="false">http://pritambaldota.com/?p=234</guid>

					<description><![CDATA[<p>When we think of ASP.Net apps, we generally think to host on Azure web Apps on windows OS. Which is awesome and very easy to&#8230;</p>
<p>The post <a href="https://www.pritambaldota.com/deploy-asp-net-core-apps-to-azure-app-service-with-lesser-cost/">Deploy ASP.NET Core apps to Azure App Service with lesser cost</a> appeared first on <a href="https://www.pritambaldota.com">Pritam&#039;s Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When we think of ASP.Net apps, we generally think to host on Azure web Apps on <strong>windows</strong> <strong>OS</strong>. Which is awesome and very easy to manage from <a rel="noreferrer noopener" aria-label=" (opens in a new tab)" href="https://portal.azure.com" target="_blank">Azure Portal</a>. But this OS comes with extra cost due to licensing.    </p>



<p>With ASP.Net Core Microsoft enabled us to run these apps on non-Windows OS platforms like Linux, MacOs. If we explore the <a rel="noreferrer noopener" aria-label="Azure App Services Pricing (opens in a new tab)" href="https://azure.microsoft.com/en-us/pricing/details/app-service/windows/" target="_blank">Azure App Services Pricing</a> and choose Linux OS, then they are almost 30-60% cheaper than the Windows OS pricing based on selected Tiers (Basic/Standard/Premium etc.).</p>



<p>For e.g. Azure App Service with Windows OS with Basic plan charges 55$ per month.</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="521" src="/wp-content/uploads/2020/02/image-1024x521.png" alt="" class="wp-image-236" srcset="https://www.pritambaldota.com/wp-content/uploads/2020/02/image-1024x521.png 1024w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-300x153.png 300w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-768x391.png 768w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-1536x782.png 1536w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-2048x1042.png 2048w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-769x391.png 769w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><a href="https://azure.microsoft.com/en-us/pricing/details/app-service/windows/" target="_blank" rel="noreferrer noopener" aria-label=" (opens in a new tab)">Azure Windows app service plans pricing</a></figcaption></figure>



<p>Whereas, if you choose Linux OS with Basic plan which charges 13$ (Promotional), Standard plan is slight lesser i.e. 4$ less, <strong>Premium Plan is almost 50% lesser</strong> than Windows OS. </p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="579" src="/wp-content/uploads/2020/02/image-1-1024x579.png" alt="" class="wp-image-237" srcset="https://www.pritambaldota.com/wp-content/uploads/2020/02/image-1-1024x579.png 1024w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-1-300x170.png 300w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-1-768x434.png 768w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-1-1536x868.png 1536w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-1-2048x1157.png 2048w, https://www.pritambaldota.com/wp-content/uploads/2020/02/image-1-769x435.png 769w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><a rel="noreferrer noopener" aria-label="Azure Linux app service plans pricing (opens in a new tab)" href="https://azure.microsoft.com/en-us/pricing/details/app-service/linux/" target="_blank">Azure Linux app service plans pricing</a></figcaption></figure>



<p>Cost plays very crucial roles for any Organization, specially when it is startup where every single penny worth to save. I have worked with several startups and had first hand experience on how cost impacts with time. Specially when startups joins Microsoft BizSpark kind of programs where they get free unlimited credits for certain period, which gives us opportunity to focus on business/technology and not worry on infrastructure cost. But at the end of program they end up using over provisioned resources which lands them into huge monthly bills. </p>



<p>We should do proper capacity planning on costing by evaluating alternatives which will save money. </p>



<p>We may not get all the features of Windows  OS hosting vs hosting on Linux OS, but there are always workarounds. From feature parity we can achieve everything regardless of what will be our host OS.     </p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>We should be always careful when we choose the resources even though they are free. </p></blockquote>



<p>You can read more on  <a href="https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-intro">Azure App Service on Linux</a>. </p>
<p>The post <a href="https://www.pritambaldota.com/deploy-asp-net-core-apps-to-azure-app-service-with-lesser-cost/">Deploy ASP.NET Core apps to Azure App Service with lesser cost</a> appeared first on <a href="https://www.pritambaldota.com">Pritam&#039;s Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.pritambaldota.com/deploy-asp-net-core-apps-to-azure-app-service-with-lesser-cost/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
