<?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: Sumit Kharche</title>
    <description>The latest articles on DEV Community by Sumit Kharche (@sumitkharche).</description>
    <link>https://dev.to/sumitkharche</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%2F107662%2F4ca21131-63e3-4852-a721-709670151a11.jpeg</url>
      <title>DEV Community: Sumit Kharche</title>
      <link>https://dev.to/sumitkharche</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sumitkharche"/>
    <language>en</language>
    <item>
      <title>How to upload files into Azure Blog Storage using Azure functions in C#</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Mon, 11 Apr 2022 17:06:42 +0000</pubDate>
      <link>https://dev.to/sumitkharche/how-to-upload-files-into-azure-blog-storage-using-azure-functions-in-c-4ga3</link>
      <guid>https://dev.to/sumitkharche/how-to-upload-files-into-azure-blog-storage-using-azure-functions-in-c-4ga3</guid>
      <description>&lt;p&gt;​&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this article, we will discuss about Azure Storage and different types of storage services provided by azure. We will create a storage account from Azure portal and we will then create azure function to store the files into azure blob storage and finally we will deploy the same function to the Azure function app from Visual Studio.&lt;/p&gt;

&lt;p&gt;If you are new to Azure Functions then check out the below articles,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/sumitkharche/how-to-easily-create-azure-functions-using-azure-portal-5ghd"&gt;How To Easily Create Azure Functions Using Azure Portal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/sumitkharche/how-to-easily-create-azure-functions-using-azure-portal-5ghd"&gt;How To Create And Publish Azure Function From Visual Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/sumitkharche/how-to-integrate-application-insights-into-azure-functions-4d1g"&gt;How To Integrate Application Insights Into Azure Functions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Azure Storage Service
&lt;/h2&gt;

&lt;p&gt;Whenever we create a application we have to first decide what storage we can use to store the data. Azure Storage provides solution to different storage solution problems. It provides scalable, available, durable storage for data in azure. Azure storage is set of different services such as Blobs, Files, queues, etc. We can interact with azure storage using different programming languages such .NET, JAVA, Golang, Javascript, etc. using the SDKs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Different Azure Storage Service:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Azure Blob&lt;/strong&gt; - also know as blobs which mainly used to store the binary/text data such as photos, videos, documents, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure Tables&lt;/strong&gt; - which is nothing but a NoSQL storage for schemaless structured data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure Queue&lt;/strong&gt; - it is used to store the messages which can be use to communicate with applications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure Files&lt;/strong&gt; - it is managed file share service for cloud or on-premise using SMB/NFS protocol.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure Disks&lt;/strong&gt; - It is a virtual hard disk (VHD) that is of two types: managed and unmanaged.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Azure Blob storage
&lt;/h2&gt;

&lt;p&gt;Azure Blob storage is a storage service used to store schemaless structured data in the cloud. We can store data such as documents, pictures, videos, log files, backup files which don’t have fixed structure. Blob storage are similar to directory structure where we can create different containers to store the blobs.&lt;/p&gt;

