<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bablu Lawrence</title>
    <description>The latest articles on DEV Community by Bablu Lawrence (@bablulawrence).</description>
    <link>https://dev.to/bablulawrence</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F292998%2F6a354312-a1ad-43a3-8d30-248bb67bb2a9.jpg</url>
      <title>DEV Community: Bablu Lawrence</title>
      <link>https://dev.to/bablulawrence</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bablulawrence"/>
    <language>en</language>
    <item>
      <title>A Starter template for React &amp; ASP.NET Core App in Azure </title>
      <dc:creator>Bablu Lawrence</dc:creator>
      <pubDate>Tue, 15 Sep 2020 03:45:49 +0000</pubDate>
      <link>https://dev.to/bablulawrence/a-starter-template-for-react-asp-net-core-app-in-azure-3ja3</link>
      <guid>https://dev.to/bablulawrence/a-starter-template-for-react-asp-net-core-app-in-azure-3ja3</guid>
      <description>&lt;p&gt;So you are thinking of building an app using React, ASP.NET Core and deploy to Azure.&lt;/p&gt;

&lt;p&gt;That should be simple isn't it?&lt;/p&gt;

&lt;p&gt;No, not likely if you are building something to put in production; because in that situation you (or InfoSec) will have several of following ideas, perfectly reasonable in themselves :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lets use newest React and .NET Core features. &lt;/li&gt;
&lt;li&gt;Database? Obviously Azure SQL Db.&lt;/li&gt;
&lt;li&gt;Azure Search and Azure Redis Cache will make my app really fast. &lt;/li&gt;
&lt;li&gt;Users really want SSO, so we should use OpenId Connect, OAuth 2.0, Azure AD, MFA ...&lt;/li&gt;
&lt;li&gt;Definitely no keys, secrets and passwords in config files.&lt;/li&gt;
&lt;li&gt;CI/CD is a given.&lt;/li&gt;
&lt;li&gt;We will fully automate cloud provisioning.
&lt;/li&gt;
&lt;li&gt;MVP in 12 weeks, Yey 😃!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, together this is a lot of work. For example: &lt;/p&gt;

&lt;p&gt;How app will access Azure Search and Redis Cache? The best practice is to use Azure Managed Service Identity(MSI). However MSI is not supported for these services yet. That leads to Azure Key Vault; you can store the keys in Key Vault and retrieve them using MSI from the app. But can Key Vault be used for storing Azure SQL DB passwords as well? You can, but SQL DB does support MSI so it is better to use that. &lt;/p&gt;

&lt;p&gt;How about provisioning? You can use ARM templates, Azure PowerShell or Azure CLI. However if you goal is to achieve 100% automation and CI/CD then you probably need all 3.  &lt;/p&gt;

&lt;p&gt;and there are more like this... &lt;/p&gt;

&lt;p&gt;Lot of this complexity is accidental in nature and has nothing to do with the success or failure of your app i.e. the solution to the problem you are trying to solve. Does that mean you can push it towards later in the development? Not advisable, you probably will under estimate the effort and risks and end up in trouble. &lt;/p&gt;

&lt;p&gt;So what is the solution?&lt;/p&gt;

&lt;p&gt;Ironically, good news lies in the nature of the problem. As mentioned above, lot of this complexity has nothing to do with with your problem you are trying to solve. That means if you have a set of patterns that solve them you can carry them to your next app, provided you structure your code and deployment appropriately. &lt;/p&gt;

&lt;p&gt;Having been there recently, I built a template encapsulating the solutions for my future self. You might find it useful. Here it is: &lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/bablulawrence"&gt;
        bablulawrence
      &lt;/a&gt; / &lt;a href="https://github.com/bablulawrence/starter-react-dotnetcore"&gt;
        starter-react-dotnetcore
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      React ASP.NET Core MVC application template for Microsoft Azure
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
A Starter template for React &amp;amp; ASP.NET Core App in Azure&lt;/h1&gt;
&lt;p&gt;Building a React &amp;amp; ASP.NET Core app and deploying to Azure is rather straight forward. However building one ready ready for production can become quite complicated because you might want to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use additional services like Azure Storage, Azure Search, Azure Redis cache and therefore need a scalable way to add the service APIs to your application code.&lt;/li&gt;
&lt;li&gt;Implement best practices for accessing these services from your app, such as Azure Managed Service Identity(MSI) and Azure Key Vault.&lt;/li&gt;
&lt;li&gt;Implement Authentication using Azure AD, Single Sign On(SSO), OpenId Connect, OAuth 2.0, MFA etc.&lt;/li&gt;
&lt;li&gt;Fully automate provisioning of Azure resources.&lt;/li&gt;
&lt;li&gt;Implement CI/CD.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is a template app, created with the intent of solving some of these problems, helpful for quick starting React &amp;amp; ASP.NET development in Azure. The core domain is kept as plain CRUD, so that it can be refactored to…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/bablulawrence/starter-react-dotnetcore"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


