<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Subhankar Sarkar on Medium]]></title>
        <description><![CDATA[Stories by Subhankar Sarkar on Medium]]></description>
        <link>https://medium.com/@subhankars?source=rss-e5547d32aa72------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*U9QrjdteqJO3fwq4442yVA@2x.jpeg</url>
            <title>Stories by Subhankar Sarkar on Medium</title>
            <link>https://medium.com/@subhankars?source=rss-e5547d32aa72------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 03:03:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@subhankars/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Savoring Generative AI with Culinary Analogy]]></title>
            <link>https://subhankars.medium.com/savoring-generative-ai-with-culinary-analogy-d331f729c616?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/d331f729c616</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 08:27:30 GMT</pubDate>
            <atom:updated>2024-09-13T09:25:21.958Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SKW_0II5vHA-Smd7.png" /></figure><p>The term Generative AI is everywhere in the business world these days, accompanied by a plethora of technical terms that can be overwhelming. Concepts like foundational large language models (LLM), Retrieval-Augmented Generation (RAG), model fine-tuning, and building a domain specific custom language models might seem like a foreign language, even to tech-savvy individuals.</p><p>In this blog post, we’ll break down these complex concepts using relatable culinary metaphors and discuss which technique is best suited for each situation. By imagining AI as a master chef with a range of tools and recipes, we’ll explore the world of Generative AI in a way that’s easy to digest.</p><h3>The Foundational Large Language Models: The Master Chefs</h3><p>Think of the base foundational large language model as the master chef. This chef has years of experience, a vast range of recipes, and an exceptional understanding of different cuisines. Just like a master chef, a foundational language model has been trained on a massive dataset. This extensive training allows the model to understand and generate human-like content efficiently.</p><p>When you interact with applications like ChatGPT or Gemini and ask a question, you are engaging with the foundational models behind them, which are responsible for answering your query. Examples of foundational models include OpenAI’s GPT-4, GPT-3.5, as well as Meta’s LLaMA 3.1 etc.</p><p>The foundational model has a knowledge cutoff, meaning it can only provide answers based on information available up to a certain date, which may result in outdated responses for events or developments that occurred afterward.</p><p>When you need a general-purpose AI capable of handling a wide range of tasks — such as generating articles, creating chatbots, or even composing music — the foundational model is your go-to chef.</p><h3>Retrieval-Augmented Generation (RAG): The Chef with a Secret Recipe Book</h3><p>Now, imagine our master chef has access to a secret recipe book that contains specialized knowledge or modern cooking techniques that the chef was not initially trained on. Upon request from the diner, the chef learns these new techniques and creates a new dish, combining existing knowledge with updated insights from the book. This is analogous to Retrieval-Augmented Generation (RAG). RAG merges the knowledge of the base model with a retrieval mechanism to access specific, up-to-date information from external data sources, enhancing the accuracy and relevance of the generated content.</p><p>RAG addresses the base model’s knowledge cutoff by providing access to up-to-date information without modifying the base model. The effectiveness of RAG depends on the quality and relevance of the information in the dataset; poorly maintained or biased data can compromise the output.</p><p>RAG is ideal for scenarios where AI needs to generate content with specific, recent information, such as a chatbot providing details on the latest products or responding to company internal policies that are not publicly available and beyond the foundational model’s knowledge.</p><h3>Fine-Tuning a Model: The Chef Learning a New Cuisine</h3><p>Picture our master chef deciding to specialize in a new cuisine, such as Italian and Asian fusion. To do this, the chef will learn specific techniques, ingredients, and recipes to create fusion dishes that will have unique tastes, colors, fragrances, and more. Similarly, fine-tuning a model involves further training a foundational model on a specific dataset to specialize in a particular domain, enhancing its capabilities within that scope.</p><p>Fine-tuning adapts the model to a specific dataset, enabling it to better capture the nuances of a domain or style. However, fine-tuning can lead to overfitting, where the model excels in one domain but struggles in more general areas. Additionally, fine-tuning requires significant technical expertise, as well as data and computational resources.</p><p>Fine-tuning is ideal for tasks that demand domain-specific expertise, especially when you want the model to adapt to a particular style or vocabulary, and when you have a limited dataset to train the foundational model. For example, a healthcare chatbot may need to understand medical terminology and answer patients’ specific queries, while a finance chatbot specializes in solving financial problems. For example — Med-PaLM, tuned on the PaLM base model, is a fine-tuned model designed to provide answers to medical questions, while FinGPT uses LLaMA-2 as a base model and is fine-tuned for finance.</p><h3>Domain-Specific Custom Model: The Super-Focused Chef</h3><p>Imagine our chef decides to create an entirely new cuisine by blending unique ingredients and techniques. This is like building a custom model from scratch. You gather data, design your architecture, and train your model to create something entirely new and tailored to your needs.</p><p>Custom models focus tightly on specific tasks and domains, providing precise and relevant outputs. A domain-specific custom model can generate accurate answers relevant to the domain by being purposefully designed for a particular problem.</p><p>Building a custom model makes sense when you have a large dataset of high-quality data and want the model to perform a specific task exceptionally well. For example, a model trained on a specific dataset about a disease can effectively detect that disease. In our chef analogy, this chef has learned exclusively how to cook that specific cuisine exceptionally well after undergoing rigorous training and can only prepare dishes within that new cuisine.</p><p>For example — BloombergGPT is a custom-built large language model trained on Bloomberg’s financial data, capable of addressing a diverse set of financial tasks.</p><h3>Conclusion</h3><p>In conclusion, using culinary metaphors to understand Generative AI makes complex concepts more accessible. Foundational large language models are similar to master chefs with broad expertise, while Retrieval-Augmented Generation (RAG) is like a chef using a secret recipe book to access up-to-date information. Fine-tuning a model enhances its capabilities in specific domains, much like a chef learning a new cuisine. Similarly, building a domain-specific custom model is equivalent to creating a new cuisine, tailored to precise tasks. I hope this article has simplified some of the most commonly used buzzwords in the Generative AI world and will help you determine which technique is right for you. Happy reading!</p><p><em>Originally published at </em><a href="https://subhankarsarkar.com/discover-generative-ai-through-culinary-analogy/"><em>https://subhankarsarkar.com</em></a><em> on September 10, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d331f729c616" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplest Way to Create SPN and Service Connection for Azure DevOps Pipelines]]></title>
            <link>https://subhankars.medium.com/the-plain-and-simple-way-to-create-spn-and-service-connection-for-azure-devops-pipelines-d3b65ca1157?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3b65ca1157</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[azure-portal]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Sat, 17 Jul 2021 19:14:58 GMT</pubDate>
            <atom:updated>2021-07-21T10:54:16.330Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xp6uPLbTCgSLrwt9GlBarw.jpeg" /></figure><p>If you are getting started with Azure DevOps Pipeline for Application Deployment in Azure, you need two basic things for your Azure Pipeline to Authenticate and deploy to Azure. One — a Service Principal Name (SPN) in Azure and a Service Connection in Azure DevOps.</p><p>In this article, I’m going to show you how to quickly create SPN in Azure Portal and a Service Connection in Azure DevOps.</p><h3>Background — Azure SPN and DevOps Service Connection</h3><p><strong>TL; DR:</strong> You can skip this section if you just want HOW TO guide. Just jump to <em>Creating an Application Registration and SPN in the Azure Portal </em>section to get started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ELWRLv4R7__Ud0v-P7E8kA.png" /></figure><p>For simplicity, think of SPN as a <strong>service account</strong> in Azure Active Directory. An Active Directory can be mapped with multiple Subscriptions. A subscription can have one or many resource group(s). These resource group(s) contain various Azure resources (ex: App Service, Azure Function, etc.) where you want to deploy your code (see the diagram above).</p><p>For an Azure DevOps pipeline to deploy something to Azure Resources, it needs to authenticate itself. It needs contributor privilege so that it can write the build artifacts to the Azure Resources. Azure DevOps uses a service account (SPN) with contributor access to create a Service Connection to Azure. This service connection allows the pipeline agents to connect to Azure and deploy the code.</p><p>Okay, now let’s jump into the action —</p><h3>Creating Application Registration and SPN in the Azure Portal</h3><p>To start with, you will have to do an <em>App registration</em> which will create the SPN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xTASvFNETm1HzGcj1mJxeg.png" /></figure><p>In the Azure Portal, go to <em>Active Directory</em><strong> </strong>and select <em>App registration</em>. Once you are on the App registration page, click on the <em>+ New registration.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O8uSW57kHbb0srrAQspSNQ.png" /></figure><p>Use a unique <em>Name </em>for the app, chose <em>Supported account types</em>. Now in the <em>Redirect URI</em> select web or give some URL (this is an optional step; you can use localhost too). Click on the <em>Register </em>button. This will create your application registration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4_D9sFZSZwhNfdKbZ2cXGA.png" /></figure><p>Once the App is registered, the next is to create the <em>Client Secret. S</em>elect <em>Certificates &amp; secrets</em> from the left blade. Click on the<em> New client secret</em> option and provide some <em>Description </em>&amp; <em>Expiry </em>date of the Secret. Click on the <em>Add </em>button at the bottom. This will create the secret (think it is as password).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r4QGmg4qHO75FDfCNchrSg.png" /></figure><p>Copy the <em>Value </em>and keep it safe and handy. Next, you will need to get the <em>Client ID</em>, <em>Directory </em>(tenant Id) <em>ID</em> and <em>Subscription name</em>, <em>Subscription Id</em>.</p><p>For <em>Client ID</em> and <em>Directory (tenant) ID </em>go to Application Registration’s <em>Overview </em>page and copy them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HKfDEzdOJmXuPClSfX9VDQ.png" /></figure><p>This completes your SPN creation. Next, you will have to grant this SPN the contributor access to the Azure resource group(s).</p><h3>Grant Contributor Access to the Azure Resources</h3><p>Now the Application is registered, and you got the Client Id, Secret for this app in previous steps. To grant SPN the contribution access to the Azure resource group, go to your resource group where you want to add this service account (SPN) as contributor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fuuh_-7L-B2XQjuRylMcjQ.png" /></figure><p>From the left blade, select <em>Access control (IAM)</em>, <em>+Add</em>, select role as <em>Contributor</em>, <em>Assign access to User, group or service principal</em>. In the <em>Select </em>text box search with the app registration name, created in the previous steps. Once the app is visible in search select that and <em>Save</em>.</p><p>Okay, you are done with the first 2 steps. First — creating the app registration (creation of SPN). Second — granting the SPN the contributor access in the resource group where Azure DevOps pipeline will deploy your code.</p><p>Next step is creating the Service Connection in the Azure DevOps portal with the help of the SPN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HvkNr4BlkZYofSYLxAD6XQ.png" /></figure><p>Before leaving the Azure Portal copy the <em>Subscription name</em> and <em>Subscription id </em>from Resource Group’s <em>Overview </em>page and keep them handy.</p><h3>Creating Service Connection using SPN in the Azure DevOps portal</h3><p>Switch the gear now and move to Azure DevOps Portal to create a Service Connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vhBahso8k2FLOjaH8k-vHQ.png" /></figure><p>Go to the <em>Project Settings</em> page click on the <em>Service connections</em>. Click on the <em>New service connection</em>, then select <em>Azure Resource Manager </em>(I found it simple), click on <em>Next</em>. Select <em>Service Principle (manual)</em> option and go to the next page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p_3ktxOmILonBejDIz0HBA.png" /></figure><p><em>Select Scope level — </em>subscription, <em>Credential </em>— Service principal key, Give a <em>Name </em>to your service connection. Click on the Verify button. If <em>Verification is successful</em> then <em>Save </em>it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2f1SIf5VYbAkbA16vCfLg.png" /></figure><p>Viola, your SPN and Service Connection is created. You are now all set to create your first release pipeline in Azure DevOps.</p><h3>Using the Azure DevOps Service Connection in Release Pipelines</h3><p>Now that the service connection is verified properly, you can use the Service Connection in the release pipelines as below -</p><p><strong>The YAML way</strong></p><pre>#Example Publish to Azure App Service</pre><pre>- task: AzureWebApp@1</pre><pre>inputs:</pre><pre>appType: webAppLinux</pre><pre><strong>azureSubscription: &#39;MySPN&#39;</strong> #this is the name of the SPN</pre><pre>appName: $(azureAppServiceName) #App Service&#39;s unique name</pre><pre>package: $(Build.ArtifactStagingDirectory)/**/*.zip</pre><p><strong>The classic release pipeline designer way</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_Dph1sjBSn34BmTVt-fsQ.png" /></figure><h3>Wrapping up</h3><p>While I’m wrapping this article, it is needless to say that to perform these steps you need some degree of elevated privileges. If you have the blessing of your IT department then all the steps can be completed within 5 minutes.</p><p>There are many other <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals">options </a>to create Service Connection and SPN for Azure DevOps pipelines. However, I have been using this technique for quite some time. I find this technique very intuitive and really quick for beginners with less learning curve.</p><p>I hope this helps, Happy DevOps-ing. Cheers…!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3b65ca1157" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[.NET 6 Azure Web App deployment using Azure DevOps]]></title>
            <link>https://subhankars.medium.com/net-6-azure-web-app-deployment-using-azure-devops-5692aa92aab6?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/5692aa92aab6</guid>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[dotnet6]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Sat, 03 Jul 2021 17:49:51 GMT</pubDate>
            <atom:updated>2021-07-17T19:20:20.713Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBb3XbifuKAHApInpI-e3w.jpeg" /></figure><p>This is the Summer of 2021, and Summer means a ton of new announcements and public previews of cool stuff from Microsoft to play with. This summer a few things are on my radar and, I’m really excited about the possibility.</p><p>First and foremost, <a href="https://dotnet.microsoft.com/download/dotnet/6.0"><strong>.NET 6</strong></a> with <strong>C# 10</strong> (I can see the future lies here). <a href="https://visualstudio.microsoft.com/vs/preview/vs2022/"><strong>Visual Studio 2022</strong></a> and finally <a href="https://insider.windows.com/en-us/insidewindows11"><strong>Windows 11</strong></a>. I got my personal development machine updated last weekend. To put everything into a test, I wanted to write a piece of code in .NET 6 (a Minimal API) with C# 10 in Visual Studio 2022 IDE on Windows 11, test it on Linux (<a href="https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux">WSL2</a>). And, finally, deploy the app in <strong>Azure App Service</strong> using <strong>Azure DevOps</strong> pipeline.</p><p>Many in the Developer community including me think that GitHub is becoming the first-class citizen for Microsoft and Azure DevOps, the second. Azure DevOps is being considered in the “Others” category in most of the places. But I think many organizations are still on Azure DevOps and will be there for quite some time.</p><p>This blog post is for those, who are using Azure DevOps and wants to Code, Build and Continuously deploy their Modern .NET 6, C#10 apps to Azure using the Azure DevOps pipeline.</p><p>Alright, let’s get started with the .NET 6, C# 10 coding in Visual Studio 2022.</p><h3>First thing first — code the .NET 6 API</h3><p>With Visual Studio 2022, .NET 6 comes preinstalled. To start with, I fired up the new <a href="https://devblogs.microsoft.com/commandline/introducing-windows-terminal/">Windows Terminal</a> (this comes pre-installed with Windows 11). I ran the command dotnet new web -o &lt;your app name&gt; to create the barebone API project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*ogayzlldtI6mgVZRDFqnZA.png" /></figure><p>Next, I opened this project in Visual Studio 2022. It created a single file API project with only <em>Program.cs </em>file, unlike any other older .NET core versions. Yes, it doesn’t have a <em>startup.cs</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nv5DF3phZGqvQLgXJg7VeQ.png" /></figure><p>This gave me a plain vanilla .NET 6 minimal API code base.</p><p>You can clone the complete sample project from <a href="https://github.com/subhankars/DotNet6MinimalApi">here</a>.</p><p>NOTE:<em> If you are only interested in deploying a .NET 6 app in Azure App Service using Azure DevOps pipeline. Then you can directly jump into Build the home for the API in Azure App Service section and skip the next two sections.</em></p><h3>Giving a touch of C# 10</h3><p>I wanted to use some C#10 features in this API. At the time of writing of this blog C# 10 is in preview and the default C# version for Visual Studio 2022 is C# 9.</p><p>You can check the default version of Visual Studio C# language version by running csc -languageversion:? command in Visual Studio Developer Command Line</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yCRHLa-HvnPkGLrvUltkmw.png" /></figure><p>So, to give this code a little bit of C# 10 touch, I changed the C# runtime to preview. To do so, I have edited the <em>.csproj</em> file from Visual Studio Solution Explorer (right-click on the project &gt;&gt; Edit project file) and added LangVersionas preview</p><pre>&lt;PropertyGroup&gt;</pre><pre>&lt;LangVersion&gt;preview&lt;/LangVersion&gt;</pre><pre>&lt;TargetFramework&gt;net6.0&lt;/TargetFramework&gt;</pre><pre>&lt;/PropertyGroup&gt;</pre><p>This enabled C# 10 as the language runtime of my API project.</p><p>I wanted to use the Global Namespace feature of C#10. The global namespace feature allows us to have all the import using into one single file as global import.</p><p>Observe the <em>program.cs</em> file. At the beginning of the file, there are no using imports. I have moved all of them into a new file <em>Globalnamespace.cs</em> and used global using as below —</p><pre>global using System;</pre><pre>global using Microsoft.AspNetCore.Builder;</pre><pre>global using Microsoft.Extensions.Hosting;</pre><p>There are many new cool features coming to .NET 6 &amp; C# 10. You can learn more from <a href="https://www.youtube.com/watch?v=2Ky28Et3gy0">here</a>.</p><h3>Dev testing in Linux (WSL2)</h3><p>Now that my code is ready. I wanted to check how it behaves in a Linux environment as I’m planning to use Linux OS for the Azure App Service. To test it out I ran this app in WSL2 from Visual Studio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eSUjWk8S-HsP0XRAh5t_UA.png" /></figure><p>NOTE: <em>If the .NET 6 is not installed on your WSL, then it will prompt you to install and it may take a while. Once installed you can select WSL 2 from the dropdown and run the API.</em></p><p>After a basic round of testing, I have committed the code to my Azure DevOps project’s Git Repo.</p><p>Next step is to create a home for this API app in Azure.</p><h3>Build the home for the API in Azure App Service</h3><p>To host the API, I have created an Azure app service and selected Runtime Stack as <strong>.NET 6</strong> (Early Access), Operating System as <strong>Linux, </strong>and Publish type as <strong>Code</strong>.</p><p>NOTE: <em>While writing this blog .NET 6 runtime for Azure App Service is in </em><a href="https://azure.github.io/AppService/2021/06/09/Dot-Net-6-Preview-on-App-Service.html"><em>Early Access</em></a><em> .</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sOnx_QOlXJIG1wX9PsvLoA.png" /></figure><p>Since this is just for my testing, I have chosen the Free Tier as SKU and Size.</p><p>This App Service will be the home for my .NET 6 Minimal API. Next, I’m going to set up the Azure DevOps pipeline for continuous deployment.</p><h3>Setup Continuous Deployment with Azure DevOps Pipeline</h3><p>I have already committed my code in the Azure DevOps Git repo in the previous step. Now, my objective is to create a pipeline and deploy the API in the Azure app service.</p><p>NOTE: <em>To deploy the API from the Azure DevOps to Azure App Service, a Service Principal Name (</em><a href="https://subhankars.medium.com/the-plain-and-simple-way-to-create-spn-and-service-connection-for-azure-devops-pipelines-d3b65ca1157"><em>SPN</em></a><em>) is needed.</em></p><p>Next, I started creating the pipeline using the <em>Set up build </em>button. <em>This button is available in the code repository page itself.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*txq4AF3RxVqO_X9zFAaDEQ.png" /></figure><p>After clicking the <em>Set up build</em> button, I choose the <em>Starter Pipeline</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*e_ne23UvMdQ1ZlfK6dT_fw.png" /></figure><p>This will create a yml file with a few basic steps. I have replaced the entire code with the below code snippet –</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf7e9920d81c17184089b6cdb9502470/href">https://medium.com/media/bf7e9920d81c17184089b6cdb9502470/href</a></iframe><p>The above Azure Pipeline Code <a href="https://gist.github.com/subhankars/6e9064cd7c03f8cdd939392d6736ea90#file-dotnet6azuredevopspipeline-yml">snippet </a>does the following —</p><ol><li>Gets the code from the Git repo and build it targeted for.NET 6</li><li>Publishes the code as a self-contained application for Linux runtime</li><li>Packages the published output, Zips, and uploads to the artifact location</li><li>Finally, the Azure Web App build task pushes the Zip file to the Azure App Service</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DKUkMPFJfFjeLmEXctMQXw.png" /></figure><p>Since it is a continuous deployment pipeline, upon every code commit to the Git repo this pipeline deploys the .NET 6 API Code to the Azure app service.</p><h3>Testing the Deployed API</h3><p>The DevOps pipeline ran smoothly for me and it deployed the code to the Azure App Service.</p><p>In my Minimal API, I have two endpoints</p><pre>app.MapGet(&quot;/&quot;, (Func&lt;string&gt;)(() =&gt; &quot;Welcome to .NET 6 Minimal API with C# 10!&quot;)); <br>app.MapGet(&quot;/counter&quot;, (Func&lt;int&gt;)(() =&gt; ++counter ));</pre><p>The default one (<em>/) </em>shows a greeting message and the other one (<em>/counter</em>) increases the counter by 1 on every call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B-Dm14fI8TYK5eJZgMYYGw.png" /></figure><p>I opened both the URL in the Windows 11 vertical tabbed Edge browser (you can use any other modern browser of your choice). I got the desired result from both endpoints without any issue.</p><p>This completes the entire journey of Code, Build and Deployment of a .NET 6 C# 10 API in Azure using Azure DevOps pipeline. YAY!!!</p><h3>Wrap up</h3><p>In this blog post, I wanted to cover the readiness of the Azure DevOps pipeline and Azure App Service for .NET 6 and C# 10. And, so far everything looks green.</p><p>After running the entire test, I’m happy with the result. I was able to Code, Build and Deploy a .NET 6 API with C# 10, and I was able to deploy in Azure App Service using Azure DevOps pipeline without any hiccups.</p><p>As I conclude my blog here, I am waiting to see how the developer community is building and deploying their modern apps with Azure and Azure DevOps. Cheers!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5692aa92aab6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hosting Free Website with Serverless backend on Azure Static Web App]]></title>
            <link>https://subhankars.medium.com/hosting-free-website-with-serverless-backend-on-azure-static-web-app-e212228c7358?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/e212228c7358</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[azure-functions]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-devops]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Sun, 16 May 2021 11:47:15 GMT</pubDate>
            <atom:updated>2021-05-16T11:47:15.249Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cYTzFZvU2ium5bWSoSFZcw.jpeg" /></figure><p>If you are looking for a cost-optimised website deployment (or may be a free web hosting) in Azure then this is for you.</p><p>A couple of years ago I found a <a href="https://subhankarsarkar.com/one-dollar-deployment-of-single-page-application-in-azure/">technique </a>of hosting static Websites in Azure that costs only a Dollar (I call it <strong>One Dollar Deployment</strong>). This was using Azure Storage’s <a href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website">static website</a>.</p><p>In Build 2020, Microsoft <a href="https://techcommunity.microsoft.com/t5/apps-on-azure/introducing-app-service-static-web-apps/ba-p/1394451">announced </a><strong>Azure Static Web App</strong> with a Serverless Backend. This was different than my Azure Storage’s static website. It was fully managed and automated using GitHub actions. I was excited about the possibilities of it but wasn’t happy that it supported GitHub actions only for deployment.</p><p>After almost a year, Azure Static Web App started supporting Azure DevOps in Public <a href="https://azure.microsoft.com/en-in/updates/public-preview-azure-static-web-apps-now-supports-deployment-with-azure-devops/">preview</a>. Now Azure Static Web App is <a href="https://azure.microsoft.com/en-in/blog/develop-production-scale-modern-web-apps-quickly-with-azure-static-web-apps/">Generally Available</a> (GA) for everyone to use.</p><p>Interestingly enough with the Free tier, you can literally host your static website built in any supported languages with a serverless backend completely Free.</p><p>In this article, I’m going to guide you on how to build a Static Website with an Azure Function backend. And deploy the code using Azure DevOps.</p><p>Before we jump into the code, let’s see what is new in Azure Static Web App which is not available in the One Dollar Deployment technique.</p><h3>What’s New</h3><p>Unlike hosting a static website in Azure Storage (read One Dollar Deployment), in Azure Static Web App, you get many inbuilt goodies. A few of my favorite features are -</p><ol><li>The Website is globally distributed and served by CDN — enhanced performance by default</li><li>Full support for root domains — you just need to buy a Domin for your site. (Only this is not free)</li><li>Free SSL certificate (for your custom Domain also) — modern browsers won’t flag your site as insecure</li><li>Serverless Azure function support — build your backend in your favourite language. C#, Node, JavaScript, etc.</li></ol><p>All the above features are available even on the Free tier.</p><h3><strong>Price Check</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0N4up0PMMOeVJpa6c5OQWQ.png" /></figure><p>You can find the detailed pricing is <a href="https://azure.microsoft.com/en-gb/pricing/details/app-service/static/">here</a>.</p><p>For demonstration purposes, I’m going to host a basic blog-style Angular website. This site will display a list of blog posts on the home page. The blog data, I’m going to fetch from an Azure Function backend. This is nothing fancy I want, so I’m good with the Free tier.</p><p>Note: If you want to host your business-critical website. Then you may want to consider the Standard tier.</p><h3>Taking the first step</h3><p>Before we start coding, we have to create an Azure Static Web App first. I’m going to use Azure Portal to create one for simplicity.</p><p>Create a “Static Web App” resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*TCVmKezUHWIt4MpoS8FXEQ.png" /></figure><p>Give a <strong>Name </strong>for your app. Select Plan Type <strong>Free </strong>and Select <strong>Other </strong>as Deployment details. <em>Honestly, I didn’t like that Azure DevOps is now considered under other category :(</em></p><p>Once the resource is created, you will see something like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5tByuvb_PbhoA6JmRblCQ.png" /></figure><p>It will generate some random URL for your app. <em>I would have liked it to come from the Name I gave in the previous step. Why a random url?</em></p><p>Observe the location is <strong>Global</strong>. <em>Since it will be served from a globally distributed CDN, I think this is why it is shown as Global</em>. Observe the <strong>Manage deployment token option</strong>. We will use it to setup the Azure DevOps setup in a later stage.</p><p>After the creation of the Static Web App resource, you won’t see any Azure Function created by default as a part of the resource creation steps.</p><p>You will notice a Functions option in the left navigation blade.</p><p><em>When I clicked Functions. I didn’t see any option to create the Azure Function from here. I was expecting to create the Azure Function from here at least.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZSjcVbbFjoxR9hxk4cCzxQ.png" /></figure><p>Anyways… this is what we have for now. Don’t worry about the Azure Function creation from here now. In the next sections, you will find a way to do so.</p><p>Now the basic Azure resource creation is complete, let’s set up the code repository structure and add some code to start with.</p><h3>Code repository setup</h3><p>In my Demo app, I need two folders. One for the static website (Angular website) and another folder for the Azure Function code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*coaYcPm396JzXAJgyo9T6g.png" /></figure><p>I’m going to use api folder to house my AzureFunction code and WebSite folder to house my Angular Code.</p><p>Don’t bother about the azure-pipelines.yml file now. I will come there shortly.</p><h3>Adding Code</h3><p>Prerequisite — I have used Visual Studio Code (VS Code) for this code setup. If you have Angular development setup in your VS Code then you are good. If you do not have the Azure Function <a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions">extension </a>installed then please go ahead and do so.</p><p>You <strong>do not need</strong> the Azure Static Website <a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps">extension </a>for Azure DevOps deployment. Don’t get confused about the documentation.</p><p>You need to login to your Azure and Azure DevOps account from your VS Code. This is required for continuous deployment to Azure DevOps.</p><h4>Adding Angular Code</h4><p>Go to the WebSite folder and start creating your angular code using familiar Angular CLI commands.</p><p>I’m not an expert Angular expert, so I cloned <a href="https://github.com/StartBootstrap/sb-clean-blog-angular">this </a>repository and <a href="https://github.com/subhankars/StaticWebApp">modified </a>it a bit to hook it up with my Azure Function backend.</p><p>Once cloned, your code structure in VS Code will look like this -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nJ1yHTtxtVi1dEJhRpt9WQ.png" /></figure><p>If you clone my <a href="https://github.com/subhankars/StaticWebApp">modified repository</a> then, just change the URL in theconfig.json file to point to the Azure Function endpoint. Copy the URL from Azure portal and replace the localhost URL as https://&lt;static site url&gt;<strong>/api</strong></p><p>Now npm install and dong serve to be sure that the UI code is running. You won&#39;t get blog post data yet. We have to build the Azure Function and deploy it for that.</p><h4>Adding Azure Function App</h4><p>For my blog post data, I’m going to create an Azure Function with HttpTrigger and use it as the backend data source. To create a brand-new azure function code, follow the below steps. (Ignore if you are happy with the cloned code)</p><ol><li>Open command pallet using the F1 key</li><li>Type and Chose <strong>Azure Function: Create New Project…</strong></li><li>Now browse the<strong> api </strong>folder</li><li>Select language C# (you can choose any other supported language)</li><li>Select runtime — .NET Core 3</li><li>Select HttpTrigger as the template</li><li>Give a Name and Namespace to your function and select Anonymous and hit enter</li></ol><p>This will create your Azure Function code. Your code structure will look like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9VgGXfdtS6jZxEJj0MJWA.png" /></figure><p>At this time your basic code setup is complete. Next, we have to prepare for Code Deployment using Azure DevOps.</p><h3>Continuous deployment with Azure DevOps</h3><p>A build pipeline is needed to deploy the code (Angular + Azure Function together) to the Azure Static Web App resource we have created earlier.</p><p>In Azure DevOps, there is no standard template yet for Static Web App deployment. For now, select the Starter pipeline</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fx9TKfsiun58J2iKhPbKow.png" /></figure><p>Copy the below code and paste it into your pipeline definition file. app_location is your Angular code path. api_location is your Azure Function code location. output_location is your Angular code build folder</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/01301d9e348b952ddac9e59e285f8d30/href">https://medium.com/media/01301d9e348b952ddac9e59e285f8d30/href</a></iframe><p>Now we have to connect this pipeline to the Azure Static Web App resource so that the code changes can be pushed. To do so — create a pipeline variable with <strong>Name </strong>deployment_token. Next copy the Deployment token from the Azure portal and paste it in the <strong>Value </strong>section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJLE-v2hgRQVTSISE6bBnQ.png" /></figure><p>This will complete your build pipeline setup. This pipeline will run automatically every time you push some changes to the repository.</p><p><em>I would love to have a mechanism to control this behavior, what if I do not want to deploy after every commit?</em></p><p>On a successful run, it will push your Angular Code and Azure Function code to the Static Web App resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZyrX4en4cmmz1TLF86aDw.png" /></figure><p><em>At the time of writing this article, I have encountered many confusing build error messages. I have opened a GitHub </em><a href="https://github.com/MicrosoftDocs/azure-docs/issues/75327"><em>issue </em></a><em>for the same.</em></p><h3>The Outcome</h3><p>On successful build of the code repository, it will now create an Azure Function and deploy your Angular code.</p><p>To check your Azure Function, navigate to the Functions from the left navigation blade. You will see your Azure Function here now.</p><p><em>It doesn’t appear instantly. I had to wait for 5–10 seconds for it to show up.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*V-OFc9iJZPAUTgDD37JYMg.png" /></figure><p><em>In the Free tier, it’s a managed Azure function which is why I think I don’t see any other option here on this page, unlike any other standard Azure Function App. This won’t even create any separate Azure Function resource under your resource group.</em></p><p><em>I couldn’t find any way to check my static files generated in Angular build on Azure Portal, unlike Azure Storage’s static website.</em></p><p>After the deployment completion, to test the web app just hit the application’s URL.</p><h3>Testing the app</h3><p>To see your Azure Function HttpTrigger is returning any data or not? just hit the application URL https//&lt;staticweballurl&gt;/api/StaticWebAppBackend</p><p>If it returns a json response then you are good to go</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJfqYp0sh9oc-3fMByLKVw.png" /></figure><p>To test the Angular website just type in or copy-paste the static website URL from Azure Portal. The website should look something like below -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*weyKaflhIb0zQg7p3iklcA.png" /></figure><p>It will start showing data coming from the Azure Function backend which we have used as the backend API.</p><p>This completes building and deploying Angular Static Web App with Azure Function backend in Azure Static Web App.</p><p>Until this, it’s all free. If you want to configure your own domain name with this website, then you can do so easily. Buy a domain name and follow this <a href="https://docs.microsoft.com/en-gb/azure/static-web-apps/custom-domain?tabs=azure-dns">article</a> to configure. This will give you a free SSL certified also as a bonus.</p><h3>Wrap up</h3><p>In my opinion, this is a great way of deploying a Static website with a Serverless backend in a very cost-effective manner. In fact, freely for many small use cases.</p><p>I understand this is a managed service from Microsoft, and promoting everything as code. However, I would love to see some more granular control for the developers. Such as exploring the static files, Azure function’s storage account, a configuration panel for the Azure Function, etc. in the Azure Portal. For some reason, it still feels like a black box to me ;). I am yet to test this with a production-grade application with advanced authentication scenarios in a Standard pricing tier. Also, would love to see how is everyone in the community is using this offering for their use cases.</p><p>I’m happy with the capability it’s bringing to the table. If you are looking to quickly hosting your modern static website with API backend freely, then look no further. Azure Static Web App Free tier is the answer for you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e212228c7358" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inner Source — the key to improving software asset reusability]]></title>
            <link>https://subhankars.medium.com/inner-source-the-key-to-improving-software-asset-reusability-78c86c1da0d0?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/78c86c1da0d0</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[innersource]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Thu, 15 Apr 2021 11:22:01 GMT</pubDate>
            <atom:updated>2021-04-15T18:05:02.648Z</atom:updated>
            <content:encoded><![CDATA[<h3>Inner Source — the key to improving software asset reusability</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CGh8r0uVtdDx_-MQ.jpg" /></figure><h4>Some background first</h4><p>Can you afford to re-invent the wheel? I’m sure most of you will say a big NO. Similarly, in software development, it’s not very common to build a piece of software from scratch unless you are building something which was not done by anyone before you in the world. Typically, a development team gets help from a platform like <a href="https://github.com/">GitHub</a>, or get help from other similar projects running within your organization. They copy the base code (let’s call it the initial codebase) from others and start developing on top of that. This is re-using the wheel.</p><p>This is one way of looking at re-usability, since they have re-used someone else’s code. When we talk about improving the re-usability of software assets (code, libraries, etc.) within your organization then it inherits a few inefficiencies. Especially when you do not have a mechanism of “Giving Back”.</p><p>For example, what if a project team who is using your initial codebase improves it over a period of time to make it more efficient? what if they find a few bugs in the initial code and fixes them? what if they address a few new security vulnerabilities? How do you now make sure that your initial codebase receives all these improvements? and this team can communicate back to the original creator of the base code? how do you make sure that if some new project team wants to re-use this asset, they get all the improvements as opposed to code their own improvements on top of the initial base code? how do you make sure you pass on these continuous improvements forward to your future software engineering teams?</p><p>Well, you need to build a culture within your software engineering practice to “Give Back”. It is giving back to the original codebase by continuously contributing the improvements. It is like helping the community (your entire software engineering practice) with their contributions.</p><p>Inner Source is a way of software development which allows you to create this “Giving Back” culture within your organization. A transformative cultural shift towards gaining efficiency and improve software asset reusability. Let’s see how –</p><h4>Understanding Opensource and Inner Source</h4><p>To understand Inner Source, you need to understand how <a href="https://en.wikipedia.org/wiki/Open_source">Opensource </a>software development works.</p><p>In the opensource, the entire community of students, hobbyists, professional programmers contribute from across the globe abiding by <a href="https://opensource.org/licenses">opensource licensing</a> norms. The entire community participates in contributing in coding, bug fixes, providing feedback to build great software like Android, Kubernetes, Visual Studio Code, etc.</p><p>In Inner Source, it’s not open for the entire world. It is open to all of your software engineering teams within your organization. Be it co-located teams or remote teams. It’s like running opensource development within your organization’s firewall. Where your entire software engineering team contributes, collaborates, and innovates together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wMAUcyzgY7tSGzlI.png" /></figure><p>In short — <em>Opensource is open to all, Inner source is open to all your employees within your organization.</em></p><p>Inner Source is not a new kid in the block, this terminology is there for almost a decade now. It was originally coined by <a href="https://en.wikipedia.org/wiki/Tim_O%27Reilly">Tim O’Reilly</a> in 2000.</p><p>As per Wikipedia — <em>Inner source is the use of open source software development best practices and the establishment of an open source-like culture within organizations for the development of its non-open-source and/or proprietary software</em></p><p>Now the question is — can you also embrace Inner Source development techniques for your engineering team? Let’s understand next a few of the challenges with typical software development methodology and see how Inner Source can help.</p><h4>What is not working so well?</h4><p>To start a new project, you need a base to start with. For example, an initial code structure that supports all of your organization’s best practices. You need to have some cross-cutting code — such as authentication, authorization, logging, code to remediate various security issues, etc.</p><p>In a typical software development practice either you start writing all the code from scratch, or there is a high chance that you take some sample code from a GitHub-like platform, or if you are lucky enough you copy it from other existing similar projects in your organization.</p><p>It gets worst for a newly joined team member or for a newly formed team. They do not know a lot of people to ask about reusable components; they don’t know whether there is any already existing code repository present or not? they can’t search your organization’s proprietary code repositories (because there is no such common platform open to all for searching). So, they end up writing their own code from scratch. Kind of re-inventing the wheel. Isn’t it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bcCJJx-ZxXKihRsG.png" /></figure><p>Let’s see how it affects in reusability and continuous improvement. In the above illustration, each box represents a project team. In this example, the Initial project Team may have some base code that can be re-used in Project 1. However, if the Project 1 team is aware this base code, then they may <em>copy </em>the entire repository over and start writing their code on top of that. Now if they find some bug on that, they fix it, if they want to add some new feature or enhancements then they commit those in their project-specific private repository. Now, if Project 2 team needs the same base code to start their project with, then they do not have a streamlined process to get all the enhancements/ updates developed by Project Team 1. It’s just because these teams are working in silos, they are not committing the potential re-usable code to any <em>shared repository</em>. <em>It remains closed within their project boundary</em>. This prevents the flow of continuous improvements over a period of time. And finally, each and every team ends up spending a lot of time doing the same thing again and again their own way.</p><p>This is how any organization loses the flow of knowledge from one project to another. Now you can imagine how much productivity you are losing just by repeating the same thing again and again in every project. You lose control over your organization’s coding standards, practices, security policies, etc. which are crucial for you to build re-usable software assets.</p><h4>How Inner Source can fix it?</h4><p>Now think a bit differently… you have a GitHub-like platform where your developers constantly commit all of their code improvements to a common repository and is searchable. Your code is always updated with the latest bug fixes, improvements. Now for a new project team, he doesn’t have to start all over again. They just take the reference to this updated repository and they are good to go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TrK7cXWH-yhUDXc8.png" /></figure><p>If you look at the above illustration, the Initial Project team has committed their code in a shared repository. Now Project Team 1 <em>forked </em>the initial Codebase and started adding their bug fixes (if any), new enhancements, and a new feature to it. Once they commit the enhancements to their project-specific <em>private repository</em>, they create a pull request to contribute their improvements to the main branch of the code. The main branch of the code repository will be maintained by a group/induvial team members called as <em>maintainer</em>. If the maintainer accepts the pull request, then all the enhancements added by Project Team 1 gets committed to the main branch. Now if tomorrow one other Project Team 2 wants to start a new project, they just fork from the main code branch and they get all the improvements/ updates added by Project Team 1 automatically. Similarly, if Project Team 2 wants to contribute their improvements to the main branch, then they do the same thing, a pull request. Once the maintainers approve the Pull request, the main branch gets updated with the latest improvements added by Project Team 2. This is how the <em>continuous improvements keep on flowing forward over time</em>.</p><p>This is how your organization’s intellectual property code gets matured over a period of time. The code repository in this case is open for all to look at, submit enhancement ideas, raise a bug, use the code in their project and enhance it and submit contributions through a pull request. This gives your developers an open playground to collaborate, communicate their innovative idea with other developers, architects in your organization. This helps you to develop, reuse and improve your next big product, service, or software asset together.</p><h4>Implementing Inner Source in your organization</h4><p>With all the benefits of Inner Source, it comes with its own challenges. Inner Source development is a fundamental shift from how we generally do software development within our organization to a more open, contribute heavy software development. It needs a cultural change within your software engineering discipline by being open to contribute (Giving Back).</p><p>Since it needs a cultural change, participation from all the level such as the leadership team, project management, development team is required.</p><p>Here are a few common challenges of Inner Source</p><ol><li>You may not be able to justify the funding from your client to improve your internal intellectual property</li><li>For any small organization having a dedicated team of the maintainer is not a cost-effective option</li><li>Getting maintainer’s constant attention to maintain the repository all the time at times becomes challenging because they may be on some other client billable project</li><li>Similarly, oftentimes the contributors may also think <em>what is in there for me</em>?</li></ol><p>To address the above challenges, the leadership team and project management teams</p><ol><li>Should not look at it as a short-term investment</li><li>Promote the culture of openness</li><li>Reward maintainers and contributors periodically based on various matrices</li><li>Use simple matrices like the number of successful pull requests, build quality improvements, number of bugs fixes, number of downloads of a library, the highest number of contributions to recognize maintainers and contributors</li></ol><p>This needs change in the way a developer thinks as well</p><ol><li>Developers should be looking at the bigger picture</li><li>Develop modular code with reusability in mind</li><li>They should be passionate about giving back</li><li>This is the greatest way to pass on their knowledge and learnings forward</li><li>Learning from someone else’s mistake or the success is the key to self-improvement</li></ol><p>As the organization matures over time, they build many such reusable components, patterns, practices for the future development team. Moreover, it allows you to promote an open development culture where everyone’s ideas, suggestions are welcome to build a huge software asset library.</p><p>If you have come so far in this article then you must be wondering are there any patterns and practices for implementing Inner Source in your organization? well, the answer is Yes. <a href="https://innersourcecommons.org/">InnerSource common</a> is a community that is dedicated to create and spread knowledge about Inner Source. Their beautifully crafted Inner Source patterns are <a href="https://github.com/InnerSourceCommons/InnerSourcePatterns"><strong>documented here</strong></a>. This will give a you very good stat to embark on the Inner Source journey.</p><h4>Wrap up</h4><p>This article is more on software asset reusability, but Inner Source is not limited to reusability only. Inner Source helps you to improve efficiency, productivity, it improves the quality of your software assets over time, it creates an open culture of innovation. Many big companies such as IBM, PayPal, Microsoft are benefiting from Inner Source for many years. It has the potential to transform your entire software engineering practice if it is you are committed to change the development culture.</p><p>In today’s context when industry is moving towards the <a href="https://hackernoon.com/everything-as-code-explained-0ibg32a3">Everything as Code</a> approach, if you combine it with <a href="https://en.wikipedia.org/wiki/DevOps">DevOps </a>then you can take Inner Source to the next level. Especially if you are building a new software engineering team then in my opinion you must adopt Inner Source. In a long run, it will help you to come up with your own GitHub-like platform with all reusable proprietary software assets for your employees to use, contribute, collaborate and innovate together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78c86c1da0d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bringing the Power of Cloud to Your Development Environment With GitHub Codespaces for Visual…]]></title>
            <link>https://medium.com/swlh/bringing-the-power-of-cloud-to-your-development-environment-with-github-codespaces-for-visual-d70f7c5a3f60?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/d70f7c5a3f60</guid>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[visual-studio-codespaces]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Mon, 26 Oct 2020 15:24:49 GMT</pubDate>
            <atom:updated>2020-11-02T14:30:15.959Z</atom:updated>
            <content:encoded><![CDATA[<h3>Bringing the Power of Cloud to Your Development Environment With GitHub Codespaces for Visual Studio</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X7GWMLirea1ERAMx.jpg" /></figure><h3>Some background info first</h3><p>So, you are a developer, you develop your magical apps using Visual Studio and often time get frustrated with the sluggish development environment? which in turn kills your productivity? And guess what, to solve this, you plan to upgrade the hardware of your computer (is it practical?)? what if I tell you without upgrading your development environment’s hardware, you can achieve super-productivity even using your aging computer?</p><p>Sounds exciting? isn’t it? Well, this is possible with Visual Studio Codespaces.</p><p>Visual Studio Codespaces is a cloud-powered development environment. With Codespace you use your Visual Studio Integrated Development Environment (IDE) to connect to your code running in some remote cloud-hosted container. Nothing runs on your local computer other than the (Thin) Visual Studio IDE. We will see it in a bit how thin is this ‘thin’.</p><p>For analogy think of SQL Server Management Studio or Toad connected to some remote SQL Server or an Oracle database. You write and execute all the T-SQL/PL-SQL scripts in the local IDE but they actually run on the server without eating up any computing resource from your local dev environment. It is just like a thin client to connect to the powerhouse in the back.</p><p>Codespaces comes with multiple flavours to cater to different use cases. Let’s look at them now.</p><h3>Flavours of Codespaces</h3><ol><li><strong>Visual Studio Codespaces in the Browser</strong> — This the browser-based IDE. Yes, you heard it right. You can run and debug your app in your browser without having to install Visual Studio. This allows you to debug, accept pull requests while flying on an airplane from your mobile device. Codespaces in browser is available in <a href="https://github.com/features/codespaces">GitHub </a>and <a href="https://subhankars.medium.com/lets-debug-some-c-code-in-a-web-browser-with-visual-studio-online-e034415e730c">Visual Studio Online</a>.</li><li><strong>Visual Studio Codespaces in VS Code</strong> — Code spaces created in your Azure Subscription and can be connected with a VS Code extension. <a href="https://docs.microsoft.com/en-us/visualstudio/codespaces/how-to/vscode">Know how</a>.</li><li><strong>Self-hosted Codespaces</strong> — you host your own Codespace server on your own environment using Visual Studio Code.</li><li><strong>Visual Studio Codespaces in Visual Studio 2019</strong> a.k.a GitHub Codespaces for Visual Studio — In my opinion this for the serious workloads. You use your Visual Studio 2019 IDE just as a thin client to connect to the Codespaces hosted in the Cloud.</li></ol><p>In this article, I’m going to cover <strong>#4</strong>, Visual Studio Codespaces for Visual Studio 2019. In next few sections, we will see what Codespaces has to offer to achieve your super-productivity.</p><h3>Let’s get slim first</h3><p>As we are bringing the power of the Cloud onto our development environment, I thought I should reduce some weight from my Visual Studio installation and make it slimmer. Remember, I want to offload everything to the Cloud. So, I went ahead and uninstalled all the workloads from Visual Studio except Codespaces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NqCv9Qu5VABmZnVi.png" /></figure><p>To make your Visual Studio slim, just open Visual Studio Installer &gt;&gt; Choose your Visual Studio Installation (I’m using Visual Studio 2019 Community Preview, Build 16.8.0 <a href="https://visualstudio.microsoft.com/vs/preview/">Preview </a>5) &gt;&gt; Click on Modify &gt;&gt; go to Individual components tab &gt;&gt; search for Codespace. Check that and uncheck everything out &gt;&gt; finally hit the Modify button. Now, this will uninstall every workload from your Visual Studio and cut down the disk usage drastically.</p><p>With my typical developer setting with ASP.NET, Azure Development, and .NET Cross-platform workloads, my installation size was 5.51GB. Now uninstalling everything it got reduced down to 1.59GB only. Yes, I was talking about this ‘thin’ only.</p><h3>How about offloading the brain and memory too? ​</h3><p>Now that my Visual Studio is much slimmer, let’s see if I could get rid of my local machine’s processing and memory power as well.</p><p>To test this out I took <a href="https://github.com/dotnet-architecture/eShopOnWeb">eShopOnTheWeb</a> ASP.NET reference application. I ran it side by side. One in my local Visual Studio on my laptop and another one in the Codespaces. And the result is really amazing as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/0*RcE6lW-R1bZcdQvh.png" /></figure><p>For reference, my local Visual Studio is running on my Laptop configured with 8GB RAM and 4Core CPU, same as my configured Codespaces. While debugging this application side-by-side I observed in my local laptop memory was spiking up to ~700 MB and CPU is up to ~10% whereas running the same on Codespaces Memory and CPU spike remained almost flat all the time at ~160 MB and ~3% respectively.<br>Now, Imagine the possibility here. It’s literally not eating up any computing resource from your Computer as compared to your local Visual Studio.</p><p>Now the question is, do you really need to upgrade your hardware to run your monster apps on Visual Studio? I guess the time has come to safely say No.</p><p>Now, let’s run through some practical scenarios that any developer would run and see where it stands.</p><h3>Let’s play (like a Developer)</h3><p>After making the Visual Studio slim and trim I wanted to take it to the playground and see how it functions with some commonly used development scenarios.</p><h4><strong>Load time vs Connect time</strong></h4><p>For this testing, I ran eShopOnTheWeb solution side-by-side with a Visual Studio running in local and loading the same by<a href="https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/using-codespaces-in-visual-studio#creating-a-codespace-in-visual-studio"> connecting it to codespaces</a>.</p><p>I ran this test on 110 Mbps internet connection, and here are my findings –</p><ul><li>Creating a new Codespaces — start to end — 1.31 mins</li><li>Resume a suspended Codespaces — ~4 mins (I was expecting it to load faster than above)</li><li>Re-opening an already running Codespaces — 1.08 mins</li><li>Opening the same solution in local Visual Studio — 45 sec</li></ul><p>This is understandable why Codespaces is taking more time to ‘connect and load a solution’ vs just loading the solution. However, a bit quicker load time would have been better.</p><p>Now that the solution is loaded inside the IDE, let’s do some general debugging and see how it does.</p><h4><strong>Everyone’s favourite — Hit F5</strong></h4><p>At this moment, my Codespace is connected. The eShopOnTheWeb solution is loaded inside the IDE. Next, I went ahead and hit F5 to run the solution. It opened up localhost in my browser with the port number configured in launchSettings.json file for IIS Express profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2zR1DgZzZ6aCF6Qr.png" /></figure><p>And, this localhost web is not running on your local IIS Express. The IIS Express is running inside the Codespaces. Here comes Some more local resource-saving. Neat, isn’t it?</p><p>I was able to open this localhost URL in other browsers without any fuss.</p><p>From here onwards my debugging experience was seamless, and I didn’t face any sluggishness except once my IntelliSense responded slowly (could be because of the slow network?).</p><p>Many debugging features are not supported at this moment in Codespaces. You can find the full list of supported features <a href="https://docs.microsoft.com/en-gb/visualstudio/ide/codespaces/supported-features-codespaces?view=vs-2019#debugging">here</a></p><p>Next, to take the debugging experience further, I’m going to go ahead run a few API development scenarios.</p><h4><strong>Now some API debugging</strong></h4><p>This eShopOnTheWeb solution had a Web API project — PublicApi. I made it a startup project and ran it. To test and debug its endpoints, I tried two different approaches<br>1. Calling the API endpoints from Postman</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eH29raG670PiG36P.png" /></figure><p>2. Calling the API endpoints from a console application running in my local Visual Studio</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*McaOwT2RKFoVzhfb.png" /></figure><p>In both cases, it was able to hit the breakpoint on the Codespaces and the debugging experience was smooth.<br>To make it spicier, how about we try to debug a <strong>Web API to Web API</strong> call, or a <strong>Web App (SPA?) to a Web API</strong> call who are <strong>running separately on their own Codespaces</strong>. Let’s dive in.</p><h4><strong>Cross Codespaces debugging</strong></h4><p>If you have multiple web APIs in your project, then debugging an <strong>API to API call</strong> is a common scenario. The way most of the developers achieve this is — they run new instances of Visual Studio per web API. All the services then run on local IIS in different ports attached to the Visual Studio instances. This allows API to API debugging possible. Now, running more Visual Studio instances means more resource utilization, and sluggish performance.</p><p>Can this problem be solved using Codespaces? To test and find the answer, I’ve created one Codespace (C1) for a small Web API app to mimic the caller API and another Codespace (C2) is running eShopOnTheWeb API. Next, I tried to make a REST call from C1 to C2. Unfortunately, it couldn’t connect and gave an exception No connection could be made because the target machine actively refused it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C4DEZ2APMUDUcV0C.png" /></figure><p>One of the other most commonly used debugging scenarios is connecting a Website such as <strong>Single Page Application (SPA) to a Web API </strong>to debug end to end flow. Both apps run on their own Visual Studio instances. To test this scenario, I have created another Codespace with a Single Page Angular Web application (using default Visual Studio Angular template) and tried to call the eShopOnTheWeb WEB API from the SPA TypeScript code. Here also the SPA Codespaces couldn’t connect to the API Codespaces URL because of a similar reason as above.</p><p>It’s obvious why Cross Codespace connection is not establishing. Because it is trying to connect over the internet to a localhost URL which is not publically accessible and exposing a public URL could be a security risk.</p><p>To tackle the above scenarios, it would be great if Codespaces exposes a <strong>short-lived randomly generated public URL </strong>(like Codespaces in the Browser) or provides some sorts of <strong>bridge between Codespaces</strong>, something like Bridge to Kubernetes.</p><h4>Feature based development with Git</h4><p>So far we have experienced some very common developer debugging use cases. What about version control and Feature-based development using Git?<br>With the new <a href="https://devblogs.microsoft.com/visualstudio/exciting-new-updates-to-the-git-experience-in-visual-studio/">Git experience</a> for Visual Studio and with the integrated <a href="https://devblogs.microsoft.com/visualstudio/say-hello-to-the-new-visual-studio-terminal/">terminal</a> it is seamless to create branches and run all common git commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mupZhBRItZhPuezt.png" /></figure><p>In git world, everything gets committed in local first. Now, this ‘local’ term can create a bit of confusion here in the case of Codespaces. What is ‘local’ here? your local computer or something else? Well, any branch you create with Visual Studio Codespaces gets created on its own storage and filesystems, not on your local computer. These are remote from you but not remote branches</p><p>Once the branches are created, the experience of merging one to another or creating a new pull request is no different than any other Visual Studio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VTOCfRLwUcrS48We.png" /></figure><h3>My concluding thoughts</h3><p>While writing this article, GitHub Codespaces is in limited public beta. I got my early access a few days ago. The above experiments and experiences are based on my 2–3 days of usage. There is a lot more testing I have to perform in some more real-world situations. Such as maintaining and connecting these Codedpaces with more or more Azure subscriptions, SSO, and integration with corporate Azure Active directory, working with Azure DevOps etc. However, what I just experienced in the last few days is promising.</p><p>I always advocate for the developer’s productivity. Having a smooth, sleek, and high-performance Developpement environment is always a developer’s fancy. I think, bringing the power of Cloud to the Development Environment with Visual Studio Codespaces will give a developer super-productivity.</p><p>It is just the beginning of the Cloud-Powered Development Environment for mainstream Development. I’m hoping to see more and more IDE to become Cloud-Powered in the future. This is going to change the way we code, collaborate, and onboard a new developer in the future.</p><p>At the end of the day <em>“Developers, you deserve the best.!!!”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d70f7c5a3f60" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/bringing-the-power-of-cloud-to-your-development-environment-with-github-codespaces-for-visual-d70f7c5a3f60">Bringing the Power of Cloud to Your Development Environment With GitHub Codespaces for Visual…</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Document Versioning with Azure Blob Storage]]></title>
            <link>https://subhankars.medium.com/document-versioning-with-azure-blob-storage-ac16b420d297?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac16b420d297</guid>
            <category><![CDATA[blob-storage]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Sat, 26 Sep 2020 16:15:29 GMT</pubDate>
            <atom:updated>2020-10-22T09:26:46.305Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E2aqZM3eHR4NwMr6.jpg" /></figure><p>Almost all organizations have a need for document storage for their applications. If the organization is a Microsoft shop then, one of the most popular choices for them is SharePoint Document Library. SharePoint Document library allows you to store documents, retain their versions, provides the ability to make any old version to the current version, last but not the least deleting a specific version of a document.</p><p>With all the goodness of SharePoint, it comes with its own limitations. For many custom cloud applications build, SharePoint may not always be the right choice because of various reasons. It needs a dedicated setup, licensing etc. And just to use the document library feature, the investment may not always be justifiable.</p><p>So, what option do you have? can you achieve all the above SharePoint Document Library features otherwise?</p><p>If you are building your application in Azure, then it is highly likely that you are taking the benefit of Azure Storage Account <a href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction#blobs">Blob Container </a>for any storage needs, including but not limited to document/ file storage.</p><p>The good news is you can now achieve all of these using Azure Storage Account’s blob versioning feature.</p><p>In this article, I’m going to talk about how you can leverage your existing Azure Storage Account Infrastructure and use it effectively for your document and file storage needs.</p><p>I’m going to cover the following with a few C# code samples.</p><ul><li>Document Versioning</li><li>List all document with all their versions</li><li>Download a specific version of the document</li><li>Make a specific version of the document to the current version</li><li>Delete a specific version of the document</li></ul><p>You can find the entire project in <a href="https://github.com/subhankars/AzureBlobStorageDocumentLibrary">GitHub</a>.</p><h3>How can you achieve versioning in blob storage?</h3><p>Until this <a href="https://azure.microsoft.com/en-in/updates/azure-blob-versioning-public-preview-now-available/">announcement</a> of Blob Versioning for Azure Storage Account, it was tedious to maintain the versions of any document stored as a blob in a container. One of such manual approach was to take a snapshot of the document while uploading. Maintain that snapshot information in some sort of table (e.g.: database tables). And to restore the file, use the table stored information to restore from the snapshot.</p><p>You can read more about Snapshot and Blob versioning <a href="https://docs.microsoft.com/en-us/azure/storage/blobs/versioning-overview#:~:text=Blob%20snapshots%20and%20blob%20versions,enabled%20for%20your%20storage%20account.">here</a>.</p><p>Okay, so those days are gone now. With some simple steps, you can enable versioning to your blob and achieve document library like features.</p><p>You can enable Versioning while creating the storage account. Under <strong>Data protection</strong> tab check <strong>Tracking </strong>&gt;&gt; <strong>Turn on versioning</strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/0*Zux9zKZz3t3t4Vl6.png" /></figure><p>For your existing Storage Account, to enable versioning go to the left side blade &gt;&gt; look for <strong>Data Protection</strong> under <strong>Blob service</strong>. On your left pane under <strong>Tracking</strong> select <strong>Turn on versioning</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*40KKXkGWx5G6ae3W.png" /></figure><p>Now that the blob versioning is enabled, let&#39;s see it in action.</p><h3>Now, upload a file and see blob versioning in action</h3><p>To test it out, upload a file with the same name with varying content to the container multiple times. Now find the file in the container which you have just uploaded. You can use the Azure portal to upload the file or use the following code</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/10abb7fd9ca21a788a0d81e18c2a3a6e/href">https://medium.com/media/10abb7fd9ca21a788a0d81e18c2a3a6e/href</a></iframe><p>Click on the <strong>View previous versions</strong> option. You will see all the versions of the file listed with timestamp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*owSoMwEgOpoa1XO8.png" /></figure><p>Now let’s write some code to list all the versions of the uploaded files in the container.</p><h3>Listing all the versions of an uploaded file</h3><p>Blob versioning features can be programmatically accessed using the Azure Storage client library for .NET, version <a href="https://www.nuget.org/packages/Azure.Storage.Blobs/12.5.1">12.5.1</a>, or later. However, I couldn’t find a way to list down the versions of all the files in the container using this nuget.</p><p>So, I did a little hack. From the Azure Portal — I clicked on the <strong>View Previous Versions</strong> and I intercepted the REST API url from the Network tab of developer tools.</p><p>Version <strong>2019–10–10</strong> and higher of the Azure Storage REST API supports blob versioning. Using the below code, I was able to call REST API url https://{accountname}.blob.core.windows.net/{containername}?restype=container&amp;comp=list&amp;include=versionsand retrieve all the versions of all the files in the container.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc9613022b0acee21e167c820dbfe615/href">https://medium.com/media/bc9613022b0acee21e167c820dbfe615/href</a></iframe><h3>Downloading a specific version</h3><p>To download a specific version of a file use WithVersion. This line var blob = blobClient.WithVersion(fileVersion); in the code below is doing all the magic.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c32b4bc334f63b24951397d82b74d8e/href">https://medium.com/media/4c32b4bc334f63b24951397d82b74d8e/href</a></iframe><h3>Restoring a file to a specific version</h3><p>One of the most important functionalities if any document library is to restore any file version and make it as the current version. To restore to a specific version, you must use the copy blob function. I found StartCopyFromUri very helpful since I could pass the VersionId of the file with the blob url query parameter as <a href="https://{0}.blob.core.windows.net/%7B1%7D/%7B2%7D?versionid={3}">https://{0}.blob.core.windows.net/{1}/{2}?versionid={3</a>}</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1992750876961897e5255dd1fecc23c2/href">https://medium.com/media/1992750876961897e5255dd1fecc23c2/href</a></iframe><h3>Deleting a specific version</h3><p>Last but not the least, you can delete a specific version of a file from the storage container. Again .WithVersion will help you here to delete a specific version as below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c89e446d1205328f1d914a94082ded41/href">https://medium.com/media/c89e446d1205328f1d914a94082ded41/href</a></iframe><h3>Wrap up</h3><p>In this post, I have covered a few key features of a Document library which you can achieve with Azure Blob Versioning and a few lines of code. This solution is not meant to replace SharePoint or any other document management solutions. I felt this would become very handy to retain document versions, restore a document, delete a specific version of a custom build application that uses Azure Storage Account as storage infrastructure.</p><p><em>Originally published at </em><a href="https://subhankarsarkar.com/document-versioning-with-azure-blob-storage/"><em>https://subhankarsarkar.com</em></a><em> on September 26, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac16b420d297" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lets debug some C# code in a web browser with Visual Studio Online]]></title>
            <link>https://subhankars.medium.com/lets-debug-some-c-code-in-a-web-browser-with-visual-studio-online-e034415e730c?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/e034415e730c</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[visual-studio-codespaces]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[visual-studio]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Mon, 04 Nov 2019 21:44:24 GMT</pubDate>
            <atom:updated>2020-10-22T09:23:19.317Z</atom:updated>
            <content:encoded><![CDATA[<h3>Let&#39;s debug some C# code in a web browser with Visual Studio Online</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyibmyWAHQ2k4HG-KfU1fg.jpeg" /></figure><p>This is Microsoft Ignite 2019 season and during this time around the year we get some nerdiest products out of Microsoft.</p><p>This time around one of my most dreamt products is out for public preview. This is Visual Studio IDE in the browser — <a href="https://visualstudio.microsoft.com/services/visual-studio-online/">Visual Studio Online</a>. Yes, it’s a working Visual Studio Code IDE in your browser to run and debug your code from anywhere.</p><h4>Getting started</h4><p>Disclaimer: You do not need to install .NET Core or Visual Studio Code in your local system to use Visual Studio Online. Needless to say, you just need a Modern browser. I used Chrome for this demo.</p><p>First, navigate to <a href="https://online.visualstudio.com/login">https://online.visualstudio.com</a> and login using your Microsoft account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HE5WbvVTbmwzrKAHIy8qgg.png" /></figure><h4>You need a cloud development environment — configure it first</h4><p>Once you are logged in, you won’t see any environment by default. This needs an Active Azure Subscription as a pre-requisite. For pricing check <a href="https://azure.microsoft.com/en-gb/pricing/details/visual-studio-online/">this</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*X-XwomYG_o16MZ7rdPczJQ.png" /></figure><p>To start configuring, hit Create Environment Button. This will open up a new pane for you to choose your environment specification. This includes your Git repo path, type of instance you are creating and some other optional settings.</p><p>In this example I have used my own GitHub git <a href="https://github.com/subhankars/LinuxDotNet">repo</a> of a .NET Core MVC application written in C#. Since my app is a simple one, I chose Standard (Linux) instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*MhX9j2vGotvg77BR5cPQPA.png" /></figure><h4>Now create the environment</h4><p>Now that the basic configuration is done, hit the Create button. You will see your environment is getting created. Observe for the green Available button to appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*R-wGDyyo_ZugXKcr9uKeDg.png" /></figure><p>Once you see the green Available button, your job is done. Now without further ado just hit name of the environment or the Available button to see the magic</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*kOiEcAmSeDe5bSUA6--Kpg.png" /></figure><h4>And… Launch</h4><p>At this stage you may not be able to believe in your eyes. The whole git repo is now loaded in Visual Studio Code inside a browser. I re-confirm it’s not your regular Visual Studio Code native client. It just opened your code in an IDE without installing anything on your system — Yes!!! it&#39;s a working instance of Visual Studio Code in your browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*eCZ0lwLA1ySRKwnlUjL4lA.png" /></figure><h4>Running the web app from the browser IDE</h4><p>Now that your code is loaded in Visual Studio Online, let&#39;s see if it runs from there.</p><p>Open the terminal and use your favourite <strong>dotnet run</strong> command</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lC24kkHAarRDbkvoUOli1g.png" /></figure><p>If your code has no build error, you will see your web app will start running on https://localhost:&lt;port&gt;. But wait, remember that this localhost is not your device’s localhost.</p><p>Ctrl+ Click on the localhost link. It will generate its own url and will connect itself to the forwarded port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lj6b0CNR4tAZCJ5wmYOPkg.png" /></figure><p>Eventually it will redirect itself to your websites landing page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkAfVM9p9cAXTAaeJHejPg.png" /></figure><p>You know what? what you just did? you just ran your first .NET Core Application from a Cloud IDE</p><h4>Can we debug it in browser?</h4><p>Of-course, why not? That’s the whole point of Cloud Native Development experience.</p><p>Now to debug your C# code in Visual Studio Online you must install C# omnisharp extension.</p><p>Reload the browser tab once the extension is installed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*RlkF-PQFwNSQiHrA3CwJ8Q.png" /></figure><h4>One last step to get to debugging</h4><p>Click on the Bug icon in the left nav bar. Add a new debug configuration for .NET Core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ytmH0oaFuF3lEATNEfWrQ.png" /></figure><h4>Okay let&#39;s debug now</h4><p>Add few breakpoints and click on debug button to Start Debugging.</p><p>Viola… you hit your first breakpoint on Visual Studio Online while debugging a C# Web App code without installing anything in your local system. You have now almost native debugging experience in a browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwLVeiqIMR1OB33HDat9FA.png" /></figure><p><em>Note: At the time of writing this post step-over, step-into keyboard shortcuts weren’t working, I had to use the control panel to navigate the code through.</em></p><h4>Conclusion</h4><p>Debugging C# code in browser is one of my long-dreamt features. The moment it is made available for public preview I couldn’t resist myself to get a hands-on experience on it. This post is just to talk about how to do basic setup of Visual Studio Online and debug C# code in browser.</p><p>There are lot more to explore and I’m sure with the community feedback and support one day we can use it as a true mobile IDE from any mobile device browser.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e034415e730c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[.NET Core WebJob Console app CI/CD using Azure DevOps Pipelines]]></title>
            <link>https://subhankars.medium.com/net-core-webjob-console-app-ci-cd-using-azure-devops-pipelines-cf574420b0e?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf574420b0e</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Sat, 20 Jul 2019 13:19:06 GMT</pubDate>
            <atom:updated>2019-07-20T17:14:55.570Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C1_qsqLGaUGksKunddtIEA.jpeg" /></figure><p>WebJobs is a feature of Azure App Service that enables you to run a program or script in the same context as a web app, API app, or mobile app as per <a href="https://docs.microsoft.com/en-us/azure/app-service/webjobs-create">Microsoft Document</a>.</p><p>If you build your WebJob Console app in .NET Framework then its very easy to build and deploy the WebJob with the parent API or Web App as by linking it to Web/Api App as below -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/0*pHYRM0rV96PTXGo0.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/0*S-qT0FCo4qJqfM7I.png" /></figure><p>The above linkage of WebJob console application with parent Web/API app is <strong>not supported</strong> by design in .NET Core. So what do we do ?</p><p>In this Article we are going to see how we can build a .NET Core WebJob Console app separately from the parent Web/API app, and deploy under the existing parent Web/Api App using Azure DevOps Build and Release pipeline.</p><h3>Build Pipeline — build the .NET Core Console app</h3><p>To build a .NET Core console app we are need to perform 4 basic build tasks in Azure DevOps build pipeline.</p><p>Azure Web Job supports the following file types only:</p><p>Since we are in .NET core, we are expecting a .EXE file as output for our console app. If you build your .NET core app just by running dotnet build it will generate a .DLL filebut not a .EXE file. To generate a .EXE file as build output use the following arguments in the publish step --configuration $(BuildConfiguration) --self-contained -r win10-x64 --output $(build.artifactstagingdirectory)</p><p>The argument --self-contained -r win10-x64 will make the difference here, this will generate .EXE file out of the build.</p><p>Next — Enable Zip Published Projects option. This will Create a ZIP file out of you build output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*scrNNyDCXBfuuMbo.png" /></figure><p>Once Publish to ZIP folder is completed in Step#3 we need to drop this ZIP file to a Drop Location. Use $(Build.ArtifactStagingDirectory) as path to publish. Use any artifact name of your choice. In this example the artifact name is webjobs_drop</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zB35SxYdJxrI_NSj.png" /></figure><h3>Release Pipeline — deploy the build artifact to Azure App Service</h3><p>Upon running the above Build Pipeline you will get your build output in webjobs_drop/.zip location.</p><p>To deploy this to any existing Web/API App’s WebJob running in Azure App Service we have to run a Azure PowerShell script task to achieve this.</p><p>We are going to use KUDU Zip Deploy API to deploy the build output to the app service. This will unpack the Zipped build output to wwwroot\App_Data\Jobs\\ folder</p><p>To Setup the release pipeline we need to create a Empty Pipeline with the following pipeline variables</p><ul><li>resourceGroupName - Resource Group name of your application</li><li>scheduleName - Contentious/ Triggered. In this example it&#39;s Continuous</li><li>scmApiUrl - SCM Api Url. Example: <a href="https://.scm.azurewebsites.net/api">https://.scm.azurewebsites.net/<strong>api</strong></a></li><li>webJobName - your webjob name. Your code will be deployed under wwwroot\App_Data\Jobs\scheduleName\webJobName folder</li><li>zippedArtifactPath - zipped artifact path of your build output file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MqmRoWwt09Ygh5Te.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FQ3Xrddlbcpef92k.png" /></figure><p>Once the variables are setup, we need to do the following</p><ul><li>Add a Azure PowerShell script task</li><li>Select the Azure Connection type</li><li>Select the Azure Subscription where your WebApp is located</li><li>Select Script Type as Inline Script</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JSq3tC-yiSCCQM14.png" /></figure><p>In the Inline Script editor add the below PowerShell script</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df7f28cf09c2164768df78a2820f32ec/href">https://medium.com/media/df7f28cf09c2164768df78a2820f32ec/href</a></iframe><p>This PowerShell script will Get the Publishing Profile details of your WebApp and use this information to login to KUDU ZipDeploy API to upload your Zipped build output to the desired location.</p><p>The deployment location is defined as</p><p>SCM Api url https://&lt;webappname&gt;.scm.azurewebsites.net/api/zip plus virtual directory path <br>site/wwwroot/App_Data/jobs/&lt;continuous/triggered&gt;/</p><h3>Accessing environment specific configuration</h3><p>Above Build and Release pipeline will build and generate .EXE file for your .NET Core Console application and deploy the build output to the Azure App Service Virtual directory. There may be scenarios where your WebJob may need to read some Environment (DEV, QA, UAT. PROD) specific configurations. In such cases you have to add environment specific appsettings.json files as appsettings.json</p><p>To read values from Environment specific json files, we can rely on ASPNETCORE_ENVIRONMENT variable. This variable can be set manually from the Azure Portal or while deploying the Parent WebApp/API app using Azure release pipeline in the app settings section.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67aa3e63faae174e0e344259d73acbde/href">https://medium.com/media/67aa3e63faae174e0e344259d73acbde/href</a></iframe><p>Add the above code in your Program.cs file to read the environment specific values from appsettings.json files.</p><h3>Wrap up</h3><p>To summarize the .NET Core WebJob Console App CI/CD we have performed the following -</p><ul><li>dotnet publish with --self-contained -r win10-x64 argument. Which generates the WebJob supported EXE file.</li><li>Zipped the build artifact directory.</li><li>Used KUDU ZipDeploy API to publish the WebJob console application to the Existing Web/API App Virtual directory using Azure PowerShell Script task.</li></ul><p>I hope this article will help you to navigate through your .NET Core WebJob dev/deploy journey with Azure DevOps Build Release pipeline.</p><p><em>Originally published at </em><a href="https://subhankarsarkar.com/dotnet-core-webjob-console-app-ci-cd-using-azure-devops-pipelines/"><em>https://subhankarsarkar.com</em></a><em> on July 20, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf574420b0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WSL2 for Dockerized .NET Core application]]></title>
            <link>https://subhankars.medium.com/wsl2-for-dockerized-net-core-application-43b85246268?source=rss-e5547d32aa72------2</link>
            <guid isPermaLink="false">https://medium.com/p/43b85246268</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Subhankar Sarkar]]></dc:creator>
            <pubDate>Sun, 16 Jun 2019 18:47:24 GMT</pubDate>
            <atom:updated>2019-09-12T08:55:22.879Z</atom:updated>
            <content:encoded><![CDATA[<h3>Windows Subsystem for Linux 2 (WSL2) for Dockerized .NET Core application development</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wVTEAYydp5smSuUsCkLg7Q.jpeg" /></figure><p>When Windows Subsystem for Linux (<a href="https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux">WSL</a>) was launched for the first time, I tried to use it as a Linux development platform and ran my <a href="https://subhankarsarkar.com/windows-subsystem-linux-build-asp-net-core-mvc-web-app/">first</a> Cross Platform .NET Core Web Application and I found it amazing.</p><p>With the popularity of Microservices, containerised applications with Docker is one of the hottest topic in the market now a days. While learning this piece of tech I thought of using my WSL as my Docker development platform natively on experimental basis.</p><p>While doing many failed attempts to install and trying to configure Docker in WSL1, Microsoft announced the release of <a href="https://devblogs.microsoft.com/commandline/announcing-wsl-2/">WSL2</a> on their 2019 Build conference.</p><p>Also, it was announced that a full-blown Linux Kernel is shipping with Windows 10. Naturally my expectation for WSL2 raised higher and higher with it, and my wish of using WSL for Dockerized application development finally has become a reality.</p><p>In this article I am going to talk about how you can get started with WSL2, installing Docker in WSL2 natively and finally running a .NET Core web app from a Docker Container.</p><h3>First Thing First. Make your PC ready for WSL2</h3><p><strong>Get the Right Windows 10 Build:</strong></p><p>WSL2 is only available for <em>Windows 10 version 1903, Release 18917 or higher</em>. If you are Windows Insider then you have to download this release as a very first pre-requisite.</p><p><strong>Enable Hyper-V:</strong></p><p>Follow this <a href="https://www.nextofwindows.com/how-to-enable-configure-and-use-hyper-v-on-windows-10">link</a> if you haven’t enabled Hyper-V in your windows 10.</p><p><strong>Install WSL2:</strong></p><p>Now that the basic time consuming part is done, time to setup WSL2. Fire up your PowerShell terminal in Administrative mode and run the below commands. This will enable virtualisation feature which will be used by WSL2</p><p><strong>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux</strong></p><p>Next you have to find out your Installed Linux Distribution, so that you can set that distribution to work as WSL version 2.</p><p><strong>wsl -l -v</strong></p><p>If you do not have WSL installed already then check <a href="https://subhankarsarkar.com/run-native-linux-on-windows/">this </a>out and install your WSL.</p><p>Now with patience run the below command. This will convert your current Linux Distribution to WSL version 2. This step took 25 minutes for me to complete</p><p><strong>wsl --set-version Ubuntu 2</strong></p><p>Final step, If you want to use your WSL2 as default version then execute below command</p><p><strong>wsl --set-default-version 2</strong></p><p>This completes your WSL2 installation in your Windows 10 PC. For detailed installation guide check <a href="https://www.thomasmaurer.ch/2019/06/install-wsl-2-on-windows-10/">this</a> out. Next is to try installing Docker on WSL for which I banged my head like anything in WSL1 world.</p><h3>Install and run Docker on WSL2</h3><p>Open your WSL2 terminal and check whether Docker is present in your system or not by executing –</p><p><strong>docker --version</strong></p><p>If you receive -bash: /usr/bin/docker: No such file or directory then you know that Docker is no present in your system and you are good to go to install Docker in WSL2.</p><p><strong>Step 1: Update your Linux software repository</strong></p><p><strong>sudo apt-get update</strong></p><p><strong>Step 2: Download Docker Dependencies</strong></p><p><strong>sudo apt-get install apt-transport-https ca-certificates curl software-properties-common</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j5UFlBZCJSU5nEsK.png" /></figure><p><strong>Step 3: Add Docker PGP key</strong></p><p><strong>curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nXVKan7AQdr_EzeQ.png" /></figure><p><strong>Step 4: Install Docker Repository</strong></p><p><strong>sudo add-apt-repository &quot;deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable&quot;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3CgQ7y7iZkiKHQtv.png" /></figure><p><strong>Step 5: Update software repository</strong></p><p><strong>sudo apt-get update</strong></p><p><strong>Step 6: Install latest Docker version</strong></p><p><strong>sudo apt-get install docker-ce</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qF1cTDgkHCpl0AcL.png" /></figure><p>This step completes Docker Installation on your WSL2, now you have to do a quick rain check.</p><p><strong>Step 7: Check Docker Version</strong><br>To check whether docker is installed properly or not check Docker version using this command <strong>docker --version</strong>. If you don’t get error like – b<em>ash: /usr/bin/docker: No such file or directory</em> and see the Docker version then you know that Docker is installed successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1y0rOtEA_Hz0Hy9L.png" /></figure><p>Now that Docker is installed, you need to start the docker service. To check whether Docker Service is running or not execute below commands</p><p><strong>Step 8: Check Docker service status</strong><br><strong>service docker status</strong><br>or<br><strong>sudo service docker status</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MrqzQm_UsdsX7MVf.png" /></figure><p><strong>Step 9: Running Docker service</strong><br><strong>sudo service docker start</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R9ZJnTPQEC9-ESXp.png" /></figure><p>Look for <em>OK</em> in your terminal. To re-verify service status use this command</p><p><strong>sudo service docker status</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*izIC_MeAt4rNiUW_.png" /></figure><p><strong>Step 10: Check Docker container and image status</strong></p><p>If you want to know more information about running Docker Images use<br><strong>sudo docker info</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pJGa4_IObnMvLsXQ.png" /></figure><p>or <strong>sudo docker ps</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8WEniRIkKr4Y7095.png" /></figure><p>This will show you status of all your image details. At this point in time it won’t show anything as we haven’t created any Docker container yet.</p><p>In next step we are going to create a Docker container for .NET core application and run it, then we will re-visit these stats.</p><p><strong>Note:</strong> you can run docker ps and docker info without sudo. If you get any socket error while running docker ps and docker info without sudo then run this command <strong>sudo usermod -a -G docker $USER </strong>and completely logout from the terminal. Now you should be able to run these commands without sudo.</p><h3>Dockarize your .NET Core Web app</h3><p>So far we have covered how to Confiure WSL and Install Docker on it and run it, now it’s time to Dockerize an existing .NET Core MVC application and running it. For this example I have created a simple .NET Core app with mvc template outside of WSL using <strong>dotnet new mvc</strong> Created a new directory named <em>first-docker</em> on WSL and copied the above .NET project contents. Opened a Visual Studio Code editor from the current directory. Added the following Dockerfile</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/966ad60a1397665351c2180845308dc9/href">https://medium.com/media/966ad60a1397665351c2180845308dc9/href</a></iframe><p>I’m calling this application as <em>first-docker</em> and hence the output dll is <em>first-docker.dll.</em> See Line 16. Added a .dockerignore file to exclude bin and obj folder. Added the following lines into it. <strong>/bin /obj </strong>Now that the Dockerfile is added, it’s time to build the Docker container with all the .NET runtime along with building the project inside. Use the following command in the WSL2 bash within the current working directory <strong>docker build -t first-docker .</strong> It will start installing required package to build .NET Core Container as below –</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_m5zAETw1_HtbWbS.png" /></figure><p>On successful build of the Image you will see something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iwC14n-3aSWQJHnv.png" /></figure><p>To run your first Dockerized .NET Core app execute up the following command <strong>docker run -d -p 8080:80 --name dotnetcoredocker first-docker</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7RKH9-NZJdSD6F8Y.png" /></figure><p>This will run the .NET Core MVC app and will start listening to 8080 port. To access it from your Windows 10 browser you have to open the url with IP address. You Can’t use localhost at this moment, at the time of writing this post localhost is not supported in WSL2.</p><h3>Subhankar Sarkar on Twitter</h3><p>WSL2 Tip: Don&#39;t bang your head if you don&#39;t get result using localhost in your Browser. Use IP address only to access #Linux application from #Windows. Localhost is not supported yet in #WSL2. #WindowsInsiders #Docker #dotnetcore https://t.co/3cZSklQT7I</p><p>To get your WSL2’s IP use the following command <strong>ip addr | grep eth0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IxnI14w1N8gnpFjV.png" /></figure><p>Once you get your IP address type <a href="http:///">http://ipaddress/</a> in a browser running on your Windows 10, and Viola…!!! you got your first Dockerized .NET Core MVC Web App running on WSL2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S25Wy4v_ecoVgyZJ.png" /></figure><h3>Final check and wrap up</h3><p>Now that your first Dockerized .NET Core application is running perfectly well on WSL2 let’s check few final things –</p><p>Let’s go up and check Docker Setup <strong>Step 10</strong>. While running docker ps we have seen that there was no running container and also in the output of docker info command number of containers and images was 0.</p><p>While the Dockerized Web Application is running in browser, let’s run those commands again and see the difference –</p><p><strong>docker info</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Lnrjn5FPyPOeVa-m.png" /></figure><p><strong>docker ps</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*75aVxfnodRGrvzze.png" /></figure><p>Notice that Container and Running instance count increased to 1 from 0. An Image with name <em>first-docker</em> is running in a container named <em>dotnetdocker</em> and it’s listening to <em>8080</em> port as configured in the Dockerfile.</p><p>This completes the full circle, starting from Installing WSL2 in your Windows 10 PC, Installing Docker and finally running a Dockerized .NET Core Web application from WSL2. Enjoy your first Dockerized app on WSL2. Cheers…!!!</p><p><em>Originally published at </em><a href="https://subhankarsarkar.com/wsl2-for-containerised-dot-net-core-development-using-docker/"><em>https://subhankarsarkar.com</em></a><em> on June 16, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43b85246268" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>