&lt;h4&gt;
  
  
  There are 3 types of Blobs:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Block Blobs&lt;/strong&gt; - which are used to store the text / binary data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Append Blobs&lt;/strong&gt; - nothing but block blobs which are optimize for append operation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Page Blobs&lt;/strong&gt; - which store random access files up to 8 TiB in size.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Create simple azure function using C# to upload files in Azure Blog Storage
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Prerequisites:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;Azure account&lt;/a&gt; (If you don't have an Azure subscription, &lt;a href="https://azure.microsoft.com/free" rel="noopener noreferrer"&gt;create a free trial account&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Visual Studio 22 with Azure Development workload&lt;/li&gt;
&lt;li&gt;Basic knowledge of C#
 &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Create a Azure Storage resource using Azure Portal
&lt;/h2&gt;

&lt;p&gt;Login to &lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;Azure  &lt;/a&gt;and click on Create a resource button.&lt;br&gt;
In search box type “storage account” and select it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fje2wkleshvevguzd6oh4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fje2wkleshvevguzd6oh4.png" alt="stg-1" width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on Create button and you can see the Create storage account page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd5qk1b4ea72ce57qcmqj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd5qk1b4ea72ce57qcmqj.png" alt="stg-2" width="800" height="812"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Azure has Resource Groups (RG) which acts as a container for your resources. So now we are going to create a Storage account resource. First we need to create Resource Group. If you have already created RG then you can use the same here. Under Resource group click on Create New button and give a unique RG name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc06ara11rxz03mt9bj26.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc06ara11rxz03mt9bj26.png" alt="stg 3" width="800" height="757"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give the unique name to storage account and select the region. Click on Next : Advanced button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxs34xb4zcc24djk8tnnk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxs34xb4zcc24djk8tnnk.png" alt="stg 4" width="800" height="711"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default the “Enable blob public access” is checked which means that any anonymous user can access to blobs within the containers. So uncheck the option and click on Review + Create button&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgigaifyv72gjmu9i216d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgigaifyv72gjmu9i216d.png" alt="stg 5" width="800" height="703"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait for few sec to complete the validation and Review everything is added properly after that click on Create button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fym06ijvw3oob57boxppf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fym06ijvw3oob57boxppf.png" alt="stg 6" width="800" height="701"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Creating resources will take time so wait for deployment process to finish.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9c0p3rz6pf76d981quu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9c0p3rz6pf76d981quu.png" alt="stg 7" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our storage account is created successfully. Now click on Go to resource button to see the storage account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4p1774w7emhyejx6kwio.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4p1774w7emhyejx6kwio.png" alt="stg 8" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftkjok8krn26qk45iaxox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftkjok8krn26qk45iaxox.png" alt="stg 9" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now next step is to create container to store our blobs. So in left section click on Containers and then click on + Container button. Give the proper name to container in which we are going to upload our files and click on Create button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33o7xkwzapzn65uwv8hf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F33o7xkwzapzn65uwv8hf.png" alt="stg 10" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next step is to create a Azure function which upload files into the “file-upload” container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firsw1a0n7c9414kgok93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firsw1a0n7c9414kgok93.png" alt="stg 11" width="800" height="256"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Create a HTTP trigger azure function using C# to upload files to blob storage
&lt;/h2&gt;

&lt;p&gt;So open Visual Studio and Go to File -&amp;gt; New -&amp;gt; Project. Search "Azure Functions" in the search box and select the Azure function template and click on Next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2afao1y4kp6tqjuob2lc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2afao1y4kp6tqjuob2lc.png" alt="fun-01" width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give a name to the function project and click on Create.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkbyk00kq6w67e0kzm6aq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkbyk00kq6w67e0kzm6aq.png" alt="fun 02" width="800" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the HTTP trigger template and set the Authorization level as Anonymous and click on Create.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdttpf087abjoertb7my5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdttpf087abjoertb7my5.png" alt="fun 3" width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it. We have created our first Azure function. By default the name of the function is Function1.cs so now change it to "&lt;strong&gt;FileUpload&lt;/strong&gt;".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmznar7y3ebkwi21djwch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmznar7y3ebkwi21djwch.png" alt="fun 4" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So for our application, we are creating HTTP Trigger function which takes file as input and uploads it into the Azure Blob. To connect with the Blob Storage container we need a connection string. So let's open the Azure Storage resource in portal -&amp;gt;Access Keys -&amp;gt; Click on Show Keys - &amp;gt; Copy the Key 1 Connection String.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpeqvjgki7l0cg6qymxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqpeqvjgki7l0cg6qymxr.png" alt="fun 5" width="800" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the local.settings.json file in our function app and paste the connection string of our Azure Storage resource as value of “AzureWebJobsStorage” key. Also add another key called as “ContainerName” and paste the name of container we have created earlier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"IsEncrypted"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Values"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"AzureWebJobsStorage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;replace your blob storage connection key here&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"ContainerName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"file-upload"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Container&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;name&lt;/span&gt;&lt;span class="w"&gt; 
    &lt;/span&gt;&lt;span class="nl"&gt;"FUNCTIONS_WORKER_RUNTIME"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dotnet"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To interact with Azure storage we have to first install the below NuGet package.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft5h619ww2w1t3mrq5xpk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft5h619ww2w1t3mrq5xpk.png" alt="fun 6" width="800" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now add the below code to upload a file into the container in our blob storage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Azure.Storage.Blobs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.AspNetCore.Http&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.AspNetCore.Mvc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.Azure.WebJobs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.Azure.WebJobs.Extensions.Http&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.Extensions.Logging&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.IO&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Threading.Tasks&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;FileUploadFunction&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FileUpload&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;FunctionName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"FileUpload"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IActionResult&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;HttpTrigger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AuthorizationLevel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Anonymous&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"post"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Route&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt; &lt;span class="n"&gt;HttpRequest&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;ILogger&lt;/span&gt; &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Connection&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Environment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetEnvironmentVariable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"AzureWebJobsStorage"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;containerName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Environment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetEnvironmentVariable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"ContainerName"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;Stream&lt;/span&gt; &lt;span class="n"&gt;myBlob&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;MemoryStream&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Files&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"File"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
            &lt;span class="n"&gt;myBlob&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;OpenReadStream&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;blobClient&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;BlobContainerClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Connection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;containerName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;blob&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;blobClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetBlobClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;FileName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UploadAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myBlob&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;OkObjectResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"file uploaded successfylly"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First we have stored the Blob Storage connection string and container name from configuration into local variables. After that we have read the file request by using key called “File” into variable and using OpenReadStream() function we have read the file into the steam. To interact with Blob storage we first have to create BlobContainerClient by passing connection string and container name. After creating client, we have to create BlobClient using GetBlobClient method by passing input file name.&lt;/p&gt;

&lt;p&gt;Finally to upload file to container we have used UploadAsync method by passing steram. You can read more about this methods &lt;a href="https://github.com/Azure/azure-sdk-for-net" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now run the FileUpload function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frl3bfi2ifvuszthx6brx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frl3bfi2ifvuszthx6brx.png" alt="fun 7" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For testing the function open postman and paste the about function URL i.e. &lt;a href="http://localhost:7071/api/FileUpload" rel="noopener noreferrer"&gt;http://localhost:7071/api/FileUpload&lt;/a&gt;&lt;br&gt;
Now in our code we have read the file from form data so click on Body and select form-data then add key as “File” and for value select which file you want to upload and click on Send button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgovovd11vz1vj7fqmhm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzgovovd11vz1vj7fqmhm.png" alt="fun 8" width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if we open our “file-upload” container we can see the file which we uploaded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnegykxvlt3tp20p7rdc7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnegykxvlt3tp20p7rdc7.png" alt="fun 9" width="800" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Publish Azure function to Azure function app using Visual Studio
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Create a function app using Azure portal
&lt;/h4&gt;

&lt;p&gt;Log in to the Azure portal In the Search bar, search as "function app" and then select the Function app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fymxldsxhs7t91tm6bt5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fymxldsxhs7t91tm6bt5r.png" alt=" " width="800" height="335"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovwbs7mrdrf5vnvrgrlh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovwbs7mrdrf5vnvrgrlh.png" alt=" " width="800" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that click on the " + Create" button to add a new function app. Fill out the basic details:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqd5iia55kod6dvsvixt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqd5iia55kod6dvsvixt.png" alt=" " width="800" height="625"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now click on Review: Create button and review all the details and click on the Create button. Wait for a few minutes to create the resources.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcm2zy294rc2a0zxgssji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcm2zy294rc2a0zxgssji.png" alt=" " width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once deployment complete click on Go to resource button to see out new function app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9dh2v9zqbo05td5engfp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9dh2v9zqbo05td5engfp.png" alt=" " width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F02r7rx9q720dc5ieedud.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F02r7rx9q720dc5ieedud.png" alt=" " width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Publish the azure function into the function app
&lt;/h4&gt;

&lt;p&gt;To deploy our function to Azure we need Azure Function App. Right Click on our solution and click on the Publish button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8q7zpenei1365llfflz3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8q7zpenei1365llfflz3.png" alt=" " width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we are publishing into Azure then Select Azure and click on Next. Select target as "Azure Function App(Windows)" and click on Next. We can either select an already created function app or we can create a new Function app. Click on Finish button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12lvhstyjse389as9fz7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12lvhstyjse389as9fz7.png" alt=" " width="800" height="562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on Publish button to push our function to our Function App.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhz39woxyyhx4xe9k48a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqhz39woxyyhx4xe9k48a.png" alt=" " width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once our app is successfully published on Azure,  go to the Azure portal and search for our function app. Select Functions from the left sidebar to see our deployed function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdrm2iqw0yk51f8mpbmf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdrm2iqw0yk51f8mpbmf.png" alt=" " width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Configure the storage account connection string into Configuration setting of Function app
&lt;/h4&gt;

&lt;p&gt;Now we have deployed our function into Function app so next step is to configure the settings. So click on Configuration. For this app we have to set value of Storage connection string and container name in configuration. So seach for "AzureWebJobsStorage" and click on Edit button and paste your storage connection string.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6y4nr3xchcu2762luviu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6y4nr3xchcu2762luviu.png" alt=" " width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcq6dh9nfm8c82vddep4h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcq6dh9nfm8c82vddep4h.png" alt=" " width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on "+ New application setting" and give name as "ContainerName" and Value as "file-upload".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpajt6ujwu6xb2goyees7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpajt6ujwu6xb2goyees7.png" alt=" " width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally click on Save button to save changes. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fysqtqd3po2vdd45855jf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fysqtqd3po2vdd45855jf.png" alt=" " width="800" height="248"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h4&gt;
  
  
  Test publish app using postman
&lt;/h4&gt;

&lt;p&gt;To ge the url of deployed function click on Functions -&amp;gt; Select File Upload function -&amp;gt; Click on Get Function Url -&amp;gt; Copy url and paste in postman.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczvuxirr9y5si9x1eirs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fczvuxirr9y5si9x1eirs.png" alt=" " width="800" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now as we test locally in form-data add a key "File" and select file you want to upload.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89p6fob1qx2gnmw7soo6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89p6fob1qx2gnmw7soo6.png" alt=" " width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if we check container we can see the file uploaded into it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7awd4yt36yh20p66yxk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7awd4yt36yh20p66yxk.png" alt=" " width="800" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we have discuss about Azure Storage and Azure blob storage. We have created a Azure Blob storage resource from Azure Portal. We created a new Azure function from Visual Studio which uploads the file to blob storage. Also, I demonstrated how to test and deploy the function from VS and test using Postman.&lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this article, share it with friends, and please do not hesitate to send me your thoughts or comments. Stay tuned for more Azure Functions articles. &lt;/p&gt;

&lt;p&gt;You can follow me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt; or LinkedIn &lt;a href="https://www.linkedin.com/in/sumit-kharche-890426a9/" rel="noopener noreferrer"&gt;Sumit Kharche&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;​Happy Coding!!!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>cloud</category>
      <category>beginners</category>
      <category>showdev</category>
    </item>
    <item>
      <title>How to integrate Application Insights into Azure Functions</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Sun, 10 Apr 2022 09:42:50 +0000</pubDate>
      <link>https://dev.to/sumitkharche/how-to-integrate-application-insights-into-azure-functions-4d1g</link>
      <guid>https://dev.to/sumitkharche/how-to-integrate-application-insights-into-azure-functions-4d1g</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this article, we are going to discuss about Application Insights and how to integrate Application Insight into the Azure Function app. We will also create a simple Azure function app and also logs data into application insights.&lt;/p&gt;

&lt;p&gt;If you are new to Azure functions then first check the below articles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/sumitkharche/how-to-create-and-publish-azure-function-from-visual-studio-2cdc"&gt;How To Create And Publish Azure Function From Visual Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/sumitkharche/how-to-easily-create-azure-functions-using-azure-portal-5ghd"&gt;How To Easily Create Azure Functions Using Azure Portal&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this article, we will cover the below topics,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is Application Insights?&lt;/li&gt;
&lt;li&gt;Enable Application Insight at the time of creating Function App&lt;/li&gt;
&lt;li&gt;Integrate Application Insight into Existing Function App&lt;/li&gt;
&lt;li&gt;Log data from Azure Functions into Application Insights&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Application Insights?
&lt;/h2&gt;

&lt;p&gt;When creating a Cloud application or on-prem application, monitoring always helps us to quickly analyze and debug any issue. &lt;a href="https://docs.microsoft.com/en-us/azure/azure-monitor/overview" rel="noopener noreferrer"&gt;Azure Monitor&lt;/a&gt; is a service provided by Azure to monitor, analyze, improve the availability and performance of your application. &lt;/p&gt;

&lt;p&gt;According to Microsoft &lt;a href="https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview" rel="noopener noreferrer"&gt;docs&lt;/a&gt;,&lt;br&gt;
Application Insights, a feature of Azure Monitor, is an extensible Application Performance Management (APM) service for developers and DevOps professionals. Use it to monitor your live applications. It will automatically detect performance anomalies, and includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app.&lt;/p&gt;

&lt;p&gt;Application insights collect telemetry data from connected apps and provides Live Metrics, Log Analytics, etc. Application insights have an instrumentation key which we need to configure into our function app i.e. APPINSIGHTS_INSTRUMENTATIONKEY and with this key app insights grab data from our app. We can integrate application insights into Azure function in multiple ways as below:&lt;/p&gt;
&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;Azure &lt;/a&gt;account (If you don't have an Azure subscription, &lt;a href="https://azure.microsoft.com/free" rel="noopener noreferrer"&gt;create a free trial account&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Enable Application Insight at the time of creating Function App
&lt;/h2&gt;

&lt;p&gt;When we create a function app and also create application insights along with that then the instrumentation key is already set up in application settings with the name as APPINSIGHTS_INSTRUMENTATIONKEY&lt;/p&gt;

&lt;p&gt;Log in to the &lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;Azure portal&lt;/a&gt;. In the Search bar, search as "function app" and then select the Function app&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdqwuzisu3dwmsdciqdd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdqwuzisu3dwmsdciqdd.png" alt=" " width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcyyq9mw9jtx6w6ae1lwe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcyyq9mw9jtx6w6ae1lwe.png" alt=" " width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that click on the "Add" button to add a new function app. Fill out the basic details:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dl8janzmzpn8lg1sguh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dl8janzmzpn8lg1sguh.png" alt=" " width="662" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we filled out basic details, then click on the Next: Hosting button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu8j4inie8u0fp6p7zxni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu8j4inie8u0fp6p7zxni.png" alt=" " width="629" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we filled out hosting details then click on the Next: Monitoring button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn7uzodx0hskfrxwvtn4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn7uzodx0hskfrxwvtn4e.png" alt=" " width="681" height="606"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So here we can enable the application insight for our function app. By default, it takes the same name as the function name but if you want to give a custom name then click on the "Create new" button and then enter the name for insight &amp;amp; also you can select a preferred location.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0dypx7bq9pbbc1bwbgh4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0dypx7bq9pbbc1bwbgh4.png" alt=" " width="800" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now click on Review:Create button and review all the details and click on the Create button. Wait for a few minutes to create the resources. &lt;/p&gt;

&lt;p&gt;Open function app -&amp;gt; click on Application Insight from the left pane. You will see that our app insight is now linked to the function app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxuy901duy628yruc66j2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxuy901duy628yruc66j2.png" alt=" " width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the application insight and you can verify the Instrumentation Key here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcsxxaa6r7gtfvqgq9mf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkcsxxaa6r7gtfvqgq9mf.png" alt=" " width="800" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to Configuration to see that Azure automatically added APPINSIGHTS_INSTRUMENTATIONKEY into our function app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dlck5fvzza3x8o4b8zc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dlck5fvzza3x8o4b8zc.png" alt=" " width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Integrate Application Insight into Existing Function App
&lt;/h2&gt;

&lt;p&gt;If you have already created a function app and at that time you haven't enabled the Application Insight then you can either integrate the function app to existing app insight if you have any or create a new app insight resource and integrate it with your function app. &lt;/p&gt;

&lt;p&gt;Click on the Create Resource button and search for Application Insight and click on the Create button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7hccmwqhhw42wp3bzlcj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7hccmwqhhw42wp3bzlcj.png" alt=" " width="778" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill in all the details and click on the Review + create button. Wait for a few minutes to create the resources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tgwfxsbraka7xv72xub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tgwfxsbraka7xv72xub.png" alt=" " width="681" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now open your function app to which you want to link and click on Application Insights from the left sidebar. Click on the Turn on Application Insights button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tfra8h8o28lbfjo3rv2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1tfra8h8o28lbfjo3rv2.png" alt=" " width="797" height="539"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you can either create resources or select the existing app insight. Select the existing application insight resource to create in the above step. Finally, click on the Apply button. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs2b4ld46vs1faj8fpaoq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs2b4ld46vs1faj8fpaoq.png" alt=" " width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it we have now integrated application insight into our function app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftw8pk70ggwvwzp1u1d5b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftw8pk70ggwvwzp1u1d5b.png" alt=" " width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Log data from Azure Functions into Application Insights
&lt;/h2&gt;

&lt;p&gt;For the function app to send data to Application insight it requires the instrumentation key of the application insight resource. First, we will create a function app locally using Visual Studio and adding the instrumentation key into the local.settings.json file. &lt;/p&gt;

&lt;p&gt;Open a visual studio and create a new function app. If you are not familiar with how to create it from Visual Studio then check my article &lt;a href="https://www.c-sharpcorner.com/article/how-to-create-publish-azure-function-from-visual-studio/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00z8f50aixnwfeoyoyum.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F00z8f50aixnwfeoyoyum.png" alt=" " width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to your application insight resource and copy the instrumentation key&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frj2uq63c0pda5862qym1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frj2uq63c0pda5862qym1.png" alt=" " width="800" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open local.settings.json file &amp;amp; add a new setting called  APPINSIGHTS_INSTRUMENTATIONKEY and paste the copied key from the 2nd step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;  
    &lt;/span&gt;&lt;span class="nl"&gt;"IsEncrypted"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;  
    &lt;/span&gt;&lt;span class="nl"&gt;"Values"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;  
        &lt;/span&gt;&lt;span class="nl"&gt;"AzureWebJobsStorage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"UseDevelopmentStorage=true"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;  
        &lt;/span&gt;&lt;span class="nl"&gt;"FUNCTIONS_WORKER_RUNTIME"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dotnet"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;  
        &lt;/span&gt;&lt;span class="nl"&gt;"APPINSIGHTS_INSTRUMENTATIONKEY"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"5916dc8e-7c17-4f59-ab1d-932ea1abac21"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&amp;lt;replace&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;instrumentation&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;key&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;here&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;  
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;  
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the app and hit the function URL. You can see the telemetry data into application insight.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flsphk13f5jashhc47mde.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flsphk13f5jashhc47mde.png" alt=" " width="799" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0py7u7rpzf927fse4p1p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0py7u7rpzf927fse4p1p.png" alt=" " width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0alzl0ruffnguvfsd8hh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0alzl0ruffnguvfsd8hh.png" alt=" " width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we have discussed about Application Insights and also different ways to integrate application insights into the Azure function app. I really hope that you enjoy this article, share it with friends, and please do not hesitate to send me your thoughts or comments.&lt;/p&gt;

&lt;p&gt;Stay tuned for more Azure Functions articles.&lt;/p&gt;

&lt;p&gt;You can follow me on Twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/sumit-kharche-890426a9/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>serverless</category>
      <category>cloud</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Build a Blazing-Fast Astro Blog with Cosmic CMS</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Mon, 18 Oct 2021 17:19:30 +0000</pubDate>
      <link>https://dev.to/sumitkharche/how-to-build-a-blazing-fast-astro-blog-with-cosmic-cms-4e4</link>
      <guid>https://dev.to/sumitkharche/how-to-build-a-blazing-fast-astro-blog-with-cosmic-cms-4e4</guid>
      <description>&lt;p&gt;In this tutorial, I'm going to show you how to create a simple Blog application using &lt;a href="https://astro.build/" rel="noopener noreferrer"&gt;Astro&lt;/a&gt;, and &lt;a href="https://cosmicjs.com/" rel="noopener noreferrer"&gt;Cosmic CMS&lt;/a&gt;. Without further ado, grab some coffee &amp;amp; let's build a cool app!&lt;/p&gt;

&lt;h1&gt;
  
  
  TL;DR
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://astro-cosmic-blog.netlify.app/" rel="noopener noreferrer"&gt;Astro Cosmic Blog Demo&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/sumitkharche/astro-cosmic-app" rel="noopener noreferrer"&gt;Download Source Code&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.cosmicjs.com/apps/astro-cosmic-blog" rel="noopener noreferrer"&gt;Install the Astro Cosmic Blog&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;p&gt;You need to have installed the latest stable version of &lt;a href="https://nodejs.org" rel="noopener noreferrer"&gt;Node JS&lt;/a&gt; and NPM.  You will have no problem following the tutorial if you have a basic understanding of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML, CSS, and JavaScript&lt;/li&gt;
&lt;li&gt;import and export syntax (ES6 modules)&lt;/li&gt;
&lt;li&gt;concepts like components&lt;/li&gt;
&lt;li&gt;the fetch API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's get started with our technology stack. &lt;/p&gt;

&lt;h1&gt;
  
  
  What is &lt;a href="https://astro.build/" rel="noopener noreferrer"&gt;Astro&lt;/a&gt;?
&lt;/h1&gt;

&lt;p&gt;Astro is nothing but a yet another new Static Site Generator (SSG) which means it produces a static pages as in output. Its a new framework for building a websites. Astro give you us flexibility to use any JavaScript framework/library. The big advantage of using astro is it ships 0% Javascript by default and it will load on demand it we need it. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Astro is still an early beta state.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  What about &lt;a href="https://cosmicjs.com/" rel="noopener noreferrer"&gt;Cosmic&lt;/a&gt;?
&lt;/h1&gt;

&lt;p&gt;Cosmic is a headless CMS that will enable us to build our application surprisingly quickly and deploy it to Netlifly in moments. Unlike traditional CMS, Cosmic offers us as the developers a lot of flexibility to develop this application how we please and take it to whatever hosting platform we wish. It is also very easy to store and retrieve data, which makes it perfect for building apps like this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Your Blog Bucket in Cosmic
&lt;/h2&gt;

&lt;p&gt;To create a blog app we will require data. To manage and manipulate this data, we will be using the power of Cosmic buckets and objects. To get started:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a &lt;a href="https://app.cosmicjs.com/signup" rel="noopener noreferrer"&gt;free account on Cosmic&lt;/a&gt;. If this is your first time using Cosmic, you'll see a short tutorial which will introduce some of the data types we'll be using - buckets, objects, and metafields.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new empty bucket &amp;amp; name it coffee-blog. For each blog post, we will have three object types:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Title&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Content&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Image&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, go ahead and add these properties in your buckets along with some data for those objects. &lt;a href="https://www.cosmicjs.com/getting-started" rel="noopener noreferrer"&gt;If you're having trouble with Buckets, Objects, or Metafields, go ahead and read the Getting Started page really quickly for some startup instructions&lt;/a&gt;, then come on back to &lt;br&gt;
this article.&lt;/p&gt;

&lt;p&gt;Now we have created our Cosmic CMS and its get time to create a Astro project and integrate Cosmic CMS into it. &lt;/p&gt;
&lt;h1&gt;
  
  
  Create a Astro application
&lt;/h1&gt;

&lt;p&gt;To create Astro project, we have to first create a folder and navigate to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; mkdir astro-cosmic-app &amp;amp;&amp;amp; cd astro-cosmic-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now run following command to install astro:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; npm init astro
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;After that select the template "Starter Kit (Generic)" as shown in below image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2csgt9rnattoq5xljm96.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2csgt9rnattoq5xljm96.PNG" alt="select-template" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that select framework you would like to use so I will select Preact but you can select whichever you want as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ua8ur3vlf5ox87e9gm8.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ua8ur3vlf5ox87e9gm8.PNG" alt="select-framework" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now wait for a minutes to finish the project creation.&lt;/p&gt;

&lt;p&gt;After that install all the packages by running below command:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To run the application execute below command:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now open &lt;code&gt;http://localhost:3000/&lt;/code&gt; and see the output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foog08p5zo8xyyopp0grg.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foog08p5zo8xyyopp0grg.PNG" alt="first-start-app" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So open the application into VS Code editor and check folder structure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwsmcujpvmwa1vqh073e5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwsmcujpvmwa1vqh073e5.PNG" alt="first-vs-code" width="659" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;/public : Any static assets, like images, can be placed in the public/ directory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;src/components: components are reusable piece of code. You put any Astro/React/Vue/Svelte/Preact components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;src/pages : this folder contains all the pages for your website which are .md or .astro files. Each page is exposed as a route based on its file name.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this blog application we are using a Start Bootstarp Clean-blog template. Download the template from &lt;a href="https://startbootstrap.com/theme/clean-blog" rel="noopener noreferrer"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;After downloading, extract the files and copy the style.css file under /css folder of template into public folder in our project. &lt;/p&gt;

&lt;p&gt;Also copy data of /assets from template into assets folder in our project.&lt;/p&gt;
&lt;h4&gt;
  
  
  Create a .env file
&lt;/h4&gt;

&lt;p&gt;we are using .env file to stored the cosmic bucket and read key data. So install below package:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --D dotenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;After that create a .env file in root level of project and add update with your details:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;COSMIC_BUCKET_SLUG=&amp;lt;replace your bucket name&amp;gt;
COSMIC_READ_KEY=&amp;lt;replace your read key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Create different components
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;So delete all the files in components folder. First we will create a component called 'BlogPostPreview.astro' which takes input as single post data and display it. So in components folder create a new component as 'BlogPostPreview.astro'&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create another components called "BaseHead.astro" which contains all metadata urls, links to external css/js files.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Create a component called "footer.astro" to display the footer in all pages.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Create a component called "Navigation.astro" to display the footer in all pages.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h4&gt;
  
  
  Display all the posts in landing page
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;First we will create a folder in src called &lt;code&gt;lib&lt;/code&gt; and inside that create a file called 'config.js' which exports our env variables as belows:&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Open a index.astro file and replace below code to display all the posts in landing page:&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Now run the application using &lt;code&gt;npm run dev&lt;/code&gt; and see the output in &lt;code&gt;http://localhost:3000/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltrlwkfz7bljbkuwa6vq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fltrlwkfz7bljbkuwa6vq.PNG" alt="landing-page" width="800" height="681"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create another page inside pages folder called "about.astro" as below:&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Click on About option in navigation bar to see the output:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkk6p013jx1d5gus9a4ax.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkk6p013jx1d5gus9a4ax.PNG" alt="about-page" width="800" height="503"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now we have to create a page which create separate static page for all our posts and when user clicks on single post it will display that page. To achieve that create a folder in pages called "posts" and inside that create a page called "[slug].astro" as belows:&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Now run the app again and click on post to see the post details:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fob3cmtmbvppmqsuhzuty.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fob3cmtmbvppmqsuhzuty.PNG" alt="post-details" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To build application in production mode you just need to run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Deploy it
&lt;/h1&gt;

&lt;p&gt;We can now deploy our application on any hosting platform. I recommend deploying it on &lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt; because it supports project structures like this and can quickly create deployments.&lt;br&gt;
Checkout this &lt;a href="https://docs.astro.build/guides/deploy/#netlify" rel="noopener noreferrer"&gt;article&lt;/a&gt; to deploy Astro app into Netlify.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this article, I have demonstrated you how to create a blogging application using Astro and Cosmic. The Cosmic Community has a lot of examples on how to handle integration with email functions, download functions, and third-party platforms. If you're interested in building your own applications like this, &lt;a href="https://app.cosmicjs.com/signup" rel="noopener noreferrer"&gt;get started by setting up your free account&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this little app, and please do not hesitate to send me your thoughts or comments about what could I have done better.&lt;/p&gt;

&lt;p&gt;If you have any comments or questions about building apps with &lt;br&gt;
Cosmic, &lt;a href="https://twitter.com/cosmicjs" rel="noopener noreferrer"&gt;reach out to us on Twitter&lt;/a&gt; and &lt;a href="https://www.cosmicjs.com/community" rel="noopener noreferrer"&gt;join the conversation on Slack&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can follow me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/sumit-kharche-890426a9/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>astro</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How To Create And Publish Azure Function From Visual Studio</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Sun, 17 Jan 2021 15:14:59 +0000</pubDate>
      <link>https://dev.to/sumitkharche/how-to-create-and-publish-azure-function-from-visual-studio-2cdc</link>
      <guid>https://dev.to/sumitkharche/how-to-create-and-publish-azure-function-from-visual-studio-2cdc</guid>
      <description>&lt;p&gt;In the &lt;a href="https://dev.to/sumitkharche/how-to-easily-create-azure-functions-using-azure-portal-5ghd"&gt;previous&lt;/a&gt; article, we discussed Azure functions and its features, and we  also created an Azure function using Azure Portal. This is the second article in the Azure Functions series. In this article, we are going to discuss how we can simply create an Azure function using Visual Studio 19, and then we will deploy the same function to the Azure function app from Visual Studio.&lt;/p&gt;

&lt;p&gt;It is recommended to create an Azure function from Visual Studio or VS code so that we can write code in a proper way. We can create a C# based Azure function from Visual Studio. In this article, let's create a simple HTTP based Azure Function.&lt;/p&gt;

&lt;h1&gt;
  
  
  Create Azure Function Using Visual Studio
&lt;/h1&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Visual Studio 19 with Azure Development workload&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;Azure&lt;/a&gt; account (If you don't have an Azure subscription, &lt;a href="https://azure.microsoft.com/free" rel="noopener noreferrer"&gt;create a free trial account&lt;/a&gt;) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So open Visual Studio and Go to File -&amp;gt; New -&amp;gt; Project. Search "Azure Functions" in the search box and select the Azure function template and click on Next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftkrf5oxkoqi5trfsozmf.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftkrf5oxkoqi5trfsozmf.PNG" alt="create-new-func" width="800" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give a name to the function project and click on Create. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fortfosm9xpqx7ll3z2jc.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fortfosm9xpqx7ll3z2jc.PNG" alt="name" width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the HTTP trigger template and set the Authorization level as Anonymous and click on Create.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faqgmm2okug6agy4jpff9.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faqgmm2okug6agy4jpff9.PNG" alt="Alt Text" width="800" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To restrict the use of your function we can set the Authorization level. There are three types of levels available: 1] When we set levels as Function, then we have to provide a function key to call our function. 2] When we set as Admin, then you need to provide the master key. Both the function key and admin keys are found in the 'keys' management panel on the portal when your function is selected. 3] When we don't want any authorization then we can simply set level as Anonymous. &lt;/p&gt;

&lt;p&gt;That's it. We have created our first Azure function. Open the Function1.cs file to see generated function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fase6rh5iced67o1xfgtp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fase6rh5iced67o1xfgtp.PNG" alt="Alt Text" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now to run the function just run the project. It will then start azure function cli to run the function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbcgq4lb53bemyjjjsksg.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbcgq4lb53bemyjjjsksg.PNG" alt="Alt Text" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The function is running on '&lt;a href="http://localhost:7071/api/Function1" rel="noopener noreferrer"&gt;http://localhost:7071/api/Function1&lt;/a&gt;' after looking at the default function code written which accepts name from the query string or from the request body and appends the name to the Hello string and returns the output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcfj90qgzwpznf9h8nszr.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcfj90qgzwpznf9h8nszr.PNG" alt="Alt Text" width="800" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Deploy Azure Function using Visual Studio
&lt;/h1&gt;

&lt;p&gt;To deploy our function to Azure we need Azure Function App. Right Click on our solution and click on the Publish button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2xo95tguewwozfq719q8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2xo95tguewwozfq719q8.png" alt="Alt Text" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we are publishing into Azure then Select Azure and click on Next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flikmw29nv75m3es8kwjo.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flikmw29nv75m3es8kwjo.PNG" alt="Alt Text" width="800" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select target as "Azure Function App(Windows)" and click on Next. We can either select an already created function app or we can create a new Function app.&lt;/p&gt;

&lt;p&gt;To create a new function app click on "Create a new Azure Function" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs2i2pe8b68krfzsw8z6i.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs2i2pe8b68krfzsw8z6i.PNG" alt="Alt Text" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9axtte6i23dy12jq1f6r.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9axtte6i23dy12jq1f6r.PNG" alt="Alt Text" width="598" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name - Give a name for your function app&lt;/li&gt;
&lt;li&gt;Subscription - Select your Azure subscription&lt;/li&gt;
&lt;li&gt;Resource group - If you have already created RG then select that or click on 'new' button to create new RG&lt;/li&gt;
&lt;li&gt;Plan Type - Select as Consumption&lt;/li&gt;
&lt;li&gt;Location - Which is near to you&lt;/li&gt;
&lt;li&gt;Azure Storage - If you have already created Storage Account(SA) then select that or click on the 'new' button to create a new SA.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And then finally click on the Create button. In this way, we can create a new Function App, &lt;/p&gt;

&lt;p&gt;For this article, I am using an existing function which we have created in the previous article , and click on 'Finish' button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdqnmsb9l7ceoavezqflm.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdqnmsb9l7ceoavezqflm.PNG" alt="Alt Text" width="800" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5mq90rpjuo0f6jgv8cm9.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5mq90rpjuo0f6jgv8cm9.PNG" alt="Alt Text" width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once our app is successfully published on Azure,  go to the Azure portal and search for our function app. Select Functions from the left sidebar to see our deployed function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F901e12euwc6zdyhy0n3j.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F901e12euwc6zdyhy0n3j.PNG" alt="Alt Text" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To run the deployed function, click on the Function (in our case 'Function1') and then click on 'Get Function Url' button &amp;amp; finally copy the function URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy2f608s3u02z5osw72qn.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy2f608s3u02z5osw72qn.PNG" alt="Alt Text" width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now to test the above function you can either use Postman or you can simply open the browser and paste the above URL. Pass name from query string to see the correct output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx58d5k1gaqsmmu74zapv.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx58d5k1gaqsmmu74zapv.PNG" alt="Alt Text" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it. We have created the Azure function from Visual Studio.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this article, we have created a new Azure function from Visual Studio. Also, I demonstrated how to test and deploy the function from VS. I really hope that you enjoyed this article, share it with friends, and please do not hesitate to send me your thoughts or comments. Stay tuned for more Azure Functions articles. &lt;/p&gt;

&lt;p&gt;You can follow me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding!! &lt;/p&gt;

</description>
      <category>azure</category>
      <category>serverless</category>
      <category>csharp</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How To Easily Create Azure Functions Using Azure Portal</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Fri, 01 Jan 2021 09:26:46 +0000</pubDate>
      <link>https://dev.to/sumitkharche/how-to-easily-create-azure-functions-using-azure-portal-5ghd</link>
      <guid>https://dev.to/sumitkharche/how-to-easily-create-azure-functions-using-azure-portal-5ghd</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;In this article, we are going to discuss Azure Functions and how you can easily create your first Azure function app using Azure Portal. This is the first article of my new series called Azure functions for beginners. So let's grab a cup of coffee and start learning.&lt;/p&gt;

&lt;h1&gt;
  
  
  What are Azure Functions?
&lt;/h1&gt;

&lt;p&gt;Function As A Service (FaaS) is a category of cloud computing services that provides a platform in which you just need to think about writing business logic without thinking about the infrastructure required for its execution. Microsoft Azure provides two types of FaaS i.e Azure Logic Apps and Azure Functions. So in this article, we are going to discuss Azure functions only.&lt;/p&gt;

&lt;p&gt;According to Microsoft &lt;a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview" rel="noopener noreferrer"&gt;docs&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Azure Functions allows you to run small pieces of code (called "functions") without worrying about application infrastructure. With Azure Functions, the cloud infrastructure provides all the up-to-date servers you need to keep your application running at scale. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Azure functions are event-driven which means that you can run your function code when some event is triggered from either existing on-premise service or any other Azure service or third party service. The azure function can be scaled and you need to pay only for the resources as you consume. Azure functions support lots of trigger points such as Http trigger, queue trigger, etc. &lt;/p&gt;

&lt;p&gt;Some of the features of Azure functions are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Azure Functions has great language support such as C#, Java, JavaScript, Python, and PowerShell.&lt;/li&gt;
&lt;li&gt;Supports lots of triggers such as Service bus trigger, Http triggers, Queue trigger, etc.&lt;/li&gt;
&lt;li&gt;We need to pay only for the resources as you consume i.e. Pay-per-use pricing model&lt;/li&gt;
&lt;li&gt;We can install any of the libraries of your choice using NuGet or NPM&lt;/li&gt;
&lt;li&gt;We can easily implement CI/CD using Github, Azure DevOps Service&lt;/li&gt;
&lt;li&gt;We can also add integrated security on Http triggered based Azure functions using OAuth providers such as Azure Active Directory, Facebook, Google, Twitter, and Microsoft Account.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below are several templates available for creating Azure function for performing different operations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP trigger&lt;/li&gt;
&lt;li&gt;Blob storage trigger&lt;/li&gt;
&lt;li&gt;Queue storage trigger&lt;/li&gt;
&lt;li&gt;Service Bus Queue trigger&lt;/li&gt;
&lt;li&gt;Service Bus Topic trigger&lt;/li&gt;
&lt;li&gt;Timer trigger &lt;/li&gt;
&lt;li&gt;Event Grid trigger&lt;/li&gt;
&lt;li&gt;Event Hub trigger&lt;/li&gt;
&lt;li&gt;Azure Cosmos DB trigger&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can get more information about Azure Functions &lt;a href="https://docs.microsoft.com/en-us/azure/azure-functions/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. So in this article, we are going to create an HTTP trigger-based Azure function using C# from Azure Portal. I will cover all other types of templates in my next article.&lt;/p&gt;

&lt;h1&gt;
  
  
  Create Azure Function using Azure Portal
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;Azure&lt;/a&gt; account (If you don't have an Azure subscription, &lt;a href="https://azure.microsoft.com/free" rel="noopener noreferrer"&gt;create a free trial account&lt;/a&gt;) &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1 - Creating a Function App
&lt;/h2&gt;

&lt;p&gt;While creating a function you must have a function app to host the execution of your functions. You can group multiple functions into one function app which helps for deployment, scaling, easy for development &amp;amp; sharing of resources One function app can have multiple functions. &lt;/p&gt;

&lt;p&gt;Log in to the &lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;Azure portal&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In the Search bar, search as &lt;code&gt;function app&lt;/code&gt; and then select the Function app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner-mindcrackerinc.netdna-ssl.com%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fsearch-bar-app.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner-mindcrackerinc.netdna-ssl.com%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fsearch-bar-app.PNG" alt="search-bar-app" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner-mindcrackerinc.netdna-ssl.com%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fadd-new.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner-mindcrackerinc.netdna-ssl.com%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fadd-new.PNG" alt="add-new" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that click on the "Add" button to add a new function app. Fill out the basic details:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fbasic-details.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fbasic-details.PNG" alt="new-app" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Azure has Resource Groups(RG) which acts as a container for your resources. So now we are going to create a function app resource then first we need to create a Resource Group. If you have already created RG then you can use the same here. Under the Resource group click on the Create New button and give a unique RG name. I have selected an existing resource group.&lt;/li&gt;
&lt;li&gt;You need to provide a unique name for your function app.&lt;/li&gt;
&lt;li&gt;Select an appropriate run time for your app. Since we are going to create a function using C# so I have used .net core as runtime.&lt;/li&gt;
&lt;li&gt;Select a version and region. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once we filled out basic details, then click on the Next: Hosting button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fhosting.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fhosting.PNG" alt="create-fun-app" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to provide a storage account while creating a function app. If you have already created a Storage account then you can use the same here. Or you can create new as well.&lt;/li&gt;
&lt;li&gt;You have to select an operating system on which your app needs to be run.&lt;/li&gt;
&lt;li&gt;Finally, you have to select a pricing plan for your app. You can see more details about Pricing &lt;a href="https://azure.microsoft.com/pricing/details/functions/" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once we filled out hosting details then click on the Next: Monitoring button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fmonitoring.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fmonitoring.PNG" alt="app" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Application Insights, a feature of Azure Monitor, which is an extensible Application Performance Management (APM) service for developers and DevOps professionals. It is used to monitor your live applications. So if you want to integrate it in your function app the select Enable Application Insights flag to Yes.&lt;/p&gt;

&lt;p&gt;Now click on Review:Create button and review all the details and click on the Create button. Wait for a few minutes to create the resources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fwait-resouce.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fwait-resouce.PNG" alt="img1" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once deployment complete click on Go to resource button to see out new function app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcomplete-deployment.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcomplete-deployment.PNG" alt="img2" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Ffinal-function-app.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Ffinal-function-app.PNG" alt="img3" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 - Creating an HTTP triggered based Azure Function
&lt;/h2&gt;

&lt;p&gt;Once you navigate to the Function app then click on Functions in the left panel and then click on the Add button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcreate-new-function.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcreate-new-function.PNG" alt="img4" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now select the HTTP trigger from the right panel. Now set Name and Authorization level for your new function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fnew-function-1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fnew-function-1.PNG" alt="img5" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide a name for your new function.&lt;/li&gt;
&lt;li&gt;To restrict the use of your function we can set the Authorization level. There are three types of levels available: 1] When we set levels as Function, then we have to provide a function key to call our function. 2] When we set as Admin, then you need to provide the master key. Both the function key and admin keys are found in the 'keys' management panel on the portal when your function is selected. 3] When we don't want any authorization then we can simply set level as Anonymous.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now click on the Create Function button. You then automatically redirect to function once the function is successfully created. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fnew-function-created.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fnew-function-created.PNG" alt="img6" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the "Code + Test" button under the Developer section from the left sidebar panel. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcode-test-1-new.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcode-test-1-new.PNG" alt="img7" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So you can see the basic function code written which accepts name from the query string or from the request body and append to name to the Hello string and return the output.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 - Testing of Http triggered based Azure Function
&lt;/h2&gt;

&lt;p&gt;Now click on the "Test/Run" button. For this default function, you can provide the input property name from either body or either from the query string.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Frun-input.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Frun-input.PNG" alt="img8" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the Run button from the right panel. So you can see the output in the "Output" tab in the right panel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Frun-output.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Frun-output.PNG" alt="img9" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is all about running it from Portal. You can run this function from the browser or from the postman as well. To get the function URL click on the "Get Function URL" button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcopy-1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcopy-1.PNG" alt="img10" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcopy-2.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Fcopy-2.PNG" alt="img11" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since our function accepts input property name from the query string then paste the URL into the browser and append &lt;code&gt;?name=AzFunction&lt;/code&gt; and hit the URL. You will see the output in the browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Ffrom-browser.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Ffrom-browser.PNG" alt="img12" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since this is the HTTP Trigger function we can run it from postman as well. So paste the URL in postman and pass input and see the output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Ffrom-postman.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcsharpcorner.azureedge.net%2Farticle%2Fhow-to-easily-create-azure-functions-using-azure-portal%2FImages%2Ffrom-postman.PNG" alt="img13" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it. You have created your Azure function using Azure Portal.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this article, I have explained Azure Functions and how to create a function using the Azure Portal. Also, I demonstrated how to test function from portal, browser, and postman. &lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this article, share it with friends, and please do not hesitate to send me your thoughts or comments. Stay tuned for more Azure Functions articles.&lt;/p&gt;

&lt;p&gt;You can follow me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding!! &lt;/p&gt;

</description>
      <category>serverless</category>
      <category>azure</category>
      <category>csharp</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Getting Started with Azure Service Bus Queues &amp; ASP.NET Core - Part 2</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Thu, 17 Dec 2020 16:36:28 +0000</pubDate>
      <link>https://dev.to/sumitkharche/getting-started-with-azure-service-bus-queues-asp-net-core-part-2-2f5</link>
      <guid>https://dev.to/sumitkharche/getting-started-with-azure-service-bus-queues-asp-net-core-part-2-2f5</guid>
      <description>&lt;p&gt;In this article, we are going to discuss about how to listen message from Azure Service Bus Queues. In the Part 1 we have discussed about  Azure Service Bus Queues and how to send message into Queues using ASP.NET Core Web API. Please read part 1 before starting this article.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/sumitkharche" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F107662%2F4ca21131-63e3-4852-a721-709670151a11.jpeg" alt="sumitkharche"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/sumitkharche/get-started-with-azure-service-bus-queues-asp-net-core-part-1-255l" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Getting Started with Azure Service Bus Queues &amp;amp; ASP.NET Core - Part 1&lt;/h2&gt;
      &lt;h3&gt;Sumit Kharche ・ Jul 17 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#azure&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#dotnet&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#serverless&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Creating a simple application to send and receive messages from the queue.
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://portal.azure.com" rel="noopener noreferrer"&gt;Azure&lt;/a&gt; account(If you don't have an Azure subscription, &lt;a href="https://azure.microsoft.com/free" rel="noopener noreferrer"&gt;create a free trial account&lt;/a&gt;.)&lt;/li&gt;
&lt;li&gt;Basic knowledge of Asp.net Core Web API&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Overview of application
&lt;/h4&gt;

&lt;p&gt;In Part 1, we have created a Azure Service Bus Queue from Azure Portal and also created ASP.NET Core Web API to push message  into that queue:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh6v77l1g5vu74ijwcahz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh6v77l1g5vu74ijwcahz.png" alt="App Structure" width="800" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this article, we are going to create a Background Service to receive a message from Queue. &lt;/p&gt;

&lt;p&gt;We will be using same service bus (&lt;strong&gt;order-test-asb&lt;/strong&gt;) and queue (&lt;strong&gt;order-queue&lt;/strong&gt;) that we created in Part 1 for this article.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnrg8ilmx8804l9tkkrnt.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnrg8ilmx8804l9tkkrnt.PNG" alt="queue-message" width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Background service to listen the message from the Queue
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Prerequisites&lt;/em&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Visual Studio 19(if you are using .NET Core 3.1)&lt;/li&gt;
&lt;li&gt;.NET Core 3.1 SDK installed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;According to the &lt;a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-3.1&amp;amp;tabs=visual-studio" rel="noopener noreferrer"&gt;docs&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In ASP.NET Core, background tasks can be implemented as hosted services. A hosted service is a class with background task logic that implements the IHostedService interface. This topic provides three hosted service examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Background task that runs on a timer.&lt;/li&gt;
&lt;li&gt;Hosted service that activates a scoped service. The scoped service can use dependency injection (DI).&lt;/li&gt;
&lt;li&gt;Queued background tasks that run sequentially.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Along with IHostedService we have BackgroundService class is first introduced in ASP.NET Core 3.0 and which is an abstract class that already implements the IHostedService Interface. BackgroundService also gives an abstract method ExecuteAsync() that returns a Task. So in this article we are inheriting our class with BackgroundService and implements an ExecuteAsync() method.&lt;/p&gt;

&lt;p&gt;In part 1 we have created &lt;code&gt;Order.Web.Api&lt;/code&gt; which is used to send a message into service bus. Now we are going to create a hosted background service which is continuously running and listening a service bus messages. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to solution and right click on it and select &lt;strong&gt;Add&lt;/strong&gt; and select &lt;strong&gt;New Project&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select Console App(.Net Core) and click on Next.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fls8j6dch5c0o3bbxck8i.PNG" alt="add-new-project-1" width="800" height="508"&gt;
&lt;/li&gt;
&lt;li&gt;Give name to service and click on Create.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw1yopvo3pi8qbwxcgc51.PNG" alt="add-new-project-2" width="800" height="500"&gt;
&lt;/li&gt;
&lt;li&gt;Create a new file called &lt;code&gt;appsettings.json&lt;/code&gt; &amp;amp; add azure service connection string as below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"AppSettings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; 
   &lt;/span&gt;&lt;span class="nl"&gt;"QueueConnectionString"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;replace your RootManageSharedAccessKey here&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"QueueName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"order-queue"&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;First we have to install Azure Service Bus NuGet package:
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foo951gbl7e6abaekv2ca.PNG" alt="azure-servicebus-nuget-details" width="491" height="195"&gt;
&lt;/li&gt;
&lt;li&gt;So this service needs to listen messages from Azure Service bus we can create this as Windows service. Along with that add below code to read to the Appsettings from &lt;code&gt;appsettings.json&lt;/code&gt;. So create a class called AppSettings.cs as mentioned below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AppSettings&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;QueueConnectionString&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;QueueName&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To configure our service first we need to install below packages:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faob9sd0ey4tb6tdfe7ph.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faob9sd0ey4tb6tdfe7ph.PNG" alt="dependency-nuget" width="800" height="74"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fiohcj82u40njulz12btz.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fiohcj82u40njulz12btz.PNG" alt="hosting-nuget" width="656" height="82"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffmvicy8fv2oowwi4xzfl.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffmvicy8fv2oowwi4xzfl.PNG" alt="windows-service-nuget" width="628" height="74"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After that add below code in &lt;code&gt;program.cs&lt;/code&gt; to configure our service:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;      &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Program&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;IServiceCollection&lt;/span&gt; &lt;span class="n"&gt;serviceDescriptors&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ServiceCollection&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
             &lt;span class="n"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;CreateDefaultBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;UseWindowsService&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ConfigureHostConfiguration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;configHost&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;configHost&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddJsonFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"appsettings.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reloadOnChange&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;Build&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
                &lt;span class="p"&gt;})&lt;/span&gt;
                &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ConfigureServices&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;hostContext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;appSettingsConfig&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hostContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Configuration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetSection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AppSettings&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

                    &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddOptions&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
                    &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Configure&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;AppSettings&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;appSettingsConfig&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                    &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddSingleton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;appSettingsConfig&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;Build&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now next part is to create Background service to listen messages. So create a class called CraeteOrderHandler.cs and inherits it with class &lt;code&gt;BackgroundService&lt;/code&gt;. Now override the &lt;code&gt;ExecuteAsync&lt;/code&gt; and &lt;code&gt;StopAsync&lt;/code&gt; method of BackgroundService class.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Threading&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Threading.Tasks&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.Azure.ServiceBus&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.Extensions.Hosting&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.Extensions.Options&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;OrderService&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CraeteOrderHandler&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BackgroundService&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="n"&gt;AppSettings&lt;/span&gt; &lt;span class="n"&gt;_appSettings&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="n"&gt;IQueueClient&lt;/span&gt; &lt;span class="n"&gt;_orderQueueClient&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;CraeteOrderHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IOptions&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;AppSettings&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;appSettings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;_appSettings&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;appSettings&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="p"&gt;??&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ArgumentNullException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;appSettings&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;Handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CancellationToken&lt;/span&gt; &lt;span class="n"&gt;cancelToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ArgumentNullException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Encoding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;UTF8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Create Order Details are: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_orderQueueClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;CompleteAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SystemProperties&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LockToken&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ConfigureAwait&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;HandleFailureMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ExceptionReceivedEventArgs&lt;/span&gt; &lt;span class="n"&gt;exceptionReceivedEventArgs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exceptionReceivedEventArgs&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ArgumentNullException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exceptionReceivedEventArgs&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CompletedTask&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;protected&lt;/span&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;ExecuteAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CancellationToken&lt;/span&gt; &lt;span class="n"&gt;stoppingToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;messageHandlerOptions&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;MessageHandlerOptions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;HandleFailureMessage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;MaxConcurrentCalls&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;AutoComplete&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;MaxAutoRenewDuration&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TimeSpan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;FromMinutes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;};&lt;/span&gt;
            &lt;span class="n"&gt;_orderQueueClient&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;QueueClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_appSettings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;QueueConnectionString&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_appSettings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;QueueName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;_orderQueueClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RegisterMessageHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Handle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;messageHandlerOptions&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CraeteOrderHandler&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s"&gt; service has started."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CompletedTask&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;StopAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CancellationToken&lt;/span&gt; &lt;span class="n"&gt;stoppingToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CraeteOrderHandler&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s"&gt; service has stopped."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_orderQueueClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;CloseAsync&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;ConfigureAwait&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In ExecuteAsync() method calls when service is starts so we have setup a queue client object and also register Handle method to listen messages.&lt;/li&gt;