</description>
      <category>azure</category>
      <category>react</category>
      <category>dotnet</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Stop(deallocate) inactive Azure Virtual Machines automatically</title>
      <dc:creator>Bablu Lawrence</dc:creator>
      <pubDate>Sat, 15 Feb 2020 04:49:16 +0000</pubDate>
      <link>https://dev.to/bablulawrence/stop-deallocate-inactive-azure-virtual-machines-automatically-2nd3</link>
      <guid>https://dev.to/bablulawrence/stop-deallocate-inactive-azure-virtual-machines-automatically-2nd3</guid>
      <description>&lt;p&gt;At present Azure gives you below approaches to reduce compute cost of Azure Virtual Machines with variable usage pattern - such as the ones used for development and testing.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://azure.microsoft.com/en-in/blog/announcing-auto-shutdown-for-vms-using-azure-resource-manager/"&gt;Stop VMs during off-hours using Virtual Machine Auto-Shutdown&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.microsoft.com/en-us/azure/automation/automation-solution-vm-management"&gt;Start/Stop VMs using Azure Automation&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These approaches require setup to be done for each individual VM separately. However, if you have lot of VMs spread across multiple resource groups in different subscriptions, setting up and managing these solutions takes lot of work. In other words, these solutions doesn't scale very well.&lt;/p&gt;

&lt;p&gt;I wrote an app to solve some of these issues: &lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/bablulawrence"&gt;
        bablulawrence
      &lt;/a&gt; / &lt;a href="https://github.com/bablulawrence/vmautostop"&gt;
        vmautostop
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Stop(deallocate) inactive Azure Virtual Machines automatically
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
VmAutoStop - stop(deallocate) inactive Azure Virtual Machines automatically&lt;/h1&gt;
&lt;p&gt;&lt;em&gt;Intended for optimizing compute costs of dev/test virtual machines. Not recommended for VMs running production or critical workloads.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;At present Azure gives you below approaches to reduce compute cost of Azure Virtual Machines with variable usage pattern - such as the ones used for development and testing.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://azure.microsoft.com/en-in/blog/announcing-auto-shutdown-for-vms-using-azure-resource-manager/" rel="nofollow"&gt;Stop VMs during off-hours using Virtual Machine Auto-Shutdown&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.microsoft.com/en-us/azure/automation/automation-solution-vm-management" rel="nofollow"&gt;Start/Stop VMs using Azure Automation&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These approaches require setup to be done for each individual VM separately. However, If you have lot of VMs spread across multiple resource groups in different subscriptions, setting up and managing these solutions takes lot of work. In other words, these solution doesn't scale very well.&lt;/p&gt;
&lt;p&gt;This app is an attempt to solve some of these problems. Using this you will be able to select all VMs in resource group for auto stopping by adding a resource tag and setting…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/bablulawrence/vmautostop"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Here is how it works : &lt;/p&gt;

&lt;p&gt;An Azure Function app runs every minute and gets a list of VMs in the subscriptions that it has access to. It then reads VM metric values - &lt;code&gt;Percentage CPU&lt;/code&gt; and &lt;code&gt;Network Out&lt;/code&gt; and calculates their standard deviation. If the standard deviation is less than the predefined threshold, VM is deemed inactive and a warning email is sent. Subsequently VM is stopped if it continues to be inactive.&lt;/p&gt;

&lt;p&gt;Assumption is that the variance/standard deviation of CPU utilization and Network traffic for an inactive VM is lower than an active one. This is certainly seems true for VMs which has users logged in using SSH(Linux) or Remote Desktop(Windows) to performing dev/test activities. However this assumption might not be applicable for VMs running workloads with uniform resource consumption patterns and therefore app might not be useful for such cases.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>showdev</category>
      <category>virtualmachine</category>
    </item>
  </channel>
</rss>