&lt;li&gt;In StopAsync() method we close the queue client connection.&lt;/li&gt;
&lt;li&gt;In Handle() method we just extract body from messasge which contains our actual data and just print it in console.&lt;/li&gt;
&lt;li&gt;After that let's register our hosted service by adding below line into &lt;code&gt;ConfigureServices&lt;/code&gt; method in Program.cs class.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddHostedService&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;CraeteOrderHandler&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;So lets build and run the service to listen messages. Start order web api and send message to queue which our OrderService going to be listen.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq00su4cnkp4sdtiaymvj.PNG" alt="send-message-using-web-api-postman" width="637" height="267"&gt;
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwj0vezv82bwg9g4p2jbc.PNG" alt="listen-message-console-log" width="800" height="120"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this article of Azure Service Bus Queue series, We have learned and implemented Background Service to listen message from azure service bus queue.&lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this article, share it with friends and please do not hesitate to send me your thoughts or comments.&lt;/p&gt;

&lt;p&gt;You can follow me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/sumit-kharche-890426a9" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding!!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>dotnet</category>
      <category>serverless</category>
      <category>csharp</category>
    </item>
    <item>
      <title>How to Build a Blazing-Fast Blazor Blog with Cosmic</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Sun, 25 Oct 2020 10:44:57 +0000</pubDate>
      <link>https://dev.to/sumitkharche/how-to-build-a-blazing-fast-blazor-blog-with-cosmic-3lee</link>
      <guid>https://dev.to/sumitkharche/how-to-build-a-blazing-fast-blazor-blog-with-cosmic-3lee</guid>
      <description>&lt;p&gt;In this tutorial, I'm going to show you how to create a simple but blazing fast blog using &lt;a href="https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor" rel="noopener noreferrer"&gt;Blazor WebAssembly&lt;/a&gt;,  &lt;a href="https://tailwindcss.com/" rel="noopener noreferrer"&gt;Tailwind CSS&lt;/a&gt;, and &lt;a href="https://www.cosmicjs.com/" rel="noopener noreferrer"&gt;Cosmic&lt;/a&gt;. Without further ado, grab some coffee &amp;amp; let's build a cool app!&lt;/p&gt;

&lt;h1&gt;
  
  
  TL;DR
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.cosmicjs.com/apps/blazor-cosmic-blog" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/cosmicjs/blazor-blog" rel="noopener noreferrer"&gt;Download Source Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Installed the latest  &lt;a href="https://dotnet.microsoft.com/download" rel="noopener noreferrer"&gt;.NET Core SDK&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;Install the Blazor project templates&lt;/li&gt;
&lt;li&gt;Cosmic account&lt;/li&gt;
&lt;li&gt;Basic knowledge of Blazor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's get started with our technology stack. &lt;/p&gt;

&lt;h1&gt;
  
  
  What is Blazor?
&lt;/h1&gt;

&lt;p&gt;Blazor is a .NET framework developed and maintained by Microsoft. It's been picking up steam over the last couple of years, and recently attracted quite a bit of attention in Spring of 2020 with the launch of Blazor WebAssembly - which is what we'll be using today. If you want to build an interactive web application using C# then you should definitely check Blazor.&lt;/p&gt;

&lt;p&gt;According to Blazor's &lt;a href="https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor" rel="noopener noreferrer"&gt;docs&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Blazor is a free and open-source web framework that enables developers to create web apps using C# and   HTML. It is being developed by Microsoft. Blazor lets you build interactive web UIs using C# instead of JavaScript. Blazor apps are composed of reusable web UI components implemented using C#, HTML, and CSS. Both client and server code is written in C#, allowing you to share code and libraries. Blazor can run your client-side C# code directly in the browser, using WebAssembly. Because it's real .NET running on WebAssembly, you can re-use code and libraries from server-side parts of your application.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are two ways to create Blazor apps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Blazor Server&lt;/li&gt;
&lt;li&gt;Blazor WebAssembly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So in this article, we are going to use Blazor WebAssembly - which is one way to host Blazor components client-side in the browser using a WebAssembly-based .NET runtime.&lt;/p&gt;

&lt;h1&gt;
  
  
  What about Cosmic?
&lt;/h1&gt;

&lt;p&gt;Cosmic is a headless CMS that will enable us to build our application surprisingly quickly and deploy it to Netlifly in moments. Unlike traditional CMS, Cosmic offers us as the developers a lot of flexibility to develop this application how we please and take it to whatever hosting platform we wish. It is also very easy to store and retrieve data, which makes it perfect for building apps like this.&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating Your Blog Bucket in Cosmic
&lt;/h1&gt;

&lt;p&gt;To create a blog app we will require data. To manage and manipulate this data, we will be using the power of Cosmic buckets and objects. To get started:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a &lt;a href="https://app.cosmicjs.com/signup" rel="noopener noreferrer"&gt;free account on Cosmic&lt;/a&gt;. If this is your first time using Cosmic, you'll see a short tutorial which will introduce some of the data types we'll be using - buckets, objects, and metafields.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a new empty bucket &amp;amp; name it blazor-blog. For each blog post, we will have three object types:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Title&lt;/li&gt;
&lt;li&gt;Content&lt;/li&gt;
&lt;li&gt;Image&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, go ahead and add these properties in your buckets along with some data for those objects. &lt;a href="https://www.cosmicjs.com/getting-started" rel="noopener noreferrer"&gt;If you're having trouble with Buckets, Objects, or Metafields, go ahead and read the Getting Started page really quickly for some startup instructions&lt;/a&gt;, then come on back to this article.&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating Your Blazor WebAssembly app
&lt;/h1&gt;

&lt;p&gt;You can now create and run your first Blazor WebAssembly app by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet new blazorwasm -o BlazorCosmicBlog --pwa
cd BlazorCosmicBlog
dotnet run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now open the &lt;a href="https://localhost:44346/" rel="noopener noreferrer"&gt;https://localhost:44346/&lt;/a&gt;  to see the default blazor app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnlzfl9h4kccgrzs2yeqp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnlzfl9h4kccgrzs2yeqp.PNG" alt="new-app" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To fetch blog posts saved in Cosmic we require a Cosmic bucket Slug. Go to Cosmic -&amp;gt; Bucket -&amp;gt; Settings -&amp;gt; Basic Settings and copy the &lt;strong&gt;Bucket Slug&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiptt93or1fjqmhq1lvxf.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiptt93or1fjqmhq1lvxf.PNG" alt="api" width="800" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To store the slug, create a new file &lt;strong&gt;appsettings.josn&lt;/strong&gt; in the &lt;strong&gt;wwwroot&lt;/strong&gt; folder and add the below code:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Now open the program.cs file and add the below code to load the appsettings.json file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We are using Tailwind CSS to style our application, so let's add CDN into the index.html file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;link&lt;/span&gt; &lt;span class="nt"&gt;https&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="nt"&gt;unpkg&lt;/span&gt;&lt;span class="nc"&gt;.com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nt"&gt;tailwindcss&lt;/span&gt;&lt;span class="o"&gt;@^&lt;/span&gt;&lt;span class="err"&gt;1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nt"&gt;dist&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nt"&gt;tailwind&lt;/span&gt;&lt;span class="nc"&gt;.min.css&lt;/span&gt;&lt;span class="s1"&gt;" rel="&lt;/span&gt;&lt;span class="nt"&gt;stylesheet&lt;/span&gt;&lt;span class="err"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h1&gt;
  
  
  Building Our Blog Pages
&lt;/h1&gt;

&lt;p&gt;First, we are building the main category page where we can show all the blog posts. Create a folder called Models and add class to store posts.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Go to &lt;strong&gt;Pages&lt;/strong&gt; folder and open &lt;strong&gt;Index.razor&lt;/strong&gt; component and add the below code to show list of posts fetching from Cosmic.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Let's run the app to see the output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqfb7iesnefsojl49i2bp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqfb7iesnefsojl49i2bp.PNG" alt="index" width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking good! Create a new component into the Pages folder called &lt;strong&gt;PostDetails.razor&lt;/strong&gt; which shows the details of posts when we click on &lt;strong&gt;Read More&lt;/strong&gt; button from all post pages.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Now run the app and click on Read More button from the Home page to see post details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdtg8dwh9og64qt88r370.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdtg8dwh9og64qt88r370.PNG" alt="post-details" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it! All our core features are working. We have successfully created a blog application using Blazor and Cosmic. Now it's just up to your content team members to add some blog posts to it.&lt;/p&gt;

&lt;h1&gt;
  
  
  Deploying Your Blazor Blog to Hosting Platforms
&lt;/h1&gt;

&lt;p&gt;We can now deploy our application on any hosting platform. We are deploying our app on &lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt; using Github Actions. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Commit your code to the GitHub repository.&lt;/li&gt;
&lt;li&gt;Login to Netlify and create a new site. &lt;/li&gt;
&lt;li&gt;We need a Personal Access Token and Site Id to deploy our app to netlify. So Go to Profile and generate Personal Access Token.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzdq05etr9rtgen2pr2y.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzdq05etr9rtgen2pr2y.PNG" alt="netlify1" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to your site -&amp;gt; Site details&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxseh7d210k228f8n2s4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxseh7d210k228f8n2s4.PNG" alt="netlify2" width="800" height="496"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to your repository Settings -&amp;gt; Secrets and above two secrets:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2ubqq5pu96klcusbkao.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2ubqq5pu96klcusbkao.PNG" alt="netlify3" width="800" height="298"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on Actions -&amp;gt; New Workflow and select .NET Core template. After that add the below code to yml file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Our blog app is successfully deployed to Netlify.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fayzv1kiaxfc5e5fmtw4h.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fayzv1kiaxfc5e5fmtw4h.gif" alt="netlify4" width="600" height="288"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this article, I have demonstrated you how to create a blogging application using Blazor and Cosmic. The Cosmic Community has a lot of examples on how to handle integration with email functions, download functions, and third-party platforms. If you're interested in building your own applications like this, &lt;a href="https://app.cosmicjs.com/signup" rel="noopener noreferrer"&gt;get started by setting up your free account&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this little app, and please do not hesitate to send me your thoughts or comments about what could I have done better.&lt;/p&gt;

&lt;p&gt;If you have any comments or questions about building apps with Cosmic, &lt;a href="https://twitter.com/cosmicjs" rel="noopener noreferrer"&gt;reach out to us on Twitter&lt;/a&gt; and &lt;a href="https://www.cosmicjs.com/community" rel="noopener noreferrer"&gt;join the conversation on Slack&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>blazor</category>
      <category>cosmicjs</category>
      <category>webdev</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Deploy a Docusaurus App on Azure Static Web Apps</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Sat, 15 Aug 2020 13:04:44 +0000</pubDate>
      <link>https://dev.to/sumitkharche/deploy-a-docusaurus-app-on-azure-static-web-apps-2dpj</link>
      <guid>https://dev.to/sumitkharche/deploy-a-docusaurus-app-on-azure-static-web-apps-2dpj</guid>
      <description>&lt;p&gt;In this article, we are going to build a simple app using &lt;a href="https://docusaurus.io/en/" rel="noopener noreferrer"&gt;Docusaurus&lt;/a&gt; and deploying the application to &lt;a href="https://azure.microsoft.com/en-in/services/app-service/static/" rel="noopener noreferrer"&gt;Azure Static Web App&lt;/a&gt;. So please grab a cup of coffee and start learning.&lt;/p&gt;

&lt;h4&gt;
  
  
  Table of Content
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;What is Docusaurus?&lt;/li&gt;
&lt;li&gt;What is Azure Static Web App?&lt;/li&gt;
&lt;li&gt;Build a simple app using Docusaurus&lt;/li&gt;
&lt;li&gt;Deploy app into Azure Static Web App&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  What is Docusaurus?
&lt;/h1&gt;

&lt;p&gt;Do you want to create great documentation for your project then Docusaurus is best option for building a documentation websites.  It uses Markdown for documentation. Docusaurus is built using React so you can always customize the website as you want. It also supports Localization and document versioning. &lt;/p&gt;

&lt;h1&gt;
  
  
  What is Azure Static Web App?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-in/azure/static-web-apps/" rel="noopener noreferrer"&gt;Azure Static Web App&lt;/a&gt; is first launched as a preview in &lt;a href="https://mybuild.microsoft.com/home" rel="noopener noreferrer"&gt;Microsoft Build 2020&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;According to Azure Static Web App &lt;a href="https://docs.microsoft.com/en-in/azure/static-web-apps/overview" rel="noopener noreferrer"&gt;doc&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Azure Static Web Apps is a service that automatically builds and deploys full stack web apps to Azure from a GitHub repository.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With Azure Static Web App you can deploy any static application which is build using any Javascript framework or library or SSG. It uses Github actions to do the deployment out of the box. We can also host Azure function with the same application. Microsoft has created very good documentation so you can read more about Azure Static Web App &lt;a href="https://docs.microsoft.com/en-in/azure/static-web-apps/overview" rel="noopener noreferrer"&gt;here&lt;/a&gt;.  Currently, Azure Static Web Apps are in preview. We can learn how to create Azure Static web app resources and how to configure our app deployed later in the article.&lt;/p&gt;

&lt;p&gt;The azure static web app uses Github actions to do a deployment of the application. We have to just create Azure static web app resource and set up our application such as the location of the folder after prod build of our app, default app directory,  if you any custom build command then you can also specify. Once you provide all the data and create resource then Azure static web app create a github action workflow into our repository and deploy our application. So after that every time you push commits or accept pull requests into the watched branch, the GitHub Action automatically builds and deploys your app and its API to Azure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Free SSL certificates&lt;/li&gt;
&lt;li&gt;It has the support of Azure Functions for adding some dynamic content into our app.&lt;/li&gt;
&lt;li&gt;All the static content is globally distributed &lt;/li&gt;
&lt;li&gt;It also provides 1 pre-production i.e. staging environment to preview our changes before pushing to production. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can read more features &lt;a href="https://docs.microsoft.com/en-in/azure/static-web-apps/overview#key-features" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Build a simple app using Docusaurus
&lt;/h1&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;You need to have installed the latest stable version of Node JS and NPM. You can also install Yarn as well.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Install Docusaurus cli using below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --global docusaurus-init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn global add docusaurus-init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create a folder for our app &lt;code&gt;docusaurus-swa-app&lt;/code&gt; and navigate inside that into folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; mkdir docusaurus-swa-app
 cd docusaurus-swa-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now run the below command to create Docusaurus app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docusaurus-init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After completion of the above step, the docusaurus installation script creates two new directories: docs and website.&lt;/p&gt;

&lt;p&gt;To run the app navigate to &lt;code&gt;website&lt;/code&gt; folder and run below command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;code&gt;http://localhost:3000&lt;/code&gt; to see the basic app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fte13sdfnfdf63naqtnw0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fte13sdfnfdf63naqtnw0.png" alt="docusaurus-local-1.PNG" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open the &lt;code&gt;package.json&lt;/code&gt; file under website folder add dependencies section as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "scripts": {
    "examples": "docusaurus-examples",
    "start": "docusaurus-start",
    "build": "docusaurus-build",
    "publish-gh-pages": "docusaurus-publish",
    "write-translations": "docusaurus-write-translations",
    "version": "docusaurus-version",
    "rename-version": "docusaurus-rename-version"
  },
 "dependencies": {
    "docusaurus": "^1.14.6"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So we have created our app successfully, next step is to push the code to Github.&lt;/p&gt;

&lt;p&gt;Login to &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and create new repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixt52jrj7j6tq03geizu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixt52jrj7j6tq03geizu.png" alt="github-2.PNG" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow the below steps for commit and push the project into Git.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
git add .
git commit -m "first commit"
git remote add origin &amp;lt;your repo address&amp;gt;
git push -u origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Deploy app into Azure Static Web App
&lt;/h1&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;An Azure account with an active subscription. If you don't have one, you can &lt;a href="https://azure.microsoft.com/free/" rel="noopener noreferrer"&gt;create an account for free&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the &lt;a href="https://portal.azure.com" rel="noopener noreferrer"&gt;Azure portal&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create a Resource&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Search for &lt;strong&gt;Static Web Apps&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Static Web Apps (Preview)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For &lt;em&gt;Subscription&lt;/em&gt;, accept the subscription that is listed or select a new one from the drop-down list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In &lt;em&gt;Resource group&lt;/em&gt;, select &lt;strong&gt;New&lt;/strong&gt;. In &lt;em&gt;New resource group name&lt;/em&gt;, enter &lt;strong&gt;docusaurus-swa-app&lt;/strong&gt; and select &lt;strong&gt;OK&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, a name for your app in the &lt;strong&gt;Name&lt;/strong&gt; box. Valid characters include &lt;code&gt;a-z&lt;/code&gt;, &lt;code&gt;A-Z&lt;/code&gt;, &lt;code&gt;0-9&lt;/code&gt; and &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For &lt;em&gt;Region&lt;/em&gt;, select an available region close to you.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For &lt;em&gt;SKU&lt;/em&gt;, select &lt;strong&gt;Free&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17kldwszyw9k24yl9udf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F17kldwszyw9k24yl9udf.png" alt="basic-app-details.PNG" width="696" height="706"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click the &lt;strong&gt;Sign in with GitHub&lt;/strong&gt; button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the &lt;strong&gt;Organization&lt;/strong&gt; under which you created the repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the &lt;strong&gt;docusaurus-swa-app&lt;/strong&gt; as the &lt;em&gt;Repository&lt;/em&gt; .&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For the &lt;em&gt;Branch&lt;/em&gt; select &lt;strong&gt;master&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuzwe6h4kncqudajic01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuzwe6h4kncqudajic01.png" alt="completed-github-info.PNG" width="684" height="645"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, add configuration settings that the build process uses to build your app.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click the &lt;strong&gt;Next: Build &amp;gt;&lt;/strong&gt; button to edit the build configuration&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To configure the settings of the step in GitHub Actions, set the &lt;em&gt;App location&lt;/em&gt; to &lt;strong&gt;/website&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set &lt;em&gt;App artifact location&lt;/em&gt; to &lt;strong&gt;build/test-site&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A value for &lt;em&gt;API location&lt;/em&gt; isn't necessary as you aren't deploying an API at the moment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkabmbseaudqcar6q2oit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkabmbseaudqcar6q2oit.png" alt="build-details-new.PNG" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click the &lt;strong&gt;Review + Create&lt;/strong&gt; button to verify the details are all correct.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Create&lt;/strong&gt; to start the creation of the App Service Static Web App and provision a GitHub Action for deployment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the deployment completes click, &lt;strong&gt;Go to resource&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On the resource screen, click the &lt;em&gt;URL&lt;/em&gt; link to open your deployed application. You may need to wait a minute or two for the GitHub Action to complete.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyl76vfiah7r3u3e80bgg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyl76vfiah7r3u3e80bgg.png" alt="portal-final-view.PNG" width="800" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixbjdayjfiitesk3hxg7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixbjdayjfiitesk3hxg7.png" alt="deployed-app.PNG" width="800" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it. We have successfully deployed our &lt;strong&gt;Docusaurus&lt;/strong&gt; on &lt;strong&gt;Azure Static Web App&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this article, We have created a basic app using &lt;strong&gt;Docusaurus&lt;/strong&gt;. We have also deployed the same application on &lt;strong&gt;Azure Static Web App&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this article, share it with friends and please do not hesitate to send me your thoughts or comments.&lt;/p&gt;

&lt;p&gt;You can reach out to me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Happy Coding!!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>javascript</category>
      <category>showdev</category>
      <category>staticwebapps</category>
    </item>
    <item>
      <title>Build Simple Blog using Angular + Scully + Materialize + Netlify</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Sat, 01 Aug 2020 16:35:40 +0000</pubDate>
      <link>https://dev.to/sumitkharche/build-simple-blog-using-angular-scully-materialize-netlify-23kf</link>
      <guid>https://dev.to/sumitkharche/build-simple-blog-using-angular-scully-materialize-netlify-23kf</guid>
      <description>&lt;p&gt;In this article, we are going to build a simple Blog application using &lt;a href="https://scully.io/" rel="noopener noreferrer"&gt;Scully&lt;/a&gt; and deploying the application to &lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt;. So please grab a cup of coffee and start learning.&lt;/p&gt;

&lt;h4&gt;
  
  
  Table of Content
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;What is Scully?&lt;/li&gt;
&lt;li&gt;What is Netlify?&lt;/li&gt;
&lt;li&gt;Build a blog using Scully&lt;/li&gt;
&lt;li&gt;Deploy blog into Netlify&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  TL;DR
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nifty-poitras-e7fdf5.netlify.app/blog" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/sumitkharche/scully-blog-swa" rel="noopener noreferrer"&gt;Download Source Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Scully?
&lt;/h1&gt;

&lt;p&gt;There are lots of libraries available for Static Site Generators like Gatsby, Gridsome, Hugo, etc. Scully is the first SSG for Angular applications. &lt;/p&gt;

&lt;p&gt;According Scully &lt;a href="https://scully.io/docs/Introduction/" rel="noopener noreferrer"&gt;doc&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Scully is the best static site generator for Angular projects looking to embrace the JAMStack.&lt;br&gt;
Under the hood, Scully analyzes an Angular application, and it generates a static version of it. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Scully uses a machine-learning algorithm that finds all routes in our application and generates static HTML files which then we can host it any CDN or web server. The best part of Scully is it has great support of Angular Schematics and due to this you just have to fire command to add Scully into your existing Angular application.&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Netlify?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt; is a next-generation web hosting platform that provides everything that you need to build fast, modern websites such as CI/CI, serverless functions, etc. I recommend deploying it on Netlify because it supports project structures like this and can quickly create deployments.&lt;/p&gt;

&lt;p&gt;Below are some of the benefits of Netlify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can create a free account for your projects.&lt;/li&gt;
&lt;li&gt;Very less pricing with lots of features. You can check pricing &lt;a href="https://www.netlify.com/pricing/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;Provides free SSL certificates and has built-i DNS managements.&lt;/li&gt;
&lt;li&gt;You want to store data then Netlify also has a &lt;a href="https://www.netlifycms.org/" rel="noopener noreferrer"&gt;Netlify CMS&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Build a blog using Scully
&lt;/h1&gt;

&lt;p&gt;Let's create a new angular application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ng&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;scully&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;blog&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;swa&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Select &lt;strong&gt;yes&lt;/strong&gt; for Angular routing and select &lt;strong&gt;CSS&lt;/strong&gt; for our stylesheet format.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd6e9x8tpi2pe8lx3i8xz.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd6e9x8tpi2pe8lx3i8xz.PNG" alt="angular-new-app" width="735" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the project generation completed the navigate to the project folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;cd&lt;/span&gt; &lt;span class="nx"&gt;scully&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;blog&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;swa&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So run the angular application by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ng&lt;/span&gt; &lt;span class="nx"&gt;serve&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;open&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see the application at &lt;code&gt;http://localhost:4200/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnirrg2vvkvdmovmkoqyw.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnirrg2vvkvdmovmkoqyw.PNG" alt="default-app" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are using &lt;a href="https://materializecss.com/" rel="noopener noreferrer"&gt;Materializecss&lt;/a&gt; for styling our application.&lt;/p&gt;

&lt;p&gt;To get started with Materializecss, open index.html and add below code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://fonts.googleapis.com/icon?family=Material+Icons"&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will start by creating the Navbar component. So run following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ng&lt;/span&gt; &lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="nx"&gt;components&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;navbar&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;code&gt;navbar.component.html&lt;/code&gt; and below code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"light-blue lighten-1"&lt;/span&gt; &lt;span class="na"&gt;role=&lt;/span&gt;&lt;span class="s"&gt;"navigation"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"nav-wrapper container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"logo-container"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"brand-logo"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Scully Blog&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"right hide-on-med-and-down"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;routerLink=&lt;/span&gt;&lt;span class="s"&gt;"/blog"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Blog&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;routerLink =&lt;/span&gt;&lt;span class="s"&gt;"/about"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;

      &lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"nav-mobile"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"sidenav"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;routerLink=&lt;/span&gt;&lt;span class="s"&gt;"/blog"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Blog&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;routerLink=&lt;/span&gt;&lt;span class="s"&gt;"/about"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above is a simple navbar component from Materializecss which you can get from the website.&lt;/p&gt;

&lt;p&gt;Delete html from &lt;code&gt;app.component.html&lt;/code&gt; and add &lt;code&gt;&amp;lt;app-navbar&amp;gt;&lt;/code&gt; the navbar component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;app-navbar&amp;gt;&amp;lt;/app-navbar&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;router-outlet&amp;gt;&amp;lt;/router-outlet&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to browser to see the Navbar:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh7u4xoyz5bmooq89t4d6.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh7u4xoyz5bmooq89t4d6.PNG" alt="navbar" width="800" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So integrate Scully into Angular application we have used below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng add @scullyio/init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have to build our app then run &lt;code&gt;npm run scully&lt;/code&gt; command so that  Scully knows which routes it has to scan and creates static pages  To make things simple we updated default build command in package.json as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; "build": "ng build &amp;amp;&amp;amp; npm run scully -- --scanRoutes",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Scully provides the below command to generate a blog.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng generate @scullyio/init:blog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4b487qnmjkmjr4584bc4.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4b487qnmjkmjr4584bc4.PNG" alt="scully-blog" width="685" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This command generates a blog folder into our app which stores markdown files and also creates a blog component that is responsible for rendering markdown content.&lt;/p&gt;

&lt;p&gt;To create posts we have to use below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng g @scullyio/init:post --name="What makes a truly unique Latte"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a markdown file in the blog folder. So using this command create a few posts and add markdown in it. In the markdown files, we have to make the published field true as we are not publishing draft posts.&lt;/p&gt;

&lt;p&gt;To show all our blogs we have to create a container component. So create a new component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng g c components/blog-container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;code&gt;blog-container.component.ts&lt;/code&gt; and add below code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;OnInit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@angular/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ScullyRoute&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ScullyRoutesService&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@scullyio/ng-lib&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Observable&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rxjs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rxjs/operators&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;app-blog-container&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;templateUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./blog-container.component.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;styleUrls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./blog-container.component.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BlogContainerComponent&lt;/span&gt; &lt;span class="kr"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;OnInit&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;scully&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ScullyRoutesService&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="nx"&gt;posts$&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Observable&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ScullyRoute&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;ngOnInit&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;posts$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;scully&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;available$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;routeList&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;routeList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="na"&gt;route&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ScullyRoute&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
            &lt;span class="nx"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;route&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`/blog/`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ScullyRoutesService gives us available posts i.e. published=true so we import as service and assign it to local posts variable.&lt;/p&gt;

&lt;p&gt;Open &lt;code&gt;blog-container.component.html&lt;/code&gt; and below code to render posts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"section no-pad-bot"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"index-banner"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"header center orange-text"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Scully Blog&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"row center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h5&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"header col s12 light"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;A simple coffee blog application&lt;span class="nt"&gt;&amp;lt;/h5&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"section"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"row"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;*ngFor=&lt;/span&gt;&lt;span class="s"&gt;"let post of posts$ | async"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"col s12 m6"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-image waves-effect waves-block waves-light"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"activator"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;{{post.image_url}}&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;                              
              &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-title activator grey-text text-darken-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{{post.title}}&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;[routerLink]=&lt;/span&gt;&lt;span class="s"&gt;"post.route"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Read More&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-reveal"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"card-title grey-text text-darken-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"material-icons right"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;close&lt;span class="nt"&gt;&amp;lt;/i&amp;gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;{{post.description}}&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add below code into &lt;code&gt;blog-routing.module.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    path:'',
    component: BlogContainerComponent
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open app-routing.module.ts and add below code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const routes: Routes = [
  {path: '', redirectTo:'blog',  pathMatch: 'full'},
  { path: 'blog', loadChildren: () =&amp;gt; import('./blog/blog.module').then(m =&amp;gt; m.BlogModule) }
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run the application hit below commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;after that run following command to serve Scully:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run scully:serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open browser to see the output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuq3eyg2kq5ah8c3vv11o.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuq3eyg2kq5ah8c3vv11o.PNG" alt="scully-container" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now click Read more button of any blog post and check the blog post content. It's not looking good so open blog-component.html and add below code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;
    &amp;lt;div class="section"&amp;gt;
        &amp;lt;div class="row"&amp;gt;
            &amp;lt;scully-content&amp;gt;&amp;lt;/scully-content&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and open blog-component.css and add below css:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;51&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;37&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;fit-content&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an about component and add some content in it and also include route into app-routing.module.ts&lt;/p&gt;

&lt;p&gt;Finally, run the app and see the output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7gtfg9ozggd7og6dttf3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7gtfg9ozggd7og6dttf3.PNG" alt="blog-app" width="800" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now push this new app into Git (you can choose other software development platforms like Gitlab, Bitbucket). Follow the below steps for commit and push the project into Git.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
git add .
git commit -m "first commit"
git remote add origin &amp;lt;your repo address&amp;gt;
git push -u origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So we have successfully created a Scully blog and also pushed source code into Git.&lt;/p&gt;

&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Deploy blog into Netlify
&lt;/h1&gt;

&lt;p&gt;Now we have created our Scully blog app in the previous step. Now its time to deploy it on Netlify. If you are not already a Netlify user, first go ahead and sign up for a free account &lt;a href="https://app.netlify.com/signup" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once you logged in, you will be redirected to &lt;a href="https://app.netlify.com/" rel="noopener noreferrer"&gt;https://app.netlify.com/&lt;/a&gt;. Follow the steps and link &amp;amp; authorize your Git account. Then you will see the &lt;strong&gt;New Site from Git&lt;/strong&gt; button. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Femsvouwqw2i7dnsqo6r7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Femsvouwqw2i7dnsqo6r7.png" alt="new-site-1.PNG" width="800" height="115"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the &lt;strong&gt;New Site for Git&lt;/strong&gt; button. You will see below screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypnlw8eef73e97v4h0q5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypnlw8eef73e97v4h0q5.png" alt="create-new-site.PNG" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under the Continuous Deployment section, select &lt;strong&gt;Github&lt;/strong&gt; option. After that search the repo that you have created in the previous step and click on it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx8tikfzh3veztqm8awt0.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx8tikfzh3veztqm8awt0.PNG" alt="Alt Text" width="800" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After selecting repo, you have to provide a build setting as shown in below image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd85h40kxzq0a6a0hovkb.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fd85h40kxzq0a6a0hovkb.PNG" alt="Alt Text" width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now click on &lt;strong&gt;Deploy Site&lt;/strong&gt; button to deploy the site on Netlify. Then wait for the build and deployment to complete. Once the deployment is done navigate to the URL to see the live app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5eq4bi3k085tye0ab9nr.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5eq4bi3k085tye0ab9nr.PNG" alt="Alt Text" width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this article, I have demonstrated to you how to create a blog application using Scully. We have also deployed the same application on Netlify.&lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this article, share it with friends and please do not hesitate to send me your thoughts or comments.&lt;/p&gt;

&lt;p&gt;You can reach out to me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Happy Coding!!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.netlify.com/blog/2019/12/17/building-an-angular-jamstack-app-with-scully/" rel="noopener noreferrer"&gt;Building an Angular Jamstack App with Scully&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://scully.io/docs/blog/" rel="noopener noreferrer"&gt;Scully docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://indepth.dev/scully-the-first-static-site-generator-for-angular/" rel="noopener noreferrer"&gt;Scully, the First Static Site Generator for Angular&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.netlify.com/blog/2020/07/14/creating-an-angular-jamstack-blog/" rel="noopener noreferrer"&gt;Creating an Angular Jamstack Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;Photo by &lt;a href="https://unsplash.com/@goumbik?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Lukas Blazek&lt;/a&gt; on &lt;a href="https://unsplash.com/?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>scully</category>
      <category>angular</category>
    </item>
    <item>
      <title>Getting Started with Azure Service Bus Queues &amp; ASP.NET Core - Part 1</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Fri, 17 Jul 2020 14:37:30 +0000</pubDate>
      <link>https://dev.to/sumitkharche/get-started-with-azure-service-bus-queues-asp-net-core-part-1-255l</link>
      <guid>https://dev.to/sumitkharche/get-started-with-azure-service-bus-queues-asp-net-core-part-1-255l</guid>
      <description>&lt;p&gt;In this article, we are going to discuss to about &lt;a href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview" rel="noopener noreferrer"&gt;Microsoft Azure Service Bus&lt;/a&gt; Queues. First, we will see what is Azure Service Bus and then discuss about queues. We are also going to build a simple application to send and receive message in queues using ASP.NET Core. So let’s grab a cup of coffee and start learning.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Azure Service Bus
&lt;/h1&gt;

&lt;p&gt;Azure Service Bus is message broker service which is hosted on Azure platform and it provides functionality to publish messages to various application and also decouple the applications.&lt;/p&gt;

&lt;p&gt;According to Microsoft &lt;a href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-overview" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Microsoft Azure Service Bus is a fully managed enterprise integration message broker. Service Bus can decouple applications and services. Service Bus offers a reliable and secure platform for asynchronous transfer of data and state.&lt;/p&gt;

&lt;p&gt;Data is transferred between different applications and services using messages. A message is in binary format and can contain JSON, XML, or just text.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Microsoft service bus comes in different flavors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Queues&lt;/li&gt;
&lt;li&gt;Topic (we will cover this in next articles) &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Azure Service Bus: Queues
&lt;/h1&gt;

&lt;p&gt;Queues follow First-In-First-Out (FIFO) pattern. Queues provide the one-way transport like the sender is going to send message in the queue and the receiver would collect messages from queue. In queues, there is a 1:1 relationship between the sender and receiver. Messages are present in queue until the receiver process and complete the messages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftivotkjmcunluvcg0fnm.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftivotkjmcunluvcg0fnm.PNG" alt="queue-dig" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The queue contains a secondary sub-queue, called a dead-letter queue (DLQ). Whenever we create a queue DLQ is automatically added in our main queue. When the messages are not delivered to the receiver or can not be processed by the receiver then such messages are pushed to DLQ.&lt;/p&gt;

&lt;p&gt;Now we have discussed enough regarding Queues so let's create queues in Azure and build a simple application to send and receive messages from the queue.&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating a simple application to send and receive messages from the queue.
&lt;/h1&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://portal.azure.com" rel="noopener noreferrer"&gt;Azure&lt;/a&gt; account(If you don't have an Azure subscription, &lt;a href="https://azure.microsoft.com/free" rel="noopener noreferrer"&gt;create a free trial account&lt;/a&gt;.)&lt;/li&gt;
&lt;li&gt;Basic knowledge of Asp.net Core Web API&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Overview of application
&lt;/h4&gt;

&lt;p&gt;We will be creating a simple application which consists of 3 parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create Azure Service Bus Queue using Azure Portal(Covering in this article)&lt;/li&gt;
&lt;li&gt;Create Web API to push the message into Queue(Covering in this article)&lt;/li&gt;
&lt;li&gt;Create a Background Service to receive a message from Queue(Covered in next article)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh6v77l1g5vu74ijwcahz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh6v77l1g5vu74ijwcahz.png" alt="App Structure" width="800" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Azure Service Bus Queue using Azure Portal
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Login to &lt;a href="https://portal.azure.com" rel="noopener noreferrer"&gt;Azure&lt;/a&gt; and click on &lt;strong&gt;Create a resource&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;In search box type &lt;em&gt;service bus&lt;/em&gt; and select it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkra38pensuduu2jvca3j.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkra38pensuduu2jvca3j.PNG" alt="service-bus-new" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;strong&gt;Create&lt;/strong&gt; button. You will see the Create Namespace page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqvy1g6osxg7w5j3ygkj5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqvy1g6osxg7w5j3ygkj5.PNG" alt="create-namespace-page" width="800" height="546"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Azure has Resource Groups(RG) which acts as a container for your resources. So now we are going to create a Service bus resource then first we need to create Resource Group. If you have already created RG then you can use the same here. Under Resource group click on Create New button and give unique RG name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyd7l8uqs4zi1hcre4nwa.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyd7l8uqs4zi1hcre4nwa.PNG" alt="new-rg" width="800" height="595"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now we have to specify the Namespace name. A namespace is a container for all messaging components. Multiple queues and topics can be in a single namespace, and namespaces often serve as application containers.&lt;/li&gt;
&lt;li&gt;Select the location.&lt;/li&gt;
&lt;li&gt;Select pricing tier. Azure provides 3 pricing tiers:
1 Basic
2 Standard
3 Premium&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb4sao64l9xq62h9jek8b.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb4sao64l9xq62h9jek8b.PNG" alt="pricing-tier" width="326" height="562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We have filled all details the click on &lt;strong&gt;Review + create&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7ds23czw9m25sug8nics.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7ds23czw9m25sug8nics.PNG" alt="all-filled" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Review everything added property and finally click on &lt;strong&gt;Create&lt;/strong&gt; button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fex28y2j2i4rl3mp3rlf1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fex28y2j2i4rl3mp3rlf1.PNG" alt="final-create" width="621" height="591"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating resources will take time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmhzy7o1p5v4mj6y8lo0h.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmhzy7o1p5v4mj6y8lo0h.PNG" alt="deployment-processing" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now our order queue is created successfully. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6xkqn5wlisnf3uusosfe.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6xkqn5wlisnf3uusosfe.PNG" alt="order-queue" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the Queues section in the left panel and click on Queue and give a unique name for queue and click on the Create button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqs1flm359yzmm66z967m.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqs1flm359yzmm66z967m.PNG" alt="create-queue" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Web API to push the message into Queue
&lt;/h2&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Prerequisites&lt;/em&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Visual Studio 19(if you are using .NET Core 3.1)&lt;/li&gt;
&lt;li&gt;.NET Core 3.1 SDK installed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First thing is to create a new ASP.NET Core Web API project. For those who are new to ASP.NET Core, I have listed down the steps to create a new Web API project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open Visual Studio and click on File -&amp;gt; New -&amp;gt; Project. Then select &lt;strong&gt;ASP.NET Core Web Application&lt;/strong&gt; and click on the Next button.&lt;/li&gt;
&lt;li&gt;Give the project name and click on &lt;strong&gt;Create&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;After that select &lt;strong&gt;API&lt;/strong&gt; and click on &lt;strong&gt;Create&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So now your ASP.NET Core Web API project is setup.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;First we need to install Azure Service Bus NuGet package:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkjkdpbbda8nbbl7tgz2a.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkjkdpbbda8nbbl7tgz2a.PNG" alt="asb-nuget" width="491" height="195"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new class called &lt;em&gt;Order.cs&lt;/em&gt; and add below properties:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;namespace Order.Web.API
{
    public class Order
    {
        public int Id { get; set; }
        public int Quantity { get; set; }
        public decimal Price { get; set; }
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To interact with Azure Service Bus &lt;em&gt;Microsoft.Azure.ServiceBus&lt;/em&gt; package provides called QueueClient which accepts queue connection string and queue name as input and returns the QueueClient object. First, we grab the connection string of Queue from Azure Portal. So open the queue and click on &lt;em&gt;Shared access policies&lt;/em&gt; then select RootManageSharedAccessKey and copy it into appsettings.json file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ff99cq1x0939njdwzlvv1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ff99cq1x0939njdwzlvv1.PNG" alt="connection-string" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;appsettings.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "QueueConnectionString": "&amp;lt;replace your RootManageSharedAccessKey here&amp;gt;",
  "QueueName":  "order-queue",
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a new controller called &lt;em&gt;OrdersController&lt;/em&gt; and add below code to push message into queue:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.ServiceBus;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;

namespace Order.Web.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class OrdersController : ControllerBase
    {
        private readonly IConfiguration _configuration;

        public OrdersController(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        [HttpPost]
        public async Task&amp;lt;IActionResult&amp;gt; CreateOrderAsync([FromBody] Order order)
        {
            IQueueClient queueClient = new QueueClient(_configuration["QueueConnectionString"], _configuration["QueueName"]);
            var orderJSON = JsonConvert.SerializeObject(order);
            var orderMessage = new Message(Encoding.UTF8.GetBytes(orderJSON))
            {
                MessageId = Guid.NewGuid().ToString(),
                ContentType = "application/json"
            };
            await queueClient.SendAsync(orderMessage).ConfigureAwait(false);

            return Ok("Create order message has been successfully pushed to queue");
        }
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;So we have created QueueClient object and then we created Message. We used SendAsync() method to push message to the queue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We are testing this using postman. Run the app and hit post API to push order into Queue.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftukkc0gsvhzdlmgs0w1r.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftukkc0gsvhzdlmgs0w1r.PNG" alt="postman" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After a successful POST call let's go to Azure Portal and see if the message is pushed to the queue. So we have 1 active message in the queue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnrg8ilmx8804l9tkkrnt.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnrg8ilmx8804l9tkkrnt.PNG" alt="queue-message" width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this Part 1 of the Azure Service Bus Queue series, we have learned how to create a queue through Azure Portal and also we have created a Web API that pushes a message to the Queue. In Part 2 we will create a Background Service which will read messages from the Queue. &lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this article, share it with friends and please do not hesitate to send me your thoughts or comments.&lt;/p&gt;

&lt;p&gt;You can follow me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding!!&lt;/p&gt;

</description>
      <category>azure</category>
      <category>dotnet</category>
      <category>serverless</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Build a simple Todo App using Microsoft Fluent UI React</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Mon, 11 May 2020 14:51:20 +0000</pubDate>
      <link>https://dev.to/sumitkharche/build-a-simple-todo-app-using-microsoft-fluent-ui-react-4f7l</link>
      <guid>https://dev.to/sumitkharche/build-a-simple-todo-app-using-microsoft-fluent-ui-react-4f7l</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article was originally published &lt;a href="https://www.c-sharpcorner.com/article/build-a-simple-todo-app-using-microsoft-fluent-ui-react/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the second article in the Fluent UI React series. In this article, we will be creating a simple Todo application using React JS and Fluent UI React library. We will be exploring so many Fluent UI components like Stack, Dialog, etc. So let's grab a cup of coffee and start coding.&lt;/p&gt;

&lt;h1&gt;
  
  
  TL;DR
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://fluent-ui-todo-app.netlify.app/" rel="noopener noreferrer"&gt;Live App&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/sumitkharche/fluent-ui-todo-app" rel="noopener noreferrer"&gt;Source Code&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;p&gt;You need to have installed the latest stable version of &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node JS&lt;/a&gt; and NPM. You will easily understand the following tutorial if you have a basic understanding of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTML, CSS, and JavaScript&lt;/li&gt;
&lt;li&gt;React, Hooks &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you don't know about Microsoft Fluent UI you can check out below article:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/sumitkharche" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F107662%2F4ca21131-63e3-4852-a721-709670151a11.jpeg" alt="sumitkharche"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/sumitkharche/getting-started-with-microsoft-fluent-ui-react-23ae" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Getting started with Microsoft Fluent UI React&lt;/h2&gt;
      &lt;h3&gt;Sumit Kharche ・ May 7 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;h1&gt;
  
  
  Building Todo Application
&lt;/h1&gt;

&lt;h4&gt;
  
  
  1. Create new React App
&lt;/h4&gt;

&lt;p&gt;We will be using the Create React App tool to create our React app. So let's run below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app fluent-ui-todo-app --typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  2. Integrate Fluent UI React into App
&lt;/h4&gt;

&lt;p&gt;Now once the app is successfully created then the next step is to install Fluent React into our app.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd fluent-ui-todo-app
npm i @fluentui/react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  3. Building components for App
&lt;/h4&gt;

&lt;p&gt;We will be creating a simple todo application where we can add new todo and delete the existing todos. So we know that everything in React is component so we will be dividing our todo app into 3 components i.e AddTodo, TodoList, TodoItem. The great thing is we will using different Fluent UI components while creating these components. &lt;/p&gt;

&lt;p&gt;To enable Fluent UI style we have to add Fabric component from Fluent UI library so open &lt;code&gt;index.tsx&lt;/code&gt; file and add below code:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;To organizing our components, we are going to use Stack Utility of Fluent UI. According to &lt;a href="https://developer.microsoft.com/en-us/fluentui#/controls/web/stack" rel="noopener noreferrer"&gt;doc&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A Stack is a container-type component that abstracts the implementation of a flexbox in order to define the layout of its children components.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Stack is based on flexbox so we can control:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Direction: By adding &lt;code&gt;vertical&lt;/code&gt; or &lt;code&gt;horizontal&lt;/code&gt; properties,&lt;/li&gt;
&lt;li&gt;Alignment: using &lt;code&gt;verticalAlign&lt;/code&gt; and &lt;code&gt;horizontalAlign&lt;/code&gt; properties,&lt;/li&gt;
&lt;li&gt;Spacing: by adding &lt;code&gt;gap&lt;/code&gt; and &lt;code&gt;verticleGap&lt;/code&gt; properties.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So open &lt;code&gt;App.tsx&lt;/code&gt; file add below code:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Add below class into App.css file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;480px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We will start by displaying the todo list. First, we will use &lt;code&gt;useState()&lt;/code&gt; hook to in the App component which stores an initial list of Todos. So add below line App component:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setTodos&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Todo Item 1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Todo Item 2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now next step is to display this Todo list. So to do this create 2 components TodoItem for single todo and TodoList which uses the TodoItem component to display all the todos by using the &lt;code&gt;map()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;Create TodoItem component add below code:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;So here we have used &lt;code&gt;Stack&lt;/code&gt; for organizing the Todo and &lt;code&gt;Label&lt;/code&gt; to show the todo name from &lt;code&gt;@fluentui/react&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Create TodoList component add below code:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Now we have to import the TodoList component into App component and pass the todos present in the App component state as props to TodoList.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;So run the app and you will see the Todo's list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flelvwp87v5v2xsqujm7c.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flelvwp87v5v2xsqujm7c.PNG" alt="todo-list-1" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So the next step is to add new todo functionality. Create a new component called AddTodo which has one input field and one button. On the button click to call a function in props to add todo.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Here we have used &lt;code&gt;TextField&lt;/code&gt;component to display an input field and &lt;code&gt;PrimaryButton&lt;/code&gt; for displaying button from &lt;code&gt;@fluentui/react&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Create a new function in App component for adding todo into state and pass it to AddTodo function in props.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fol8apzrd54gr0jt7gk08.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fol8apzrd54gr0jt7gk08.gif" alt="add-todo" width="344" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Final step is to delete the todo in the list. So first add deleteTodo function in the App component as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;deleteTodo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newTasks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;todos&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;todo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;todo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nf"&gt;setTodos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newTasks&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and pass this function to TodoList component:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="wrapper"&amp;gt;
      &amp;lt;Stack horizontalAlign="center"&amp;gt;
        &amp;lt;h1&amp;gt;Todo App using Fluent UI &amp;amp; React&amp;lt;/h1&amp;gt;
        &amp;lt;Stack style={{ width: 300 }} gap={25}&amp;gt;
          &amp;lt;AddTodo addTodo={addTodo} /&amp;gt;
          &amp;lt;TodoList todos={todos} deleteTodo={deleteTodo} /&amp;gt;
        &amp;lt;/Stack&amp;gt;
      &amp;lt;/Stack&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Again from TodoList component pass this deleteTodo function TodoItem component:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;TodoItem todo={todo} key={todo.id} deleteTodo={props.deleteTodo} /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We will be using IconButton for showing delete button for each todo and also using Dialog Compnent to ask user before deleting todo. So deleteTodo component is looks like this:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Maintain a state of dialog like when to open and when to close by using useState() hook. You can check more properties about Dialog &lt;a href="https://developer.microsoft.com/en-us/fluentui#/controls/web/dialog" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To enable icons we have to import &lt;code&gt;initializeIcons&lt;/code&gt; from Fluent UI and call &lt;code&gt;initializeIcons()&lt;/code&gt; method so open index.tsx and &lt;code&gt;initializeIcons&lt;/code&gt; in it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { Fabric, initializeIcons } from "@fluentui/react";

initializeIcons();

ReactDOM.render(
  &amp;lt;React.StrictMode&amp;gt;
    &amp;lt;Fabric&amp;gt;
      &amp;lt;App /&amp;gt;
    &amp;lt;/Fabric&amp;gt;
  &amp;lt;/React.StrictMode&amp;gt;,
  document.getElementById('root')
);

serviceWorker.unregister();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzvc20sgv79r8w46dh7ep.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzvc20sgv79r8w46dh7ep.gif" alt="Final app" width="600" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Deploy it
&lt;/h1&gt;

&lt;p&gt;We can now deploy our application on any hosting platform. I recommend deploying it on &lt;a href="https://www.netlify.com/" rel="noopener noreferrer"&gt;Netlify&lt;/a&gt; because it supports project structures like this and can quickly create deployments. You can deploy application on &lt;a href="https://zeit.co/now" rel="noopener noreferrer"&gt;Now&lt;/a&gt; or &lt;a href="https://surge.sh/" rel="noopener noreferrer"&gt;Surge&lt;/a&gt; also. &lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this article, I have demonstrated to you how to create a Todo application using Fluent UI React. We have also used a few Fluent UI React components like Stack, Dialog, PrimaryButton, Label, TextField.&lt;/p&gt;

&lt;p&gt;I really hope that you enjoyed this little app, and please do not hesitate to send me your thoughts or comments about what could I have done better.&lt;/p&gt;

&lt;p&gt;You can reach out to me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding!! &lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>showdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Getting started with Microsoft Fluent UI React</title>
      <dc:creator>Sumit Kharche</dc:creator>
      <pubDate>Thu, 07 May 2020 14:15:57 +0000</pubDate>
      <link>https://dev.to/sumitkharche/getting-started-with-microsoft-fluent-ui-react-23ae</link>
      <guid>https://dev.to/sumitkharche/getting-started-with-microsoft-fluent-ui-react-23ae</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This article was originally published &lt;a href="https://www.c-sharpcorner.com/article/getting-started-with-microsoft-fluent-ui-react/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Have you ever wanted to create User Interface similar to Microsoft products? Have you heard about Microsoft Fluent UI? In this article, we will see what is Fluent UI and how to integrate it in React application.&lt;/p&gt;

&lt;p&gt;To create great user experience is never easy task. So most of times user UI frameworks will reduce the time and increase productivity. We know that all the products of Google same uses a design system known as Material Design. So there are bunch of other systems are available like Semantic UI, Ant Design, etc. So when we see the Microsoft products like Outlook, Azure, Azure Devops,etc they all are very good and UI is consistent as well. So Microsoft team create a design system called &lt;a href="https://www.microsoft.com/design/fluent/#/" rel="noopener noreferrer"&gt;Fluent Design System&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Microsoft Fluent Design System?
&lt;/h2&gt;

&lt;p&gt;According to Microsoft &lt;a href="https://www.microsoft.com/design/fluent/#/" rel="noopener noreferrer"&gt;doc&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fluent brings the fundamentals of principled design, innovation in technology, and customer needs together as one. It’s a collective approach to creating simplicity and coherence through a shared, open design system across platforms.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Fluent Design System is a whole ecosystem consisting number of components, tools that helps users to create great user experiences in all the platform like Web, Mobile, Desktop applications. In this article, we will see more about Fluent UI for Web. So Fluent UI for the web is available in two flavors: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fluent UI React &lt;/li&gt;
&lt;li&gt;Fabric Core&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Fabric Core
&lt;/h2&gt;

&lt;p&gt;When we think of other CSS libraries like Bootstrap you can find lots of similarities in Fabric core. When you wanted to match look and feel of your application similar to Microsoft products you may think of like what font family and font sizes need to use and all these you have to do manually. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fabric Core is an open-source collection of CSS classes and Sass mixins that give you access to colors, animations, fonts, icons and grid.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Fabric Core provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fonts and typography&lt;/li&gt;
&lt;li&gt;Color palettes&lt;/li&gt;
&lt;li&gt;Layout helpers&lt;/li&gt;
&lt;li&gt;Animation helpers&lt;/li&gt;
&lt;li&gt;Icons&lt;/li&gt;
&lt;li&gt;etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fabric Core is basically useful for non-React applications and static pages.&lt;br&gt;
To know more about it you can see the documentation &lt;a href="https://developer.microsoft.com/en-us/fluentui#/get-started/web#fabric-core" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Fluent UI React
&lt;/h2&gt;

&lt;p&gt;According to &lt;a href="https://developer.microsoft.com/en-us/fluentui#/get-started/web" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fluent UI React is the official open-source React front-end framework designed to build experiences that fit seamlessly into a broad range of Microsoft products. It provides robust, up-to-date, accessible components which are highly customizable using CSS-in-JS. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Fluent UI React contains React JS UI controls. It has same sets of controls and offerings that many similar libraries gives you things like Buttons, Dropdowns, Grids, Checkbox, etc and standard components. It also contains Microsoft controls as well like Datepickers, People pickers, persona, etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4gbi52fyf12upv57q0ea.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4gbi52fyf12upv57q0ea.PNG" alt="UI Controls" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some of the Microsoft products uses Fluent UI React.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7olymgyi5k99apiym2tm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7olymgyi5k99apiym2tm.png" alt="ui-products" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;45 additional Microsoft sites and products&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can checkout the github repo &lt;a href="https://github.com/microsoft/fluentui" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating new Fluent UI React project
&lt;/h2&gt;

&lt;p&gt;The most common way of creating React app is to use Create React App a development pack create by React team.&lt;/p&gt;

&lt;p&gt;Create a new React project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; npx create-react-app fluent-ui-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once application is created we can run below command to add Fluent UI dependency:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd fluent-ui-demo
npm i @fluentui/react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;Another way is that Microsoft created a starter repo which has same structure as Create React App.&lt;/p&gt;

&lt;p&gt;So clone the &lt;a href="https://github.com/microsoft/create-react-app-uifabric" rel="noopener noreferrer"&gt;starter repo&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/microsoft/create-react-app-uifabric.git fluent-ui-demo
cd fluent-ui-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install dependencies and start the app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open the App.js file and import a primary button from @Fluentui/react&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PrimaryButton&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@fluentui/react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App-header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;PrimaryButton&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/PrimaryButton&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the app to see output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbn5ocg1w2kjqmwwo4tsa.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbn5ocg1w2kjqmwwo4tsa.PNG" alt="Alt Text" width="800" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is just an introductory article. In the next article we will be creating simple Todo application using Fluent UI React.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, I have explained Microsoft Fluent Design System and discuss about Fluent UI React. Also, I demonstrated how to add Fluent UI React library to application. I really hope that you enjoyed this article, share it with friends and please do not hesitate to send me your thoughts or comments.&lt;/p&gt;

&lt;p&gt;You can follow me on twitter &lt;a href="https://twitter.com/sumitkharche01" rel="noopener noreferrer"&gt;@sumitkharche01&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Coding!! &lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
