<?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>Forem: Parveen Singh</title>
    <description>The latest articles on Forem by Parveen Singh (@parveensingh).</description>
    <link>https://forem.com/parveensingh</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%2F292201%2Fee644283-c4cc-41fd-a7ab-8410fe68d2a1.jpg</url>
      <title>Forem: Parveen Singh</title>
      <link>https://forem.com/parveensingh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/parveensingh"/>
    <language>en</language>
    <item>
      <title>Azure Cosmos DB Partitions &amp; Partition Keys Simplified</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Fri, 16 Jul 2021 17:00:00 +0000</pubDate>
      <link>https://forem.com/parveensingh/azure-cosmos-db-partitions-partition-keys-simplified-1g3p</link>
      <guid>https://forem.com/parveensingh/azure-cosmos-db-partitions-partition-keys-simplified-1g3p</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mT4CTyRs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/Cosmos-PartitionKey.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mT4CTyRs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/Cosmos-PartitionKey.jpg" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Performance and speed are crucial to the processing of any application running heavier or light workloads. The most significant impact any service can make on the application is the database queries. The latency to read, write and update the data in real-time can affect how the application performs its operation and how quickly it does that.&lt;/p&gt;

&lt;p&gt;While working on an application design, you often seek certain functionality in services to be used by the application, such as high availability, data consistency, strong throughput, scalability, and robust disaster recovery solution. The most important thing is that all of those benefits shouldn't come at the cost of the application's performance.&lt;/p&gt;

&lt;p&gt;In this article, you'll understand the concept of partition keys and the key concept involved in choosing the right partition key for your dataset.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Cosmos DB Partition Keys Overview&lt;/li&gt;
&lt;li&gt;What are Containers in Cosmos DB&lt;/li&gt;
&lt;li&gt;Logical Partitions in Cosmos DB&lt;/li&gt;
&lt;li&gt;Physical Partitions in Cosmos DB&lt;/li&gt;
&lt;li&gt;Replica Sets in Cosmos DB&lt;/li&gt;
&lt;li&gt;Choosing the Right Partition Keys for Cosmos DB Account&lt;/li&gt;
&lt;li&gt;Creating Cosmos DB Container with Partition Key using Azure Portal&lt;/li&gt;
&lt;li&gt;Creating Cosmos DB Container with Partition Key using Azure CLI&lt;/li&gt;
&lt;li&gt;Creating Cosmos DB Container with Partition Key using Azure PowerShell&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Cosmos DB Partition Keys Overview
&lt;/h2&gt;

&lt;p&gt;Azure Cosmos DB is designed to be used and operate for any size of workloads without any special configuration required to adapt to workload changes. That's all possible due to its scalable nature, and most importantly, the scalability is all taken care of under the hood by the Azure team so that you can spend more time writing efficient code and queries to interact with your data.&lt;/p&gt;

&lt;p&gt;In terms of writing efficient queries, Cosmos DB allows you to group a set of items or data in your collection by a similar property determined by the &lt;strong&gt;partition key&lt;/strong&gt;. Partition keys are the core element to distributing your data efficiently into different logical and physical sets so that the queries performed against the database are completed as quickly as possible.&lt;/p&gt;

&lt;p&gt;It is essential to choose the partition key during the design phase of the applications as you cannot change the partition key once the container is created.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Containers in Cosmos DB
&lt;/h2&gt;

&lt;p&gt;Before starting to unwrap the partitions, it is essential to understand what containers are in CosmosDB. As of today, Cosmos DB offers three types of containers: collection, tables, and graphs. If you wish to learn more about these types, check out the &lt;a href="https://parveensingh.com/azure-cosmos-db-basics/"&gt;first article in the series here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The containers are logical resources that groups one or more physical partitions of the data and necessary building blocks of Cosmos DB structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logical Partitions in Cosmos DB
&lt;/h2&gt;

&lt;p&gt;Grouping of items or documents with the same partition key forms a &lt;em&gt;logical partition&lt;/em&gt;. The partition design is dependent on the partition key as it groups similar items for even distribution. It's worth mentioning that the partition key is a JSON property within the document that Cosmos DB can leverage to distribute the data. The logical partition can only store up to 20 GB of data.&lt;/p&gt;

&lt;p&gt;It's easier to understand it using an example of a dataset: students' exam results for different subjects in class. Each student has exam scores for one or more exams. One of the possible logic partitions for this kind of dataset could be the &lt;strong&gt;&lt;em&gt;subject name&lt;/em&gt;&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[{
    "userId":"Singh",
    "subjectName":"Maths",
    "score":"80"
},
{
    "userId":"Singh",
    "subjectName":"Physics",
    "score":"70"
},
{
    "userId":"Max",
    "subjectName":"Maths",
    "score":"90"
},
{
    "userId":"Max",
    "subjectName":"Chemistry",
    "score":"80"
}]

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

&lt;/div&gt;



&lt;p&gt;All the data with exam scores for &lt;em&gt;every subject&lt;/em&gt; will be stored in its own partitions. Hence, grouping the data for a particular subject for multiple students in the same partition. Since the partitions are logical, you don't need to worry about deleting them once the associated data is removed or creating new ones for similar data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Em7uo3Np--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/Cosmos-Logic--1-.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Em7uo3Np--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/Cosmos-Logic--1-.jpg" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Physical Partitions in Cosmos DB
&lt;/h2&gt;

&lt;p&gt;Physical partition in Cosmos DB is Azure managed containers that enabled the scalability and data distribution across the platform by mapping multiple logical partitions to a single physical partition. Unlike logical partitions, the storage space for physical partitions is up to 50 GB for each partition.&lt;/p&gt;

&lt;p&gt;The distribution of data across the physical partition depends entirely on throughput provisioned on the Cosmos DB account. Each physical partition is limited to the throughput of up to 10,000 request units (RU) per second. Based on the throughput defined for the account, the Cosmos account will automatically determine the number of physical partitions. In addition to it, the overall size of the account is also considered due to the 50 GB limit on each physical partition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replica Sets in Cosmos DB
&lt;/h2&gt;

&lt;p&gt;A replica set in Cosmos DB is referred to as a subset of data within a physical partition set. Each physical partition distributes the data into a set of replicas to make the data durable, highly available, and consistent. Since the replica sets are running on Azure-managed nodes, the replication and global distribution process are handled automatically without any specific configuration.&lt;/p&gt;

&lt;p&gt;Read more about the concept of Consistency in Cosmos DB on the article below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://parveensingh.com/cosmosdb-consistency-levels/"&gt;Consistency Levels in Azure Cosmos DB Explained&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing the Right Partition Keys for Cosmos DB Account
&lt;/h2&gt;

&lt;p&gt;When considering the exact partition key for your containers, you need to evaluate the dataset you are working with, identify key metrics, and understand how the performance might be impacted based on how the data is accessed. Here are few considerations when planning the right partition keys for your dataset:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The partition key of your container should distribute the data evenly across the solution. Choose a key that has the possibility of growing and still not overload one set of partitions.&lt;/li&gt;
&lt;li&gt;Designing a partition key with uneven partitions or storing one document on each partition can cause cross-partition transactions in &lt;a href="https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-write-stored-procedures-triggers-udfs?tabs=javascript"&gt;triggers and stored procedures&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Avoid the keys that can potentially overload one particular partition with excess data on new writes, causing exceeded throughput and partition throttling.&lt;/li&gt;
&lt;li&gt;If your queries are mostly targeting a particular attribute of data, choosing that as a partition key would be an ideal use case to reduce cross-partition queries.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating Cosmos DB Container with Partition Key using Azure Portal
&lt;/h2&gt;

&lt;p&gt;Navigate to your Azure Portal and follow the instruction below to create a new Cosmos DB account resource.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search &lt;em&gt;cosmos&lt;/em&gt; in the Azure Portal search bar and select the &lt;strong&gt;Azure Cosmos DB&lt;/strong&gt; option under &lt;strong&gt;Services&lt;/strong&gt; :&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--58I1kqlG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/01-search-cosmos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--58I1kqlG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/01-search-cosmos.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;+Create&lt;/strong&gt; and choose &lt;strong&gt;Core(SQL) - Recommended&lt;/strong&gt; API option:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7bFI0qnn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/02-api-cosmos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7bFI0qnn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/02-api-cosmos.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fill out the relevant information on the &lt;strong&gt;Create Azure Cosmos DB Account&lt;/strong&gt; page: Be sure to use the Free Tier Discount if you currently don't use any Cosmos DB account.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JQvW8ITR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/03-res-create.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JQvW8ITR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/03-res-create.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Review+Create&lt;/strong&gt; followed by &lt;strong&gt;Create&lt;/strong&gt; to complete the resource deployment.&lt;/li&gt;
&lt;li&gt;Once the resource is deployed, navigate to the CosmosDB resource and click &lt;strong&gt;Data Explorer&lt;/strong&gt; from the left blade menu:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5maqKa_J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/04-data-explorer.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5maqKa_J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/04-data-explorer.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;New Container&lt;/strong&gt; on the top left and fill out the following information on the &lt;strong&gt;New Container&lt;/strong&gt; popup window:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OnxEn6zG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/05-new-container.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OnxEn6zG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/05-new-container.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The partition key you will be using is &lt;code&gt;subjectName&lt;/code&gt; to distribute the data into logical partitions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Expand the Database &lt;strong&gt;ExamsData&lt;/strong&gt; and the Container named &lt;strong&gt;ExamsResult&lt;/strong&gt; and click &lt;strong&gt;Items&lt;/strong&gt; :&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L-Fag9P9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/06-db-container.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L-Fag9P9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/06-db-container.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;New Item&lt;/strong&gt; on the top menu and replace the content of the editor with the following JSON data:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "userId":"Singh",
    "subjectName":"Maths",
    "score":"80"
}

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Save&lt;/strong&gt; to complete the document upload:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1U9KbH95--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/07-doc-update.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1U9KbH95--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/07-doc-update.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repeat the last step for the following data, entering &lt;strong&gt;&lt;em&gt;one JSON object at a time&lt;/em&gt;&lt;/strong&gt; :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "userId":"Singh",
    "subjectName":"Physics",
    "score":"70"
}

{
    "userId":"Max",
    "subjectName":"Maths",
    "score":"90"
}

{
    "userId":"Max",
    "subjectName":"Chemistry",
    "score":"80"
}

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Once uploaded, you should start seeing the data listed in the items view distributed by the subject name:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LfAweVzQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/08-items.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LfAweVzQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/08-items.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Cosmos DB Container with Partition Key using Azure CLI
&lt;/h2&gt;

&lt;p&gt;If you prefer using Azure CLI to create the resources, follow the instructions below to create the Cosmos DB resource using Azure CLI.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch the CloudShell from the Azure Portal and choose Bash as the environment:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nEEMOBpX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/09-cloudshell.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nEEMOBpX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2021/07/09-cloudshell.png" alt="Azure Cosmos DB Partitions &amp;amp; Partition Keys Simplified"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You will first create a new resource group and cosmos DB resource inside that resource group. If you already have a resource group, feel free to update the name of the &lt;code&gt;resouceGroup&lt;/code&gt; variable and skip the resource group creation command. Be sure to update the &lt;code&gt;cosmosDB&lt;/code&gt; variable to use a globally unique name for the Cosmos DB account.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resourceGroup="cosmostest"
cosmosDB="cosmosaccount2021"
az group create -n $resourceGroup --location westus
az cosmosdb create -n $cosmosDB -g $resourceGroup --locations regionName=westus

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create the Cosmos DB Database using the following commands:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dbName="ExamData"
az cosmosdb sql database create --account-name $cosmosDB --name $dbName --resource-group $resourceGroup

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finally, create the container with a partition key of &lt;code&gt;subjectName&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;containerName="ExamResults"
az cosmosdb sql container create --name $containerName --partition-key-path '/subjectName' --account-name $cosmosDB --data
base-name $dbName --resource-group $resourceGroup

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;At this point, the Cosmos DB account, database, and container are ready to use either in any application code or using Data Explorer in Azure Portal. You can follow the step in the previous section to upload the sample data if you wish to add documents to the container.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating Cosmos DB Container with Partition Key using Azure PowerShell
&lt;/h2&gt;

&lt;p&gt;If you are familiar with Azure PowerShell and prefer to use it instead of CLI, follow the instructions below to create the CosmosDB resource using Azure PowerShell:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch the Azure Cloud Shell with a PowerShell environment.&lt;/li&gt;
&lt;li&gt;Create the resource group and a Cosmos DB account using the following commands:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$resourceGroup="cosmostest"
$cosmosDB="cosmosaccount2021"
New-AzResourceGroup -Name $resourceGroup -Location WestUS
New-AzCosmosDBAccount -Name $cosmosDB -Location WestUS -ResourceGroupName $resourceGroup 

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Once the account is ready, create the database inside the Cosmos DB account using the following commands:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$dbName="ExamData"
New-AzCosmosDBSqlDatabase -AccountName $cosmosDB -Name $dbName -ResourceGroupName $resourceGroup

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finally, create the container to store documents with a partition key of &lt;code&gt;subjectName&lt;/code&gt; using the following commands:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$containerName="ExamsResults"
New-AzCosmosDBSqlContainer -Name $containerName -AccountName $cosmosDB -DatabaseName $dbName -ResourceGroupName $resourceGroup -PartitionKeyPath '/subjectName' -PartitionKeyKind Hash

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Follow the steps in the previous instructions to upload the data inside the container or use alternate methods via application code to add or remove the data.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;I hope that helps you understand the concept of partition keys in Cosmos DB since they are crucial to the data queries and impact the performance of your application. In the meantime, check out the following articles if you are looking to read more about Cosmos DB:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://parveensingh.com/azure-cosmos-db-basics/"&gt;What is Azure Cosmos DB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://parveensingh.com/cosmosdb-consistency-levels/"&gt;Cosmos DB Consistency Levels&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cosmosdb</category>
      <category>azure</category>
    </item>
    <item>
      <title>Is Impostor Syndrome a Real Thing?</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Sun, 03 Jan 2021 00:41:05 +0000</pubDate>
      <link>https://forem.com/parveensingh/is-imposture-syndrome-a-real-thing-49pm</link>
      <guid>https://forem.com/parveensingh/is-imposture-syndrome-a-real-thing-49pm</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fparveensingh.com%2Fcontent%2Fimages%2F2021%2F01%2Flobostudio-hamburg-yBJw1up4n44-unsplash--1-.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fparveensingh.com%2Fcontent%2Fimages%2F2021%2F01%2Flobostudio-hamburg-yBJw1up4n44-unsplash--1-.jpg" alt="Is Impostor Syndrome a Real Thing?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Many of you might have heard about the word ' &lt;strong&gt;&lt;em&gt;Impostor Syndrome&lt;/em&gt;&lt;/strong&gt;". If you haven't, that's even better! You don't need to know. In fact, you should try to avoid yourself being in that position by any means possible!&lt;/p&gt;

&lt;p&gt;But, it's easier said than done. Right?&lt;/p&gt;

&lt;p&gt;I've been going through something similar in recent times. Doubt, Lack of Motivation, Restlessness, all resulting in inconsistent and degrading lifestyle. Having a hard time finishing off the tasks and even procrastinating more than often.&lt;/p&gt;

&lt;p&gt;I never took it seriously, the concept of imposture syndrome. I would simply ignore it as it's not something I'd come across. Little did I know.&lt;/p&gt;

&lt;p&gt;Here's what was going inside my mind all the times:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I'm not good enough.&lt;/li&gt;
&lt;li&gt;I've failed x number of times already&lt;/li&gt;
&lt;li&gt;I don't know 'x', 'y' or 'z' and I need to know it.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Very common&lt;/em&gt;, comparing yourself to the success of others.&lt;/li&gt;
&lt;li&gt;Setting unrealistic goals just to satisfy your ego.&lt;/li&gt;
&lt;li&gt;Was it all luck for me?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Life is not always the way you want it to be. It is inevitably working on keeping itself together. You, rushing towards something is not always an option. Life will push you back to where you belong. Slow down, step back, and look around. There's a ray of hope pointing towards you. You just don't see it for yourself. You blindfold yourself in your own little world. You decide to look away. Away from the opportunity. Away from the motivation and enlightenment.&lt;/p&gt;

&lt;p&gt;The more you get,  the more you greed on it. There's no end to what you are capable of achieving. There's no end date of when should you have all of it. There's no deadline to be something or to achieve something. It is your own unique journey. Live it to the fullest and enjoy the process. The process is what matters the most. Stop being a perfectionist!&lt;/p&gt;

&lt;p&gt;Rushing to achieve something is not always an option. Slow down. Think it through. Plan out your journey. Stick to the plan and convert it into your reality. The plan should be feasible enough to accomplish.&lt;/p&gt;

&lt;p&gt;It's okay to fail. It's okay to feel like a failure! It's okay to feel like you know nothing. You can always learn, grow, and excel. Just like there's no deadline to achieve something, there's no start date as well to begin the journey. Start today! Take one step at a time and track your progress. Pen down your thoughts, process, plan, and progress. _ &lt;strong&gt;Visualizing the progress brings consistency&lt;/strong&gt; _.&lt;/p&gt;

&lt;p&gt;Don't get caught in the cycle of keeping track of your failures. Stop focusing on how many times it didn't work for you. Instead, focus on how many times it did. Remind yourself of all the risks you took, all the time you made an impact, all the times you did things the right way. Change the narrative.&lt;/p&gt;

&lt;p&gt;Seeing other's progress and success is not demotivating or discouraging. It is in fact the most encouraging thing to push yourself. It only turns into demotivation when you start the _ &lt;strong&gt;comparison&lt;/strong&gt; _. The moment you compare them with yourself is when you hit the plateau. It is so evil. You tend to oversee their effort and hard work, instead focus on their results with yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;p&gt;It's okay to start late.&lt;/p&gt;

&lt;p&gt;It's okay to slow down. Move at your own pace!&lt;/p&gt;

&lt;p&gt;It's okay to feel like a failure. Learn from it, don't get demotivated.&lt;/p&gt;

&lt;p&gt;It's okay to fail over and over again. You at least learned 10 ways that didn't work for you. Discover the 11th that does.&lt;/p&gt;

&lt;p&gt;It's okay to feel like this. The way I felt. We all are human beings in the end. Let your emotions out and face them. Burying down yourself and your emotion is not the solution to anything. Face it and come out even stronger.&lt;/p&gt;

&lt;p&gt;Don't be afraid to show your scars. Stay true to who you are. You can beat it eventually!&lt;/p&gt;

</description>
      <category>writing</category>
      <category>career</category>
      <category>motivation</category>
    </item>
    <item>
      <title>What is Azure Cosmos DB?</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Fri, 11 Dec 2020 08:26:04 +0000</pubDate>
      <link>https://forem.com/parveensingh/what-is-azure-cosmos-db-26im</link>
      <guid>https://forem.com/parveensingh/what-is-azure-cosmos-db-26im</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WFAkEcjx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/size/w2000/2021/07/Cosmos-UpandRunning.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WFAkEcjx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/size/w2000/2021/07/Cosmos-UpandRunning.jpg" alt="What is Azure Cosmos DB?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The modern application today requires a robust database system that is highly available, responsive. It also needs to have the ability to adapt to the changes as the demand increases and the application needs to scale in real-time. To successfully deliver those functionalities, organizations tend to use the datacenter close to their region to host those applications. Luckily, there is an Azure resource that can help you achieve those goals with more than just the functionality you need.&lt;/p&gt;

&lt;p&gt;In this article, I'll cover the high-level introduction of Cosmos DB and some of the features that it offers. I might do a series for this topic as I did for &lt;a href="https://parveensingh.com/tag/app-service/"&gt;Azure App Service&lt;/a&gt; where I published new things about app service every week, now reduced to bi-weekly. If you here for the first time, be sure to check back next week for more exciting stuff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table Of Content
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;What is Cosmos DB?&lt;/li&gt;
&lt;li&gt;Use Case&lt;/li&gt;
&lt;li&gt;
Design and Services

&lt;ul&gt;
&lt;li&gt;Design&lt;/li&gt;
&lt;li&gt;Services&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Capabilities and Features

&lt;ul&gt;
&lt;li&gt;Multiple API Support&lt;/li&gt;
&lt;li&gt;Turnkey Global Data Distribution&lt;/li&gt;
&lt;li&gt;Highly Available&lt;/li&gt;
&lt;li&gt;Consistency Models&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is Cosmos DB?
&lt;/h2&gt;

&lt;p&gt;Azure Cosmos DB is Microsoft's &lt;a href="https://www.mongodb.com/nosql-explained"&gt;NoSQL&lt;/a&gt;multi-model managed database as a service offering designed to be highly available and elastic. With the vast option of configuration like consistency level, language support, API support, and flexibility, it really shines when it comes to designing the data in a form other than a relational database. You get a really comprehensive SLA for some of its core features like latency, throughput, availability, and consistency. If you are not familiar with the term 'managed', Microsoft handles all the updates, patching, and management for you so that you can focus on the actual task of leveraging the features and getting the best out of them.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;You can use Cosmos DB at no charge for your first 400 RU/s and 5 GB of storage free.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Use Case
&lt;/h2&gt;

&lt;p&gt;Whenever it comes to planning a database solution for an application, organizations tend to look for features like responsiveness, availability, low latency, and response time to deliver an optimal experience for the end-users. If you are somewhat familiar with the Azure environment, you might be familiar with MSSQL as a managed database instance which in most cases works for the organization, but there are cases where you need to adjust the settings to your need and leverage some additional capabilities that are offered by CosmosDB.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design and Services
&lt;/h2&gt;

&lt;p&gt;As with any other Azure resource that needs an endpoint address, you get an azure assigned DNS name for your CosmosDB that you can use to communicate to the database. The Cosmos DB design is pretty self-explanatory once you play around with the resource and test it yourself. Let's take a look at what Cosmos DB database design looks like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--znK0yvZG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/12/CosmosDB-Structure.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--znK0yvZG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/12/CosmosDB-Structure.png" alt="What is Azure Cosmos DB?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Design
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Databases
&lt;/h3&gt;

&lt;p&gt;Cosmos DB aka '&lt;a href="https://docs.microsoft.com/en-us/azure/cosmos-db/account-databases-containers-items"&gt;database account&lt;/a&gt;' is referred to as the Cosmos DB resource in Azure itself which holds one or more databases. The database is the unit of management for a set of a cosmos container. You can have multiple databases in an account based on your requirements.  There are multiple options for API to choose from for your databases like SQL API, Cassandra, MongoDB, Table API, and Gremlin. CosmosDB handles the different translation and communication for you so that you have a similar experience while working with all types of databases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Containers
&lt;/h3&gt;

&lt;p&gt;CosmosDB containers are the units inside the database that govern scalability for both throughput and storage. Containers are horizontally partitioned and then replicated across multiple regions. The items inside a container are automatically distributed based on the partition key.&lt;/p&gt;

&lt;h3&gt;
  
  
  Items
&lt;/h3&gt;

&lt;p&gt;Item is a unique entry inside a container that holds the data as a document, node, or row. Based on the API used, the items can represent either a document in a collection, a row in a table, or a node/edge in a graph.&lt;/p&gt;

&lt;h2&gt;
  
  
  Services
&lt;/h2&gt;

&lt;p&gt;Let's look at some common terminology used in the Cosmos DB to get more familiar with the resource.&lt;/p&gt;

&lt;h3&gt;
  
  
  Request Units
&lt;/h3&gt;

&lt;p&gt;The cost of database operation is expressed in Request Units (RU). RU is a performance currency for the operations utilizing CPU/ Memory or IOPS. E.g. the cost to read 1 KB file or fetching a single DB item is 1 RU. All operations are assigned cost in RUs. Some of the operations that are charged in RUs are Query, Read, Insert, &lt;a href="https://en.wiktionary.org/wiki/upsert#:~:text=Noun,updates%20them%20if%20they%20do."&gt;Upsert&lt;/a&gt;, and Delete.&lt;/p&gt;

&lt;h3&gt;
  
  
  Partitions
&lt;/h3&gt;

&lt;p&gt;Partition Keys determines the item's logical distribution. Each item in a container has a unique item ID with logical partitions. It's worth noting that you can't change the partition key once the container is created. You would have to delete and recreate the container to change it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Cosmos DB support two types of partitions, Logical and Physical Partition.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Throughput
&lt;/h3&gt;

&lt;p&gt;Throughput defines a number of requests that a cosmos account can support. Currently, Cosmos DB supports two types of throughput modes, manual and auto-scale. If your resource consumes more throughput than allocated, you might face rate limitations You can either increase the throughput manually or set it to autoscale to accommodate the changing demands of the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Capabilities and Features
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Multiple API Support
&lt;/h2&gt;

&lt;p&gt;CosmosDB supports a wide variety of API support with more coming soon. It's important to note here that you need to decide what kind of API you wish to use for your database model before you deploy the resource in Azure. Currently available options are Table, SQL, Cassandra, Gremlin, and MongoDB with more coming in the near future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turnkey Global Data Distribution
&lt;/h2&gt;

&lt;p&gt;With the increasing demand for applications to be highly responsive and always online, the instances need to be accessible with low latency. Cosmos DB supports real-time read and writes from the local replicas of the instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Highly Available
&lt;/h2&gt;

&lt;p&gt;Cosmos DB provides high availability in two ways. The cosmos instance is replicated in the regions of your choice with 4 additional replicas per &lt;a href="https://azure.microsoft.com/en-us/global-infrastructure/geographies/"&gt;region&lt;/a&gt;. You can update the replication at any time using Azure Portal. It's worth mentioning that each replica can accept read and write for data usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Consistency Models
&lt;/h2&gt;

&lt;p&gt;Databases that use replicas for high-availability, low latency or both come with some considerations around consistency on how data is served and suffer minor tradeoff between read-consistency, latency, availability, and throughput. Most popular database service only offers strong and eventual consistency, however, Cosmos DB offers five (5) different consistency models ranging from strongest to weakest as listed below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Strong&lt;/li&gt;
&lt;li&gt;Bounded staleness&lt;/li&gt;
&lt;li&gt;Session&lt;/li&gt;
&lt;li&gt;Consistent prefix&lt;/li&gt;
&lt;li&gt;Eventual&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each level provides availability and performance tradeoffs. The strong consistency may suffer from reduced availability whereas Eventual consistency offers high availability and better performance but the data may not be completely consistent across all regions at the same time.&lt;/p&gt;

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

&lt;p&gt;I hope that gives you a high-level introduction to CosmosDB and what it entails and some terminology used in the resource. Use Cosmos DB if your application needs to be highly available, have fast response time anywhere in the world, be always online, and need unlimited and elastic scalability of throughput.&lt;/p&gt;

&lt;p&gt;If you get some value out of this article, follow me on this Cloud Journey on  &lt;a href="https://twitter.com/singh_cloud"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cosmosdb</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Azure Policy - High-Level Overview</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Thu, 26 Nov 2020 07:37:15 +0000</pubDate>
      <link>https://forem.com/parveensingh/azure-policy-high-level-overview-3l14</link>
      <guid>https://forem.com/parveensingh/azure-policy-high-level-overview-3l14</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fparveensingh.com%2Fcontent%2Fimages%2F2020%2F08%2Finaki-del-olmo-NIJuEQw0RKg-unsplash.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fparveensingh.com%2Fcontent%2Fimages%2F2020%2F08%2Finaki-del-olmo-NIJuEQw0RKg-unsplash.jpg" alt="Azure Policy - High-Level Overview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's exciting to build a ton of workloads in Azure but oftentimes management and control of such an environment get challenging. Negligence to actively monitor the resources results in an unmanageable environment in the cloud which usually takes hours to streamline the workloads in the testing development and production stage.&lt;/p&gt;

&lt;p&gt;Azure Policy helps to enforce organizational standards and assess the compliance at-scale in real-time. It provides single-dashboard management for compliance and remediation for non-compliant resources with a single click. For example, you can define the deployment region and be sure that nobody is able to deploy any outside the allowed region.&lt;/p&gt;

&lt;h1&gt;
  
  
  Table of contents
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Overview&lt;/li&gt;
&lt;li&gt;
Policy Types

&lt;ul&gt;
&lt;li&gt;Policy Definitions&lt;/li&gt;
&lt;li&gt;Initiative Definitions&lt;/li&gt;
&lt;li&gt;Assignments&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Permissions&lt;/li&gt;
&lt;li&gt;Policy Evaluation&lt;/li&gt;
&lt;li&gt;Policy Evaluation Response&lt;/li&gt;
&lt;li&gt;Remediating Non-Compliant Resource&lt;/li&gt;
&lt;li&gt;Recommendation for Managing Policies&lt;/li&gt;
&lt;li&gt;Maximum Count of Azure Policy Objects&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;Azure Policies evaluate the resources in Azure by comparing the properties of those resources against business rules (&lt;em&gt;definitions&lt;/em&gt;) defined in JSON format. You can deploy a lot of individual policies however, &lt;em&gt;policy initiative&lt;/em&gt; simplifies the management by grouping together a lot of &lt;em&gt;definitions&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Once you define your &lt;em&gt;policy definitions,&lt;/em&gt; they are then applied to resources using various scopes including management groups, subscriptions, resource groups, or individual resources. Policy definition applies to all the resources within the defined scope.&lt;/p&gt;

&lt;h1&gt;
  
  
  Policy Types
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Policy Definitions
&lt;/h2&gt;

&lt;p&gt;Each policy definition is a JSON object. The policy's core component is its condition which defines the effect and enforcement type on any resource that's targeted by the policy. There are quite a handful of Built-In policies that you should use. Find the list of Built-In below:&lt;/p&gt;

&lt;p&gt;[List of built-in policy definitions - Azure Policy(&lt;a href="https://docs.microsoft.com/en-us/azure/governance/policy/samples/built-in-policies" rel="noopener noreferrer"&gt;https://docs.microsoft.com/en-us/azure/governance/policy/samples/built-in-policies&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Each policy definition has the following elements that define the structure of the policy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mode – This determines which resource type will be evaluated for a policy. Supported modes are: –

&lt;ul&gt;
&lt;li&gt;all: evaluated resource groups and all resource types&lt;/li&gt;
&lt;li&gt;indexed: evaluate resource types that support tags and location&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Parameters – If you are familiar with any programming language you will be familiar with parameters. These parameters can be used in the logical evaluation and in the effects.
&amp;lt;!--kg-card-end: markdown--&amp;gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;For example, below is a policy that restricts the deployment region for resources.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "properties": {
        "displayName": "Allowed locations",
        "description": "This policy enables you to restrict the locations your organization can specify when deploying resources.",
        "mode": "Indexed",
        "metadata": {
            "version": "1.0.0",
            "category": "Locations"
        },
        "parameters": {
            "allowedLocations": {
                "type": "array",
                "metadata": {
                    "description": "The list of locations that can be specified when deploying resources",
                    "strongType": "location",
                    "displayName": "Allowed locations"
                },
                "defaultValue": ["westus2"]
            }
        },
        "policyRule": {
            "if": {
                "not": {
                    "field": "location",
                    "in": "[parameters('allowedLocations')]"
                }
            },
            "then": {
                "effect": "deny"
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Initiative Definitions
&lt;/h2&gt;

&lt;p&gt;An Initiative is a collection of policy definitions that are tailored towards a single objective. Initiative simplifies the management and evaluation of multiple policies.&lt;/p&gt;

&lt;p&gt;Azure PowerShell and Azure CLI use properties and parameters names &lt;strong&gt;PolicySet&lt;/strong&gt; to refer to initiatives.&lt;/p&gt;

&lt;p&gt;If you wish to create a custom policy definition to use as an initiative, follow the steps on the Microsoft Docs site.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/governance/policy/tutorials/create-and-manage" rel="noopener noreferrer"&gt;Tutorial: Build policies to enforce compliance - Azure Policy&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Assignments
&lt;/h2&gt;

&lt;p&gt;An assignment is a policy definition or an initiative that has been assigned to a specific scope. Assignments are inherited by the child resource when applied to top-level items such as management group and subscription.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Azure Policy is an explicit deny system. If a top-level policy on a management group or subscription is set to &lt;em&gt;deny&lt;/em&gt; any action, you won't be able to &lt;em&gt;allow&lt;/em&gt; it specifically using policy at a resource level(child level).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can use any Built-in policy to create a policy assignment. Before running the assignment command, get the Policy Id for your policy using the Get-AzPolicyDefinition command as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#use PowerShell to get Policy
$Policy = Get-AzPolicyDefinition -Builtin | where {$_.Properties.DisplayName -like "PolicyName"}

#Output
Name : 0473574d-2d43-4217-aefe-941fcdf7e684
ResourceId : /providers/Microsoft.Authorization/policyDefinitions/0473574d-2d43-4217-aefe-941fcdf7e684
ResourceName : 0473574d-2d43-4217-aefe-941fcdf7e684
ResourceType : Microsoft.Authorization/policyDefinitions
SubscriptionId :
PolicyDefinitionId : /providers/Microsoft.Authorization/policyDefinitions/0473574d-2d43-4217-aefe-941fcdf7e684

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

&lt;/div&gt;



&lt;p&gt;Use the &lt;code&gt;$Policy&lt;/code&gt; variable as policy reference and run the command &lt;code&gt;New-AzPolicyAssignment&lt;/code&gt; to create policy based on Built-In definitions. &lt;strong&gt;Scope&lt;/strong&gt; should be in format &lt;code&gt;/subscriptions/subscriptionId&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;$Assignment = New-AzPolicyAssignment -Name '&amp;lt;name&amp;gt;' -Scope '&amp;lt;scope&amp;gt;' -PolicyDefinitions $Policy

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

&lt;/div&gt;



&lt;h1&gt;
  
  
  Permissions
&lt;/h1&gt;

&lt;p&gt;Azure Policy has several permissions, known as operations, in two Resource Providers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Microsoft.Authorization&lt;/li&gt;
&lt;li&gt;Microsoft.PolicyInsight&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Make sure you have "Owner" permission on subscription to create definitions or assignments. "Contributor" role user can only trigger the resource remediation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Make sure you enable Azure Policy Resource Provider for your subscriptions before deploying any policies using the command below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Register-AzResourceProvider -ProviderNamespace 'Microsoft.PolicyInsights'

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

&lt;/div&gt;



&lt;h1&gt;
  
  
  Policy Evaluation
&lt;/h1&gt;

&lt;p&gt;Azure Policy evaluates the in-scope resources during the following times or events&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A resource is created, updated, or deleted in a scope with a policy assignment&lt;/li&gt;
&lt;li&gt;A policy or initiative is newly assigned to a scope&lt;/li&gt;
&lt;li&gt;A policy or initiative already assigned to a scope is updated&lt;/li&gt;
&lt;li&gt;During the standard compliance evaluation cycle, which occurs once every 24 hours.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Policy Evaluation Response
&lt;/h1&gt;

&lt;p&gt;Policy definition action varies for every organization. Azure Policy uses &lt;em&gt;effect&lt;/em&gt; as a trigger to respond to certain policy's non-compliant state. &lt;em&gt;Effects&lt;/em&gt; are set in the &lt;em&gt;policy rule&lt;/em&gt; within the &lt;em&gt;policy definition&lt;/em&gt;.  For example, you can limit the deployment to specific virtual machine types and sizes, or block different Azure regions from being used. You can still give developers access to the Azure environment and subscriptions but always stay in control. Below are some of the action you can perform on resources once evaluated to be non-compliant by policy definition:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deny the resource change&lt;/li&gt;
&lt;li&gt;Log the change to the resource&lt;/li&gt;
&lt;li&gt;Alter the resource before the change&lt;/li&gt;
&lt;li&gt;Alter the resource after the change&lt;/li&gt;
&lt;li&gt;Deploy related complaint resources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learn more about Policy Effect here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/governance/policy/concepts/effects" rel="noopener noreferrer"&gt;Understand how effects work - Azure Policy&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Remediating Non-Compliant Resource
&lt;/h1&gt;

&lt;p&gt;While the policy &lt;em&gt;effect&lt;/em&gt; primarily affects the resource during the creation or any update, Azure Policy also supports dealing with existing non-compliant resources without needing to alter the resources.&lt;/p&gt;

&lt;p&gt;When Azure Policy runs in &lt;strong&gt;deployIfNotExists&lt;/strong&gt; policy effect, it does the deployment using a &lt;a href="https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview" rel="noopener noreferrer"&gt;managed identity&lt;/a&gt;. Azure Policy creates a managed identity for each assignment when needed. While deploying the policy assignment using Azure Portal, the setup creates the managed identity with the necessary permission automatically for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fgovernance%2Fpolicy%2Fmedia%2Fremediate-resources%2Fmissing-role.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fgovernance%2Fpolicy%2Fmedia%2Fremediate-resources%2Fmissing-role.png" alt="Azure Policy - High-Level Overview"&gt;&lt;/a&gt;Managed Identity for Azure Policy&lt;/p&gt;

&lt;h1&gt;
  
  
  Recommendation for Managing Policies
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;It's always good to start with an audit effect instead of a deny effect to track the impact of your policy definition on the resources in your environment. This ensures you get enough data to collect and make decisions on enforcing policies based on business needs.&lt;/li&gt;
&lt;li&gt;Consider organizational hierarchies when creating definitions and assignments. It is recommended to create definitions at higher levels such as the management group or subscription level. Then, create the assignment at the next child level.&lt;/li&gt;
&lt;li&gt;While you can create individual policies for each task, it's more effective to use initiative definitions even for a single policy definition.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Maximum Count of Azure Policy Objects
&lt;/h1&gt;

&lt;p&gt;There's a limit on how many policies you can deploy in a certain scope, either subscription or management group. Use the following chart as a reference.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Where&lt;/th&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Maximum count&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Subscription/Management Group&lt;/td&gt;
&lt;td&gt;Policy definitions&lt;/td&gt;
&lt;td&gt;500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subscription/Management Group&lt;/td&gt;
&lt;td&gt;Initiative definitions&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tenant&lt;/td&gt;
&lt;td&gt;Initiative definitions&lt;/td&gt;
&lt;td&gt;2500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subscription/Management Group&lt;/td&gt;
&lt;td&gt;Policy or initiative assignments&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Policy definition&lt;/td&gt;
&lt;td&gt;Parameters&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Initiative definition&lt;/td&gt;
&lt;td&gt;Policies&lt;/td&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Initiative definition&lt;/td&gt;
&lt;td&gt;Parameters&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Policy or initiative assignments&lt;/td&gt;
&lt;td&gt;Exclusions (notScopes)&lt;/td&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Policy rule&lt;/td&gt;
&lt;td&gt;Nested conditionals&lt;/td&gt;
&lt;td&gt;512&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Remediation&lt;/td&gt;
&lt;td&gt;task&lt;/td&gt;
&lt;td&gt;Resources&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

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

&lt;p&gt;I hope this provides you a high-level overview of Azure Policies in Azure for managing and restricting the Azure environment.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>governance</category>
    </item>
    <item>
      <title>How To Clone An Azure Web App</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Wed, 18 Nov 2020 04:56:09 +0000</pubDate>
      <link>https://forem.com/parveensingh/how-to-clone-an-azure-web-app-2af9</link>
      <guid>https://forem.com/parveensingh/how-to-clone-an-azure-web-app-2af9</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GSiXeWut--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/Blog-09.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GSiXeWut--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/Blog-09.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the ninth article in the " &lt;strong&gt;Getting Started with Azure App Service&lt;/strong&gt;" Series where I publish in-depth tutorials and walkthroughs on using Azure App Service and best practices every week. In the last article, we discussed how you can set up&lt;/em&gt; &lt;a href="https://parveensingh.com/easy-auth-for-azure-app-service"&gt;&lt;em&gt;Easy Auth for Azure App Service&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;There might be a time when you'd be using Azure App Service and think if you could make an identical copy of a web application and test it externally without affecting any production workloads. App Service clone feature is here to rescue you.&lt;/p&gt;

&lt;p&gt;This week, we are looking at how to clone Azure App Service that you can use either for testing something on identical environment if you have a production application already, or you are simply learning what the possibilities are while using App Service. Let's dive right in!&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Prerequisites&lt;/li&gt;
&lt;li&gt;Cloning Web App Using Azure Portal&lt;/li&gt;
&lt;li&gt;
Cloning Web App Between Regions using PowerShell

&lt;ul&gt;
&lt;li&gt;Cloning a Standalone Web App to New Region&lt;/li&gt;
&lt;li&gt;Cloning a Web App With App Slots&lt;/li&gt;
&lt;li&gt;Cloning a Web App to Same Region&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Cloning Existing App Slot Only&lt;/li&gt;
&lt;li&gt;Restrictions&lt;/li&gt;
&lt;li&gt;Reference&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;If you decide to follow along, confirm the following pre-requisites before you begin.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Be sure that you have the latest version of PowerShell installed. You can use Cloud Shell if you prefer to stay within the Azure Portal.&lt;/li&gt;
&lt;li&gt;Your app service plan should be running on at least Standard Tier to perform the clone on the application. This operation cannot be performed on the Basic/Free Tier applications.&lt;/li&gt;
&lt;li&gt;You need a running Web App to perform the test. Follow alone once you have a POC web application to test the following steps.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Cloning Web App Using Azure Portal
&lt;/h1&gt;

&lt;p&gt;Suppose you want to move your application from Canada Central to West US, it can be accomplished using Azure Portal or PowerShell command that will create a clone of your current application in the new region.&lt;/p&gt;

&lt;p&gt;If you prefer to use Azure Portal instead of PowerShell for the clone, follow the steps below. It's fairly easy to perform the clone in a few clicks instead of going through PowerShell.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Azure Portal and your Web App resource.&lt;/li&gt;
&lt;li&gt;On the left side blade, choose " &lt;strong&gt;Clone&lt;/strong&gt;" option.&lt;/li&gt;
&lt;li&gt;Use the following screenshot and the steps below to follow&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QSzFrm5h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/07-PortalClone.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QSzFrm5h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/07-PortalClone.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;Clone-GuiTrigger&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fill out the name for new web application and pick a resource group where you'd like to deploy it.&lt;/li&gt;
&lt;li&gt;You have the option to create a new App Service Plan in either the same or different region. Create one with a name of your choice.&lt;/li&gt;
&lt;li&gt;Under Clone Setting, make sure you enable the feature that you'd like to clone with the application.&lt;/li&gt;
&lt;li&gt;You can turn ON the " &lt;strong&gt;Application Insights&lt;/strong&gt;" optionally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The clone should take only a few minutes and you should see new resources in your destination resource group as shown in the screenshot below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eUungN1Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/08-WebAppCloneGui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eUungN1Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/08-WebAppCloneGui.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;Clone-GuiConfirmation&lt;/p&gt;

&lt;h1&gt;
  
  
  Cloning Web App Between Regions using PowerShell
&lt;/h1&gt;

&lt;p&gt;If you are PowerShell fan, follow the instructions below to achieve the same results as with Azure Portal.&lt;/p&gt;

&lt;p&gt;Before you run the command, you would want to confirm your application name and the resource group it resides in. Use the following command to prepare your source information of the application and replace the value of &lt;code&gt;resourcegroupname&lt;/code&gt; and &lt;code&gt;name&lt;/code&gt; that matches your environment names.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$srcapp = Get-AzWebApp -ResourceGroupName "RGNAME" -Name "AppName"

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

&lt;/div&gt;



&lt;p&gt;Once you run this command, it will store the information about your application in a variable called &lt;code&gt;srcapp&lt;/code&gt; that we can use later to use during the clone command.&lt;/p&gt;

&lt;p&gt;Since your new app will sit in a different region, you'd need to create an App Service Plan that matches your destination region. You can use Azure Portal to do this or follow the command below to achieve the same results. I assume the destination location to be &lt;code&gt;west us&lt;/code&gt;. Be sure to use Standard tier as it is the minimum plan required for cloning application..&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;New-AzAppServicePlan -Location "West US" -ResourceGroupName "DestRGName" -Name "DestAppPlanName" -Tier Standard

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cloning a Standalone Web App to New Region
&lt;/h2&gt;

&lt;p&gt;Next up is the step to perform the clone on the new application. Use the following commands to create a new web app using an existing application as a source app. Pay attention to the flag &lt;code&gt;SourceWebApp&lt;/code&gt; as we are using that to point to the already available application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$destApp = New-AzWebApp -ResourceGroupName "DestRGName" -Name "dest-webapp" -Location "West US" -AppServicePlan "DestAppPlanName" -SourceWebApp $srcApp

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

&lt;/div&gt;



&lt;p&gt;The script output should be minimal as shown in the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xm03NfdP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/02-CodeRun.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xm03NfdP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/02-CodeRun.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;PowerShell Results for Standalone App Clone&lt;/p&gt;

&lt;p&gt;You should see a similar view in your account with new resources in West US.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DiOzUF7K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/01-WebAppClone-01-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DiOzUF7K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/01-WebAppClone-01-1.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;Portal View of Standalone App Clone&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloning a Web App With App Slots
&lt;/h2&gt;

&lt;p&gt;If you have any slots configure for your application and would like to clone them as well along with the source app, use the following commands to achieve the desired results. We are only introducing one new flag &lt;code&gt;IncludeSourceWebAppSlots&lt;/code&gt; at the end.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$destApp = New-AzWebApp -ResourceGroupName "DestRGName" -Name "dest-webapp" -Location "West US" -AppServicePlan "DestAppPlanName" -SourceWebApp $srcApp -IncludeSourceWebAppSlots

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

&lt;/div&gt;



&lt;p&gt;PowerShell results from the script are below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dQEMBNBQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/03-CodeRun.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dQEMBNBQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/03-CodeRun.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;PowerShell Results for App Slot Clone&lt;/p&gt;

&lt;p&gt;As you can also see from the screenshot below, all the slots from the source would be available in the new region once cloned.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TeFHpCu2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/04-WebAppSlotsClone.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TeFHpCu2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/04-WebAppSlotsClone.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;Portal View of App Slot Clone&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloning a Web App to Same Region
&lt;/h2&gt;

&lt;p&gt;The same steps can be performed to clone an application in &lt;strong&gt;same region&lt;/strong&gt; as well. You'd still need to create a new App Service Plan and use that to host the new applications. All the steps would be similar to perform the clone as it was a different region.&lt;/p&gt;

&lt;h1&gt;
  
  
  Cloning Existing App Slot Only
&lt;/h1&gt;

&lt;p&gt;There can be a case where you would only want to clone an app slot to either a new application or to a new slot for many different regions. The new app can be either in same or different region than the original app.&lt;/p&gt;

&lt;p&gt;Follow through the steps below to see how you can create a &lt;strong&gt;new application&lt;/strong&gt; from an existing slot. The command below takes a snapshot variable that holds the information about an existing application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$srcAppSlot= Get-AzWebAppSlot -ResourceGroupName "SourceRGName" -Name "SourceApp" -Slot "SourceAppSlot"

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

&lt;/div&gt;



&lt;p&gt;Once you have the source app information in a variable &lt;code&gt;srcAppSlot&lt;/code&gt;, you can use that to create a new application using &lt;code&gt;SourceWebApp&lt;/code&gt; flag in the &lt;code&gt;New-AzWebApp&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Create a new App Service Plan
New-AzAppServicePlan -Location "West US" -ResourceGroupName "DestRGName" -Name "DestAppPlanName" -Tier Standard

#Create new Web App
$destApp = New-AzWebApp -ResourceGroupName "DestRGName" -Name "DestApp" -Location "West US" -AppServicePlan "DestAppPlanName" -SourceWebApp $srcAppSlot

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

&lt;/div&gt;



&lt;p&gt;Here are final PowerShell results:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vLt0ZTHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/05-CodeRun.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vLt0ZTHB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/05-CodeRun.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;PowerShell Results for Slot Only Clone&lt;/p&gt;

&lt;p&gt;You should also notice some new resources in your destination resource group now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xMhjSHE4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/06-WebAppSlotOnlyClone.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xMhjSHE4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/06-WebAppSlotOnlyClone.png" alt="How To Clone An Azure Web App?"&gt;&lt;/a&gt;Verification for Slot Only Clone&lt;/p&gt;

&lt;h1&gt;
  
  
  Restrictions
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Autoscale settings are not cloned. You would have to migration your scale settings manually if you have any.&lt;/li&gt;
&lt;li&gt;The backup setting is tied to Web App resource which you'd need to create once the application is up and running in the new region.&lt;/li&gt;
&lt;li&gt;VNET settings are not cloned. However, the Outbound IP address of the application will change if application is clone to different scale unit.&lt;/li&gt;
&lt;li&gt;App Insights would have to be configured with the new web app as they don't migrate with the clone.&lt;/li&gt;
&lt;li&gt;Easy Auth settings and Kudu Extension are not cloned.&lt;/li&gt;
&lt;li&gt;Database content is not cloned to new application.&lt;/li&gt;
&lt;li&gt;Unfortunately, you can only clone Windows App as of now.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Reference
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/app-service-web-app-cloning"&gt;Clone app with PowerShell&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/environment/intro"&gt;App Service Environment&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;If it's your first time here, please check out other articles in the series:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Part 1: &lt;a href="https://parveensingh.com/up-and-running-with-azure-app-service/"&gt;Up and Running with Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 2: &lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/"&gt;Continuous Deployment for Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 3: &lt;a href="https://parveensingh.com/using-deployment-slots-with-azure-app-service/"&gt;Using Deployment Slots with Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 4: &lt;a href="https://parveensingh.com/custom-domain-azure-app-service/"&gt;Setup Custom Domain for Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 5: &lt;a href="https://parveensingh.com/next-js-deployment-on-azure-app-service"&gt;Deploying Next.JS App on Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 6: &lt;a href="https://parveensingh.com/next-js-node-app-with-cosmos-db/"&gt;Next.JS App with Cosmos DB on Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 7: &lt;a href="https://parveensingh.com/why-should-you-use-azure-app-service/"&gt;Why Should You Use Azure App Service?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 8: &lt;a href="https://parveensingh.com/easy-auth-for-azure-app-service"&gt;Easy Auth for Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 9: &lt;a href="https://parveensingh.com/how-to-clone-an-azure-web-app"&gt;How To Clone An Azure Web App?&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>azureappservice</category>
      <category>azure</category>
      <category>powershell</category>
      <category>guide</category>
    </item>
    <item>
      <title>Easy Auth for Azure App Service</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Fri, 13 Nov 2020 07:16:48 +0000</pubDate>
      <link>https://forem.com/parveensingh/easy-auth-for-azure-app-service-3hpe</link>
      <guid>https://forem.com/parveensingh/easy-auth-for-azure-app-service-3hpe</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--64Bc_0V2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/Blog-08.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--64Bc_0V2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/Blog-08.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the eighth article in the " &lt;strong&gt;Getting Started with Azure App Service&lt;/strong&gt;" Series where I publish in-depth tutorial and walkthrough on using Azure App Service and best practices every week. In the last article, we discussed &lt;a href="https://parveensingh.com/why-should-you-use-azure-app-service/"&gt;why you should use Azure App Service.&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Authentication and Authorization for Web Application have always been a big challenge for developers and administrators as it not only requires you to develop and support the authentication but also ensures that you keep it secure from any active threats. Building the service from scratch often requires a deep understanding of federation, encryption, JSON web tokens (JWT), permission handling, and so on. An insecure authentication mechanism can fall you prey to attacks like SQL Injection, Password Spraying, Lockout policy and the list goes on...&lt;/p&gt;

&lt;p&gt;Fortunately, App Service is here to help simplify the authentication and authorization for your web application. App Service offers all the mentioned features so that you can spend more time and energy on providing business value to your customer and worry less about handling authentication. Sounds promising?&lt;/p&gt;

&lt;p&gt;In this article, I'll be walking you through the process of enabling Authentication using Azure AD which will secure your web app and handle the authentication process with zero code update. Let's get right into it.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Prerequisite&lt;/li&gt;
&lt;li&gt;Getting Up to Speed with App Service&lt;/li&gt;
&lt;li&gt;How Does This Work?&lt;/li&gt;
&lt;li&gt;Setting up Authentication for Application&lt;/li&gt;
&lt;li&gt;Testing App Authentication&lt;/li&gt;
&lt;li&gt;Managing Permission to the Application&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Reference&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Prerequisite
&lt;/h1&gt;

&lt;p&gt;If you decide to follow along the article, make sure you have the following prerequisites in place already:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Azure Portal access with active subscription&lt;/li&gt;
&lt;li&gt;Azure App Service running a web app.&lt;/li&gt;
&lt;li&gt;Global Admin or necessary permission to create app registration in Azure AD Tenant.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Getting Up to Speed with App Service
&lt;/h1&gt;

&lt;p&gt;If you are new to Azure App Service, I'd recommend going through the other series article to get familiar with the resource and learn how to deploy your first App Service resource. For this article, I'll assume that you are already familiar with app service and understand the basic usage of the resource. Use the article below to create your app service if you don't have one already.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/#creating-azure-app-service-resource"&gt;Continuous Deployment for Azure App Service: GitHub and Azure Repos&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure your App Service is running at least B1 (Dev/Test) or higher in the Production plans to support HTTPS traffic and authentication redirects.&lt;/p&gt;

&lt;h1&gt;
  
  
  How Does This Work?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Sign In&lt;/strong&gt; → As the user sign in to the application, app registration handles the incoming request and delegate the federated access to App Service. By default, the endpoint for the auth page is  &lt;code&gt;/.auth/login/&amp;lt;provider&amp;gt;&lt;/code&gt; which is visible under the app registration properties that handle the authentication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Post-authentication&lt;/strong&gt; → As the user authenticates to the login page, the provider redirects the client to a callback URL &lt;code&gt;/.auth/login/&amp;lt;provider&amp;gt;/callback&lt;/code&gt; that confirms the access and allows or deny the user based on the rules set up in tenant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Establish Session&lt;/strong&gt; → As the user is authenticated, the app service adds the authenticated cookie to the response and grant the permission to use for the application access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Serve authenticated content&lt;/strong&gt; → Once the user is authenticated, the subsequent requests are handled by the browser for the authentication of the client.&lt;/p&gt;

&lt;p&gt;Check out the overview of Authentication and Authorization for web app here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization"&gt;Authentication and authorization - Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Setting up Authentication for Application
&lt;/h1&gt;

&lt;p&gt;The first or the only step toward setting up the authentication is to turn on the service from the app service menu. Azure allows you to use Google, Facebook, Twitter, and Personal Microsoft Account as an authentication server however, I'll be using Azure AD Authentication as an example for this article. Follow the steps below to set up the authentication for your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to your App Service resource and click " &lt;strong&gt;Authentication/ Authorization&lt;/strong&gt;"&lt;/li&gt;
&lt;li&gt;Turn the Authentication " &lt;strong&gt;ON&lt;/strong&gt;" and use " &lt;strong&gt;Azure Active Directory&lt;/strong&gt;" as the authentication provider.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8gjTa9pD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/01-AppAuthView.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8gjTa9pD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/01-AppAuthView.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;Enabling Authentication - 01&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under the Management Mode use the " &lt;strong&gt;Express&lt;/strong&gt;" setting as you can create a new app registration if it doesn't exist already.&lt;/li&gt;
&lt;li&gt;Choose " &lt;strong&gt;Create New AD App&lt;/strong&gt;" so that provider can create a new app for authentication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--thMhkd2l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/02-AzureAppSP.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--thMhkd2l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/02-AzureAppSP.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;Express Settings for Azure AD Authentication&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click " &lt;strong&gt;OK&lt;/strong&gt;" when done.&lt;/li&gt;
&lt;li&gt;Once on the Authentication page, makes sure you update the " &lt;strong&gt;Action to take when the request is not authenticated&lt;/strong&gt;" to use Azure Active Directory and click " &lt;strong&gt;Save&lt;/strong&gt;".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C1fmj_OZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/03-AzureAppSetup.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C1fmj_OZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/03-AzureAppSetup.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;Saving the Authentication Setup Changes&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Setting the Azure AD authentication here will require authentication to website as a whole.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just like that, you configured the Azure AD Authentication for your application without making any changes to your application at all. Let's move to the next step and verify the change now.&lt;/p&gt;

&lt;p&gt;If you are looking to handle the authentication for particular pages or sections of the website, make sure you update your codebase to use the authentication provider URL and redirect the traffic to the authentication server as mentioned below.&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;a href="/.auth/login/&amp;lt;provider&amp;gt;?post_login_redirect_url=/Home/Index"&amp;gt;Log in&amp;lt;/a&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;I'll cover the authentication server changes inside the codebase in future articles. We'll stick with default Azure AD access, for now, to simplify the process and understand the high-level picture of the authentication setup. In the meantime, you can check out this article for more information:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/app-service-authentication-how-to"&gt;Advanced usage of AuthN/AuthZ - Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Testing App Authentication
&lt;/h1&gt;

&lt;p&gt;Once you turn on the authentication for your application, it's time to access the URL and confirm the prompt for the login. Follow the steps below to confirm the login process and also address the error related to users that don't have access to the application at this point.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the overview page of your app service and access the URL in a new tab.&lt;/li&gt;
&lt;li&gt;As you access the website, you should be prompted to log in to your Azure account. Once authenticated, you should be able to consent the permission for your organization if you are using a Global Admin account so that other users inside the tenant don't get any permission issue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iDbTs0Ya--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/04-AppTest.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iDbTs0Ya--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/04-AppTest.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;Consent Page for App Registration&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's worth taking note that if you use a different account to login, you won't be able to access the application. I'm using an external account from a different tenant and it presents me an error saying " &lt;strong&gt;user account does not exist in tenant&lt;/strong&gt;". Let's handle that in the next steps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5PMKEgG_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/05-AppFailureTest.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5PMKEgG_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/05-AppFailureTest.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;Error on users with no access to the app service&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To allow other users to log in to this application, you need to add those users to your app registration so that they can authenticate to the Active Directory and access the web app resource. Follow the steps in the next section to see how you can add users to access the application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Managing Permission to the Application
&lt;/h1&gt;

&lt;p&gt;Follow the steps below to resolve the permission issue for non-authenticated users who don't have access to the web app.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to your Azure Portal and search for " &lt;strong&gt;App Registration&lt;/strong&gt;".&lt;/li&gt;
&lt;li&gt;Click on the app registration that you create during authentication provider setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TygODWYg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/06-AppRegSearch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TygODWYg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/06-AppRegSearch.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;App Registration for Authentication&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As you can see under the " &lt;strong&gt;Authentication&lt;/strong&gt;" tab that app registration uses your web app name with some additional parameters to handle the authentication at the backend for you.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---5U49-XE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/07-AppRegValidation.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---5U49-XE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/07-AppRegValidation.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;Authentication URL Configuration&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under the " &lt;strong&gt;Overview&lt;/strong&gt;" tab, click on the " &lt;strong&gt;Managed Application in local directory&lt;/strong&gt;" which takes you to the application that handles the permission for tenant users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5-413R0f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/08-AppServicePermission01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5-413R0f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/08-AppServicePermission01.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;Navigate to Enterprise Application that handles the permissions&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to " &lt;strong&gt;Users and Groups&lt;/strong&gt;" once under the enterprise application that opens with the previous link.&lt;/li&gt;
&lt;li&gt;Add new users or preferably a security group with member users that you'd like to grant permission for your web application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ikosgUh7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/09-AppServicePermission02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ikosgUh7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/11/09-AppServicePermission02.png" alt="Easy Auth for Azure App Service"&gt;&lt;/a&gt;Adding users/security groups for permission&lt;/p&gt;

&lt;p&gt;More on permission at this link below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-restrict-your-app-to-a-set-of-users"&gt;Restrict Azure AD app to a set of users - Microsoft identity platform&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;I hope this article helped you set up authentication for your app service web app with these simple steps and no changes to your codebase. This feature definitely works like a charm if you want to take off the authentication piece from your codebase and let Azure handle that for you either with Azure AD or third-party authentication services like Twitter, Facebook, and Google.&lt;/p&gt;

&lt;p&gt;As always, feel free to leave a comment below or react out to me on Twitter if you have any questions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Reference
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization"&gt;Authorization and Authentication for Azure App Service&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad"&gt;Configure App Service to use Azure AD Authentication&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization#more-resources"&gt;Configure App Service with other Third-Party Authentication Services&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-restrict-your-app-to-a-set-of-users"&gt;Restrict Access to your Application&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;If it's your first time here, please check out other articles in the series:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Part 4: &lt;a href="https://parveensingh.com/custom-domain-azure-app-service/"&gt;Setup Custom Domain for Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 5: &lt;a href="https://parveensingh.com/next-js-deployment-on-azure-app-service"&gt;Deploying Next.JS App on Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 6: &lt;a href="https://parveensingh.com/next-js-node-app-with-cosmos-db/"&gt;Next.JS App with Cosmos DB on Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 7: &lt;a href="https://parveensingh.com/why-should-you-use-azure-app-service/"&gt;Why Should You Use Azure App Service?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 8: &lt;a href="https://parveensingh.com/easy-auth-for-azure-app-service"&gt;Easy Auth for Azure App Service&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>azureappservice</category>
      <category>azure</category>
    </item>
    <item>
      <title>Why Should You Use Azure App Service?</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Tue, 10 Nov 2020 01:56:07 +0000</pubDate>
      <link>https://forem.com/parveensingh/why-should-you-use-azure-app-service-30h8</link>
      <guid>https://forem.com/parveensingh/why-should-you-use-azure-app-service-30h8</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fparveensingh.com%2Fcontent%2Fimages%2F2020%2F11%2FBlog-07.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fparveensingh.com%2Fcontent%2Fimages%2F2020%2F11%2FBlog-07.png" alt="Why Should You Use Azure App Service?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the seventh article in the " &lt;strong&gt;Getting Started with Azure App Service&lt;/strong&gt;" Series where I publish in-depth tutorial and walkthrough on using Azure App Service and best practices every week. In the last article, we talked about how you can use &lt;a href="https://parveensingh.com/next-js-node-app-with-cosmos-db/" rel="noopener noreferrer"&gt;CosmosDB with NextJS on Azure App Service&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Azure platforms offer multiple cloud services including support for different programming languages, tools, and structures to help enterprises in their cloud journey. Azure App Service is one of the offerings that allow organizations to host their web workloads in a scalable and reliable fashion.&lt;/p&gt;

&lt;p&gt;Azure App Service is a fully managed Platform as a Service (PaaS) that provides you with the tools and services needed to create reliable and scalable mission-critical Web Apps, Mobile Apps, API Apps, and Logic Apps in a single instance. It takes away your management of the host and lets you focus entirely on building your application for performance.&lt;/p&gt;

&lt;p&gt;With the ability to develop and deploy enterprise-ready web applications, it provides powerful DevOps capabilities such as continuous integration with Azure DevOps, GitHub and Docker Hub, stage management, custom domain, and TLS/SSL. You can always integrate the app service with your on-premises resources if ever needed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Check out some of the key features of App Service:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multiple languages and frameworks&lt;/strong&gt; - App Service support &lt;a href="http://ASP.NET" rel="noopener noreferrer"&gt;ASP.NET&lt;/a&gt;, &lt;a href="http://ASP.NET" rel="noopener noreferrer"&gt;ASP.NET&lt;/a&gt; Core, Java, Ruby, Node.js, PHP, or Python. You can always run WebJobs on your web app using PowerShell or other scripting languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managed production environment&lt;/strong&gt; - App Service is fully managed resources that take away your effort to manage, patch, update, or upgrading any underlying OS. You can spend time writing great apps and let Azure worry about the platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Containerization and Docker&lt;/strong&gt; - Does the code work on your machine only? Dockerize your application and publish it on App Service. You can run multi-container apps with Docker Compos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DevOps optimization&lt;/strong&gt; - You can  &lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/" rel="noopener noreferrer"&gt;set up continuous integration&lt;/a&gt; and deployment with Azure DevOps, GitHub, BitBucket, Docker Hub, or Azure Container Registry. This allows you to deploy your application directly using CI/CD.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global scale with high availability&lt;/strong&gt; - Being a managed resource, you get the ability to scale up or out the app service resource manually or automatically. App Service allows rules to trigger the scaling for your application based on its workload metrics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connections to SaaS platforms and on-premises data&lt;/strong&gt; - App Service allows you to choose from more than 50 connectors for enterprise systems (such as SAP), SaaS services, and internet services (such as Facebook). You can also access your on-premises data using Hybrid Connections and Azure Virtual Networks right within the application settings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security and compliance&lt;/strong&gt; - Authentication with Azure AD and other third party authentication service make it easier for you to leverage the feature with very little change in your application code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application templates&lt;/strong&gt; - If you are getting started, choose from an extensive list of application templates in the &lt;a href="https://azure.microsoft.com/marketplace/" rel="noopener noreferrer"&gt;Azure Marketplace&lt;/a&gt;, such as WordPress, Joomla, and Drupal with very little to zero experience of deploying web apps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visual Studio and Visual Studio Code integration&lt;/strong&gt; - Do you love working with Visual Studio tools? You can use Visual Studio or VS Code to create, deploy, and debug your application in real time without any additional setup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Serverless code&lt;/strong&gt; - Serverless fan? App Service got you! You can run code snippets or script on-demand without having to explicitly provision or manage infrastructure and pay only for the compute time your code actually uses. Check out Azure Functions or Logic App for more information on how to achieve that.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Start using Azure App Service today and explore the feature to see what works best for you! If you are looking for more information, check out the other articles in the series and get started with App Service.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/overview" rel="noopener noreferrer"&gt;Overview - Azure App Service&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;If it's your first time here, please check out other articles in the series:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Part 1: &lt;a href="https://parveensingh.com/up-and-running-with-azure-app-service/" rel="noopener noreferrer"&gt;Up and Running with Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 2: &lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/" rel="noopener noreferrer"&gt;Continuous Deployment for Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 3: &lt;a href="https://parveensingh.com/using-deployment-slots-with-azure-app-service/" rel="noopener noreferrer"&gt;Using Deployment Slots with Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 4: &lt;a href="https://parveensingh.com/custom-domain-azure-app-service/" rel="noopener noreferrer"&gt;Setup Custom Domain for Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 5: &lt;a href="https://parveensingh.com/next-js-deployment-on-azure-app-service" rel="noopener noreferrer"&gt;Deploying Next.JS App on Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 6: &lt;a href="https://parveensingh.com/next-js-node-app-with-cosmos-db/" rel="noopener noreferrer"&gt;Next.JS App with Cosmos DB on Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 7: &lt;a href="https://parveensingh.com/why-should-you-use-azure-app-service" rel="noopener noreferrer"&gt;Why Should You Use Azure App Service?&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>azureappservice</category>
      <category>azure</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Deploying Next.JS App on Azure App Service</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Tue, 27 Oct 2020 07:22:09 +0000</pubDate>
      <link>https://forem.com/parveensingh/deploying-next-js-app-on-azure-app-service-51eh</link>
      <guid>https://forem.com/parveensingh/deploying-next-js-app-on-azure-app-service-51eh</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PxP5xttj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/10/Web-1920---1-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PxP5xttj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://parveensingh.com/content/images/2020/10/Web-1920---1-1.png" alt="Deploying Next.JS App on Azure App Service"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the fifth article in the " &lt;strong&gt;Getting Started with Azure App Service&lt;/strong&gt;" Series where I publish in-depth tutorial and walkthrough on using Azure App Service and best practices every week&lt;/em&gt;. &lt;em&gt;Last week, we talked about how you can &lt;a href="https://parveensingh.com/custom-domain-azure-app-service/"&gt;Setup Custom Domain for Azure App&lt;/a&gt; Service.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I've been playing with React and some of it's popular web frameworks for some time to understand the capabilities and features it provides to run modern web applications. I stumbled upon Next.JS after researching and testing a demo application for few days and decided to publish it on Azure App Service to test some of its functionality.&lt;/p&gt;

&lt;p&gt;I am not a react developer as you can tell by now if you have read my other blogs, but it was super simple and quick to get started with Next.JS official learn module. It took me only 3-4 hours to create an application that communicates with Cosmos DB to pull data out and display it on the homepage. (More on this in upcoming blogs -Work in Progress 😉 )&lt;/p&gt;

&lt;p&gt;Unfortunately, things didn't go as planned and I spent an entire day trying to figure out the issue with the application after it was deployed on App Service. I started receiving an error " &lt;strong&gt;&lt;em&gt;You do not have permission to view this directory or page&lt;/em&gt;&lt;/strong&gt;". It turned out to be a trivial yet complicated issue with some missing files and an undefined Node version on App Service resource. I decided to give an overview and share with you the solution on how you can run your Next.JS application in Azure.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;What is Next.JS?&lt;/li&gt;
&lt;li&gt;What is Azure App Service?&lt;/li&gt;
&lt;li&gt;Let's Talk About the Real Issue!&lt;/li&gt;
&lt;li&gt;
Prepare Your Code for Azure App Service

&lt;ul&gt;
&lt;li&gt;Installing NodeJS&lt;/li&gt;
&lt;li&gt;Setting up a Sample Repo&lt;/li&gt;
&lt;li&gt;Adding Web.config File&lt;/li&gt;
&lt;li&gt;Adding Server.js File&lt;/li&gt;
&lt;li&gt;Updating Node Version on App Service&lt;/li&gt;
&lt;li&gt;Building the Code Before Deployment&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Publishing Code Directly to Azure App Service

&lt;ul&gt;
&lt;li&gt;Creating App Service using VS Code&lt;/li&gt;
&lt;li&gt;Deploying Application using VS Code&lt;/li&gt;
&lt;li&gt;Deploying Application using Azure DevOps&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  What is Next.JS?
&lt;/h1&gt;

&lt;p&gt;As per Next.js official website: &lt;em&gt;Next.js gives you the best developer experience with all the features you need for production: hybrid static &amp;amp; server rendering, TypeScript support, smart bundling, route pre-fetching, and more. No config needed.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you are here for a solution on the error, I'd assume you already know a little bit or something about Next.JS. If you want to learn Next.js from basics, use this link and get started:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nextjs.org/learn/basics/create-nextjs-app"&gt;Create Your First Next.JS Application&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Azure App Service?
&lt;/h1&gt;

&lt;p&gt;Azure App Service is a PaaS offering by Microsoft that hosts your web service for you in a dedicated and secure host with fully automated scaling and monitoring features.&lt;/p&gt;

&lt;p&gt;If you need more insights or you are looking to learn more about App Service, please check out my &lt;strong&gt;App Service Series&lt;/strong&gt; where I am covering App Service features and exploring new capabilities every week.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://parveensingh.com/tag/app-service/"&gt;Getting Started With Azure App Service Series&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Let's Talk About the Real Issue!
&lt;/h1&gt;

&lt;p&gt;I tried to deploy Next.JS code on my Azure App Service which of course didn't go well in the first run. Apparently, everybody is talking about running Next.js as Static Web App using GitHub Repo. Where did Azure DevOps (ADO) go?&lt;/p&gt;

&lt;p&gt;I store all my code in ADO, so I needed some way to deploy the code using the ADO Pipeline and release it instead of storing everything in GitHub now. Looking at some GitHub and TechNet blogs under the App Service tag, I couldn't find one single fix that would work all of it.&lt;/p&gt;

&lt;p&gt;Here's the very first issue that I encountered once the deployment was completed with out-of-box source code. Expect to see a 5xx error depending on your code and the file setup.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0JlO1y-P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sv1wio75fj8g6d0fcmu3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0JlO1y-P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sv1wio75fj8g6d0fcmu3.png" alt="01-Error01-Permission Issue"&gt;&lt;/a&gt;&lt;br&gt;Error while deploying Next.JS App on Azure
 &lt;/p&gt;

&lt;p&gt;I checked my log streams on app service and saw the following detailed error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Connecting... 2020-10-27T01:02:26 Welcome, you are now connected to
log-streaming service. The default timeout is 2 hours. Change the timeout with
the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds).
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "&amp;lt;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&amp;gt;"&amp;gt;
&amp;lt;html xmlns="&amp;lt;http://www.w3.org/1999/xhtml&amp;gt;"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;IIS Detailed Error - 403.14 - Forbidden&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div id="content"&amp;gt;
      &amp;lt;div class="content-container"&amp;gt;
        &amp;lt;h3&amp;gt;HTTP Error 403.14 - Forbidden&amp;lt;/h3&amp;gt;
        &amp;lt;h4&amp;gt;
          The Web server is configured to not list the contents of this
          directory.
        &amp;lt;/h4&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;div class="content-container"&amp;gt;
        &amp;lt;fieldset&amp;gt;
          &amp;lt;h4&amp;gt;Most likely causes:&amp;lt;/h4&amp;gt;
          &amp;lt;ul&amp;gt;
            &amp;lt;li&amp;gt;
              A default document is not configured for the requested URL, and
              directory browsing is not enabled on the server.
            &amp;lt;/li&amp;gt;
          &amp;lt;/ul&amp;gt;
        &amp;lt;/fieldset&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

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

&lt;/div&gt;
Server Error from App Diagnostic Logs





&lt;p&gt;As you can tell this is trying to list the content of the web server but the server is not configured. Running NodeJS on IIS required you to have a &lt;code&gt;web.config&lt;/code&gt; and &lt;code&gt;server.js&lt;/code&gt; file that can tell the IIS server where to look for files and what port to listen on.&lt;/p&gt;

&lt;p&gt;If you encounter any &lt;code&gt;5xx&lt;/code&gt; error, the issue is likely to be the same but your &lt;strong&gt;PORT&lt;/strong&gt; defined in the &lt;code&gt;server.js&lt;/code&gt; might be incorrect. Follow through the end to fix the issue and make sure you have all the necessary files in your code to deploy the app.&lt;/p&gt;

&lt;h1&gt;
  
  
  Prepare Your Code for Azure App Service
&lt;/h1&gt;

&lt;p&gt;Before you start with the setup, make sure the following requirements are met in your environment.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All the deployments are done in Azure App Service - &lt;strong&gt;Windows OS&lt;/strong&gt; Only.&lt;/li&gt;
&lt;li&gt;I won't be covering how NextJS works, rather fix the error that you will face if you deploy the code without including the necessary set of files to Azure App Service.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installing NodeJS
&lt;/h2&gt;

&lt;p&gt;The first step toward creating a Next.JS app is to download and install Node.js. Navigate to the official Node website to grab the latest package and install it on your machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nodejs.org/en/"&gt;Node JS Installation Webpage&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up a Sample Repo
&lt;/h2&gt;

&lt;p&gt;If you are setting up a new project, you can follow along in creating a brand new project using a starter template. Run the following command in terminal to create a new project from scratch using next.js template. Source Code is also available at &lt;a href="https://github.com/vercel/next-learn-starter/tree/master/learn-starter"&gt;This GitHub 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;PS&amp;gt; npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn-starter/tree/master/learn-starter"
PS&amp;gt; cd nextjs-blog
PS&amp;gt; npm run dev

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

&lt;/div&gt;
Creating Sample Next.JS Project





&lt;p&gt;This sets up the sample code that you will be using to deploy a POC application to validate and fix the permission issue. &lt;strong&gt;&lt;em&gt;If you were to deploy your code directly to App Service at this point, you'd get the same permission issue that I described in the previous section.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Web.config File
&lt;/h2&gt;

&lt;p&gt;As I mentioned earlier, IIS server needs a config file that can run other necessary files to kickstart the deployment for Node application. Make sure &lt;code&gt;web.config&lt;/code&gt; and &lt;code&gt;server.js&lt;/code&gt; files are in the &lt;strong&gt;&lt;em&gt;root of the directory&lt;/em&gt;&lt;/strong&gt; for the webserver to trigger them during the deployment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/singhparveen/NextJS-AzureAppService"&gt;GitHub: singhparveen/NextJS-AzureAppService&lt;/a&gt;&lt;/p&gt;
GitHub Repo with Working Next.JS App for Azure



&lt;p&gt;I've uploaded the sample project that I'm using at my &lt;a href="https://github.com/singhparveen/NextJS-AzureAppService"&gt;GitHub repo&lt;/a&gt; or alternatively you can copy the code below:&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;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;!--
     This configuration file is required if iisnode is used to run node processes behind
     IIS or IIS Express. For more information, visit:

     &amp;lt;https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config&amp;gt;
--&amp;gt;

&amp;lt;configuration&amp;gt;
  &amp;lt;system.webServer&amp;gt;
    &amp;lt;!-- Visit &amp;lt;http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx&amp;gt; for more information on WebSocket support --&amp;gt;
    &amp;lt;webSocket enabled="false" /&amp;gt;
    &amp;lt;handlers&amp;gt;
      &amp;lt;!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module --&amp;gt;
      &amp;lt;add name="iisnode" path="server.js" verb="*" modules="iisnode"/&amp;gt;
    &amp;lt;/handlers&amp;gt;
    &amp;lt;rewrite&amp;gt;
      &amp;lt;rules&amp;gt;
        &amp;lt;!-- Do not interfere with requests for node-inspector debugging --&amp;gt;
        &amp;lt;rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"&amp;gt;
          &amp;lt;match url="^server.js\\/debug[\\/]?" /&amp;gt;
        &amp;lt;/rule&amp;gt;

        &amp;lt;!-- First we consider whether the incoming URL matches a physical file in the /public folder --&amp;gt;
        &amp;lt;rule name="StaticContent"&amp;gt;
          &amp;lt;action type="Rewrite" url="public{REQUEST_URI}"/&amp;gt;
        &amp;lt;/rule&amp;gt;

        &amp;lt;!-- All other URLs are mapped to the node.js site entry point --&amp;gt;
        &amp;lt;rule name="DynamicContent"&amp;gt;
          &amp;lt;conditions&amp;gt;
            &amp;lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/&amp;gt;
          &amp;lt;/conditions&amp;gt;
          &amp;lt;action type="Rewrite" url="server.js"/&amp;gt;
        &amp;lt;/rule&amp;gt;
      &amp;lt;/rules&amp;gt;
    &amp;lt;/rewrite&amp;gt;

    &amp;lt;!-- 'bin' directory has no special meaning in node.js and apps can be placed in it --&amp;gt;
    &amp;lt;security&amp;gt;
      &amp;lt;requestFiltering&amp;gt;
        &amp;lt;hiddenSegments&amp;gt;
          &amp;lt;remove segment="bin"/&amp;gt;
        &amp;lt;/hiddenSegments&amp;gt;
      &amp;lt;/requestFiltering&amp;gt;
    &amp;lt;/security&amp;gt;

    &amp;lt;!-- Make sure error responses are left untouched --&amp;gt;
    &amp;lt;httpErrors existingResponse="PassThrough" /&amp;gt;

    &amp;lt;!--
      You can control how Node is hosted within IIS using the following options:
        * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
        * node_env: will be propagated to node as NODE_ENV environment variable
        * debuggingEnabled - controls whether the built-in debugger is enabled

      See &amp;lt;https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config&amp;gt; for a full list of options
    --&amp;gt;
    &amp;lt;iisnode watchedFiles="web.config;*.js"/&amp;gt;
  &amp;lt;/system.webServer&amp;gt;
&amp;lt;/configuration&amp;gt;

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

&lt;/div&gt;
Web.Config File Content





&lt;h2&gt;
  
  
  Adding Server.js File
&lt;/h2&gt;

&lt;p&gt;Adding &lt;code&gt;Server.js&lt;/code&gt; or &lt;code&gt;App.js&lt;/code&gt; is a crucial step in case of an IIS server. This ensures that the server can handle the incoming requests and you don't end up seeing any 5xx error. Use the same GitHub repo mentioned above to grab the source code for &lt;code&gt;server.js&lt;/code&gt; file or copy the same code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { createServer } = require("http");
#const express = require('express') (Only if you app uses express)
const next = require("next");

const port = process.env.PORT || 3000;
const dev = process.env.NODE_ENV !== "production";
const app = next({ dev });
const handle = app.getRequestHandler();

app.prepare().then(() =&amp;gt; {
  createServer((req, res) =&amp;gt; {
    handle(req, res);
  }).listen(port, (err) =&amp;gt; {
    if (err) throw err;
    console.log(`&amp;gt; Ready on &amp;lt;http://localhost&amp;gt;:${port}`);
  });
});

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

&lt;/div&gt;
Server.JS File Content





&lt;h2&gt;
  
  
  Updating Node Version on App Service
&lt;/h2&gt;

&lt;p&gt;Check your Node version that's running on your local computer where you built the application. Use the following code snippet in your terminal window to confirm the node version installed on your local development environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS&amp;gt; node -v
v12.19.0

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

&lt;/div&gt;
Checking Local Node Version





&lt;p&gt;Before setting a value for your node version on app service, check the supported version that your App Service Server is running by navigation to the following URL while logged in to Azure. Replace the &lt;code&gt;webappname&lt;/code&gt; with your app service name. If your version isn't listed in the support version list, choose one that is close.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://{ ***webappname*** }.scm.azurewebsites.net/api/diagnostics/runtime

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

&lt;/div&gt;
Web Address to Check App Service Plan Supported Node Version





&lt;p&gt;Next step is to confirm if your app service is running the same or close to what version you have in dev environment. You will need to navigate to Azure Portal and check " &lt;strong&gt;Configuration&lt;/strong&gt;" under your app service overview.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DsJgVHe6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6v2p43fkid2mm8uantgi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DsJgVHe6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6v2p43fkid2mm8uantgi.png" alt="Deploying Next.JS App on Azure App Service"&gt;&lt;/a&gt;&lt;br&gt;Adding Default Node Version for App Service
 &lt;/p&gt;

&lt;p&gt;If you don't see any entry for Node version, Create a new application string using the following name &lt;code&gt;WEBSITE_NODE_DEFAULT_VERSION&lt;/code&gt; with the value of version supported by your app service plan that is close to your development version.&lt;/p&gt;
&lt;h2&gt;
  
  
  Building the Code Before Deployment
&lt;/h2&gt;

&lt;p&gt;Before you push your code to the app service, Next.JS application needs to be build beforehand so that it can generate &lt;code&gt;.next&lt;/code&gt; folder in the root directory after packaging the code.&lt;/p&gt;

&lt;p&gt;Open your terminal and run the following command to build your application. This will take a few seconds and your code will be ready for production.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;
Building Code for Production





&lt;p&gt;Results of build command should look something like this:&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; learn-starter@0.1.0 build C:\\Users\\UserName\\Documents\\nextjs-sample
&amp;gt; next build

info - Creating an optimized production build  
info - Compiled successfully
info - Collecting page data  
info - Generating static pages (2/2)
info - Finalizing page optimization

Page Size First Load JS
┌ ○ / 7.26 kB 66.3 kB  
└ ○ /404 3.44 kB 62.5 kB  
+ First Load JS shared by all 59.1 kB
  ├ chunks/framework.cb05d5.js 39.9 kB
  ├ chunks/pages/_app.af1b8e.js 1.01 kB
  └ chunks/webpack.e06743.js 751 B

)
○ (Static) automatically rendered as static HTML (uses no initial props)
● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)       
   (ISR) incremental static regeneration (uses revalidate in getStaticProps)

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

&lt;/div&gt;
Sample Output of Build Process





&lt;h1&gt;
  
  
  Publishing Code Directly to Azure App Service
&lt;/h1&gt;

&lt;p&gt;At this point, your code is ready to deploy in Azure. If you already have an app service plan and app service running in your environment, feel free to skip the first step.&lt;/p&gt;

&lt;p&gt;If you don't have any app service resource already, You can either create one using Azure Portal or follow the steps on creating one right within the VS Code environment. Make sure you have "&lt;strong&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice"&gt;Azure App Service&lt;/a&gt;&lt;/strong&gt;" extension installed already.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating App Service using VS Code
&lt;/h3&gt;

&lt;p&gt;Open your VS Code session and click on the Azure icon from the left panel. Make sure you have opened your project folder in VS Code as shown on the left side of the image below.&lt;/p&gt;

&lt;p&gt;Right-click on your target Subscription and choose "&lt;strong&gt;Create New Web App (Advanced)"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4_yChDBX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9htxp2tkaxe3m3r25gk1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4_yChDBX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9htxp2tkaxe3m3r25gk1.png" alt="Deploying Next.JS App on Azure App Service"&gt;&lt;/a&gt;&lt;br&gt;Creating New App Service using VS Code
 &lt;/p&gt;

&lt;p&gt;Fill out the following information as you are prompted.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**App Name** : {suggest a globally unique}
**Resource Group** : {Choose or select first option to create a new one}
**OS: Windows**
 **ASP** : {Create new App Service Plan-feel free to choose existing one if you wish to}
**Application Insights:** {Skip for now-feel free to use if you are interested}

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

&lt;/div&gt;
Information to Complete New App Service Resource Creation





&lt;h3&gt;
  
  
  Deploying Application using VS Code
&lt;/h3&gt;

&lt;p&gt;As the app service creation is finished, you will see a prompt confirming the deployment.&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Deploy&lt;/strong&gt; to publish your code to Azure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PsAbKpoX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bljpx203lfv1n4eee6hv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PsAbKpoX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bljpx203lfv1n4eee6hv.png" alt="Deploying Next.JS App on Azure App Service"&gt;&lt;/a&gt;&lt;br&gt;Popup to Deploy Code to Newly Created App Service
 &lt;/p&gt;

&lt;p&gt;If you don't see any prompt, simply right click on the app service name and choose &lt;strong&gt;Deploy to Web App&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vmXZquQR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9b1et0unb8q57kqm2wrr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vmXZquQR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9b1et0unb8q57kqm2wrr.png" alt="Deploying Next.JS App on Azure App Service"&gt;&lt;/a&gt;&lt;br&gt;Manual Deployment to App Service
 &lt;/p&gt;

&lt;p&gt;You will be prompted to choose a folder to deploy, use the folder that contains your source code.&lt;/p&gt;

&lt;p&gt;It'll take a minute or two to publish your code and your website will be up and running now.&lt;/p&gt;
&lt;h2&gt;
  
  
  Deploying Application using Azure DevOps
&lt;/h2&gt;

&lt;p&gt;If you are using Azure DevOps, I've added an &lt;code&gt;azure-pipelines.yml&lt;/code&gt; file inside the same GitHub repo that you can use to create a Pipeline in Azure DevOps. You'll need to create a release for your code and target the release to your subscription for a particular app service resource.&lt;/p&gt;

&lt;p&gt;Use the following YAML code for your ADO Pipeline or feel free to create a similar one using GUI in ADO.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# &amp;lt;https://docs.microsoft.com/azure/devops/pipelines/languages/javascript&amp;gt;

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- script: |
    npm install
    npm run build
  displayName: 'npm install and build'
- task: ArchiveFiles@1
  displayName: 'Archive files '
  inputs:
    rootFolder: '$(System.DefaultWorkingDirectory)'
    includeRootFolder: false

- task: CopyFiles@2
  displayName: 'Copy File to: $(TargetFolder)'
  inputs:
    SourceFolder: '$(Build.ArtifactStagingDirectory)'
    Contents: '$(Build.BuildId).zip'
    TargetFolder: '$(Build.ArtifactStagingDirectory)\\ArtifactsToBePublished'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: SampleApp'
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)\\ArtifactsToBePublished'

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

&lt;/div&gt;
azure-pipelines.yml file sample





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

&lt;p&gt;I hope you learn something new and also gained exposure to a web framework that I'm in love with now even though I started using it only a few days ago. I'd suggest making sure you include &lt;code&gt;web.config&lt;/code&gt; and &lt;code&gt;server.js&lt;/code&gt; files with correct information so that the App Service Plan can interpret and execute the startup for your application.&lt;/p&gt;

&lt;p&gt;Please leave a comment below or follow me on Twitter to stay abreast of the latest updates.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;&lt;em&gt;If it's your first time here, please check out other articles in the series:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Part 1: &lt;a href="https://parveensingh.com/up-and-running-with-azure-app-service/"&gt;Up and Running with Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 2: &lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/"&gt;Continuous Deployment for Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 3: &lt;a href="https://parveensingh.com/using-deployment-slots-with-azure-app-service/"&gt;Using Deployment Slots with Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 4: &lt;a href="https://parveensingh.com/custom-domain-azure-app-service/"&gt;Setup Custom Domain for Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 5:&lt;/strong&gt; &lt;a href="https://parveensingh.com/next-js-deployment-on-azure-app-service"&gt;&lt;strong&gt;Deploying Next.JS App on Azure App Service&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;




</description>
      <category>azureappservice</category>
      <category>react</category>
      <category>azure</category>
    </item>
    <item>
      <title>Setup Custom Domain for Azure App Service</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Tue, 20 Oct 2020 19:13:45 +0000</pubDate>
      <link>https://forem.com/parveensingh/setup-custom-domain-for-azure-app-service-3ac2</link>
      <guid>https://forem.com/parveensingh/setup-custom-domain-for-azure-app-service-3ac2</guid>
      <description>&lt;p&gt;&lt;em&gt;This is the fourth article in the "Getting Started with Azure App Service" Series where I publish in-depth tutorial and walkthrough on using Azure App Service and best practices every week. Last week, we talked about how you can use &lt;a href="https://parveensingh.com/using-deployment-slots-with-azure-app-service/"&gt;Using Deployment Slots&lt;/a&gt; for your web app services.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If it's your first time here, please check out other articles in the series:&lt;/p&gt;

&lt;p&gt;Part 1: &lt;a href="https://parveensingh.com/up-and-running-with-azure-app-service/"&gt;Up and Running With Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 2: &lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/"&gt;Continuous Deployment for Azure App Service: GitHub and Azure Repos&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 3: &lt;a href="https://parveensingh.com/using-deployment-slots-with-azure-app-service/"&gt;Using Deployment Slots with Azure App Service&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Part 4: &lt;a href="https://parveensingh.com/custom-domain-azure-app-service/"&gt;Setup Custom Domain for Azure App Service&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;Azure App Service provides you with a globally unique subdomain ending with "azurewebsites.net" which serves as a default site if you don't choose to customize it. It is likely that you don't want to continue using that domain if you are running in dev or production to test your application code.&lt;/p&gt;

&lt;p&gt;In this article, we'll set up a custom domain for your web app and walk through what configuration you need to perform to set up your new domain for app service. Stick with me to the end and warm up your app service for some action!&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Prerequisite&lt;/li&gt;
&lt;li&gt;
Configuring Custom Domain

&lt;ul&gt;
&lt;li&gt;Choosing a Right App Service Plan&lt;/li&gt;
&lt;li&gt;Adding Root Domain to App Service&lt;/li&gt;
&lt;li&gt;Adding Subdomain to App Service&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Prerequisite
&lt;/h1&gt;

&lt;p&gt;If you decide to follow along, I'd like to address some of the pre-requisites that will help you follow the steps in the article. Make sure you fulfill the requirements listed below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You must have an active Azure Subscription with Azure App Service resource deployed.&lt;/li&gt;
&lt;li&gt;You must have a custom domain purchased through a domain service provider. Use &lt;a href="http://domains.google.com/"&gt;THIS URL&lt;/a&gt; to search available domains if you don't have one already.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Configuring Custom Domain
&lt;/h1&gt;

&lt;p&gt;Adding a custom domain to Azure App Service requires you to have access to your domain provider service where you will need to update DNS records to confirm that you own the domain. You can choose to use a root domain or a subdomain to redirect to your application based on your requirement. I'll be following both approaches and showing you where you can configure your custom domain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing a Right App Service Plan
&lt;/h2&gt;

&lt;p&gt;Custom Domain is supported only on Basic or higher-tier plans. F1:Free tier doesn't support the custom domain or SSL to secure your web service. If your app service plan doesn't support the custom domain, you'd get an error as shown in the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IKB9FlzH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bo1b1v15a1ax334h5gja.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IKB9FlzH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bo1b1v15a1ax334h5gja.png" alt="01CustomDomainOption"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the highlighted text to choose the right service plan for your app service. I'll be selecting the cheapest option for demo purposes to give you a glance of what's required.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k2C0R6KH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/la6thigs9vgl70hkamhv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k2C0R6KH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/la6thigs9vgl70hkamhv.png" alt="02PlanChangeOption"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose any plan from the listed option as it'll show you only the supported plans that include the custom domain in its feature. Hit &lt;strong&gt;apply&lt;/strong&gt; once your device the plan for your app service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Root Domain to App Service
&lt;/h2&gt;

&lt;p&gt;If you wish to use your root domain for app service, follow the steps below to perform the setup.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Azure Portal and locate your App Service resource.&lt;/li&gt;
&lt;li&gt;Click on the "&lt;strong&gt;Custom Domains&lt;/strong&gt;" option on the left blade and click "&lt;strong&gt;+ Add Custom Domain&lt;/strong&gt;"&lt;/li&gt;
&lt;li&gt;Enter the full path of your domain. i.e. "pvsingh.me" in this case and click &lt;strong&gt;Validate&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4FH_9b8m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wzcfa0ng1q2l9aj6d1n4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4FH_9b8m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wzcfa0ng1q2l9aj6d1n4.png" alt="03AddCustomDomain"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upon clicking validate, a new window will popup with the hostname record that you need to set up in order to verify the domain ownership.&lt;/li&gt;
&lt;li&gt;It's worth noting that, if you choose to use your root domain, you should always configure "&lt;strong&gt;A Record&lt;/strong&gt;" for your DNS.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Follow the table under "Domain Ownership" and add the entries to your DNS Server on your domain provider portal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W0RtP-z_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6u1fuxmkrk0ogrcntkkj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W0RtP-z_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6u1fuxmkrk0ogrcntkkj.png" alt="04ValidateRootDomain"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DNS Entries should look like this. (referencing google domain portal)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3MmcKXSV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2zyrih9hqldx3vbvhk3u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3MmcKXSV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2zyrih9hqldx3vbvhk3u.png" alt="05DNSRootDomain"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Domain entries may take some time to propagate based on your domain provider. You can check the status by clicking validate to see if the entries are synced already. Once the changes are confirmed, validation will show success, and "Add Custom Domain" will become active.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--np4PRDgg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1z02icrt3n0yz67sjax0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--np4PRDgg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1z02icrt3n0yz67sjax0.png" alt="06ValidateRootDomain"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After adding the custom domain, your web app service will be instantly available on the newly configured domain.&lt;/li&gt;
&lt;li&gt;Navigate to the URL to confirm that your application is running on the newly configured domain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ho5t_q05--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/57d2ig0o0pmvk90ea1h4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ho5t_q05--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/57d2ig0o0pmvk90ea1h4.png" alt="07FinalRootDomain"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Subdomain to App Service
&lt;/h2&gt;

&lt;p&gt;If you choose to use a subdomain for your app service, follow the steps below and it'll get you started with using a subdomain for your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Azure Portal and locate your App Service resource.&lt;/li&gt;
&lt;li&gt;Click on the "&lt;strong&gt;Custom Domains&lt;/strong&gt;" option on the left blade and click "&lt;strong&gt;+ Add Custom Domain&lt;/strong&gt;"&lt;/li&gt;
&lt;li&gt;This time, enter the subdomain you want to use and click "&lt;strong&gt;Validate&lt;/strong&gt;"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nGfvWhmg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/czf2vmugqn9l5by80xoz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nGfvWhmg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/czf2vmugqn9l5by80xoz.png" alt="08SetupDNSRecords"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As you see, you'll be prompted to use CNAME now with some entries below as before.&lt;/li&gt;
&lt;li&gt;Fill out the DNS records on your DNS provider portal which should look something like this:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a03LDNTj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oi03llehk50jpqqhxbak.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a03LDNTj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oi03llehk50jpqqhxbak.png" alt="09DNSEntries"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validate the change on the Azure portal after few minutes and Add the subdomain as your custom domain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fcaIIDd9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/by69zyw7wioap8sqoyxq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fcaIIDd9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/by69zyw7wioap8sqoyxq.png" alt="10ValidateandAddDomain"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Just like before, use the subdomain URL to validate the changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--njxdVnQI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kbl5vrnm114qji4b2try.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--njxdVnQI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kbl5vrnm114qji4b2try.png" alt="11FinalResults"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your domain URL will reflect on your app service overview. This URL point to the default endpoint for your web application.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j4eV-Ohe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n8bklf3yg117rys2uay0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j4eV-Ohe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n8bklf3yg117rys2uay0.png" alt="12Ovewview"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;I hope that helped you set up a custom domain for your app service resource. I'll be writing about more exciting topics on App Service in the coming weeks. Feel free to leave out a comment or suggestions if you gain any useful information from these articles.&lt;/p&gt;




</description>
      <category>azure</category>
      <category>domain</category>
      <category>devops</category>
    </item>
    <item>
      <title>Using Deployment Slots with Azure App Service</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Tue, 13 Oct 2020 03:53:25 +0000</pubDate>
      <link>https://forem.com/parveensingh/using-deployment-slots-with-azure-app-service-2bb4</link>
      <guid>https://forem.com/parveensingh/using-deployment-slots-with-azure-app-service-2bb4</guid>
      <description>&lt;p&gt;&lt;em&gt;This is the third article in the "Getting Started with Azure App Service" Series where I publish in-depth tutorial and walkthrough on using Azure App Service and best practices every week&lt;/em&gt;. Last week, we talked about how you can use &lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/" rel="noopener noreferrer"&gt;CI-CD in App Service to enable DevOps capabilities&lt;/a&gt; for your web services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If it's your first time here, please check out other articles in the series:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Part 1: &lt;a href="https://parveensingh.com/up-and-running-with-azure-app-service/" rel="noopener noreferrer"&gt;Up and Running with Azure App Service&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 2: &lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/" rel="noopener noreferrer"&gt;Continuous Deployment for Azure App Service&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Deployment slots are live applications running with their unique hostname, however, connected to a particular app service plan. Slots can reduce the overall downtime of web services by auto-swap capabilities and full integration in pipeline workflow to test and validate code changes before pushing them to production.&lt;/p&gt;

&lt;p&gt;Suppose you have a production application at &lt;a href="http://prod.example.com" rel="noopener noreferrer"&gt;prod.example.com&lt;/a&gt; and you wish to test some changes in the same environment as your production application but not actually deploy the site. That's where deployment slots come and make it a seamless experience to deploy your site to a slot, call it '&lt;strong&gt;staging&lt;/strong&gt;' and your application would be running on a similar environment at different URL, &lt;a href="http://prod-staging.example.com" rel="noopener noreferrer"&gt;prod-staging.example.com&lt;/a&gt;. You can test your application thoroughly before pushing it to production.&lt;/p&gt;

&lt;p&gt;In this article, I'll be covering the basics of deployment slots and a guide on how to use them for tests and validating the code before it goes live. I'll be using a sample node js webserver to demonstrate how you can configure the slots and use them in the real world in a few simple steps.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;
Overview of App Service Slots

&lt;ul&gt;
&lt;li&gt;App Service Plan Consideration&lt;/li&gt;
&lt;li&gt;Why should you use Deployment Slots?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Prerequisite&lt;/li&gt;
&lt;li&gt;Creating an App Service Resource&lt;/li&gt;
&lt;li&gt;Creating an App Service Slot&lt;/li&gt;
&lt;li&gt;Setting up Deployment Center for Staging Slot&lt;/li&gt;
&lt;li&gt;Changing Code on Local Repo&lt;/li&gt;
&lt;li&gt;Swapping Production Slot with Staging Slot&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Overview of App Service Slots
&lt;/h1&gt;

&lt;p&gt;Since the slot creates a new app service under the same app service plan, any settings that you modify for a particular slot won't migrate to the production slot on swaps. You need to consider the changes that might occur to your application after swapping the slots. For instance, if your application uses a sandbox version of database connection in staging, make sure your code handles that scenario using app service connection strings so that it updates as the code runs in the production environment.&lt;/p&gt;

&lt;p&gt;Below are some of the settings that are swapped along with the codebase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;General settings, such as framework version, 32/64-bit, web sockets&lt;/li&gt;
&lt;li&gt;App settings (can be configured to stick to a slot)&lt;/li&gt;
&lt;li&gt;Connection strings (can be configured to stick to a slot)&lt;/li&gt;
&lt;li&gt;Handler mappings&lt;/li&gt;
&lt;li&gt;Public certificates&lt;/li&gt;
&lt;li&gt;WebJobs content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You should also consider the settings that are dedicated to a particular app service instance and never transferred on a swap. Below is a list of settings from official Microsoft docs website:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Publishing endpoints&lt;/li&gt;
&lt;li&gt;Custom domain names&lt;/li&gt;
&lt;li&gt;Non-public certificates and TLS/SSL settings&lt;/li&gt;
&lt;li&gt;Scale settings&lt;/li&gt;
&lt;li&gt;WebJobs schedulers&lt;/li&gt;
&lt;li&gt;IP restrictions&lt;/li&gt;
&lt;li&gt;Always On&lt;/li&gt;
&lt;li&gt;Diagnostic settings&lt;/li&gt;
&lt;li&gt;Cross-origin resource sharing (CORS)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  App Service Plan Consideration
&lt;/h2&gt;

&lt;p&gt;Choosing the right app service plan is one of the key decisions while working with app service. You don't want to end up buying more capacity and resources than necessary. To use slots for your application, you can choose any of the following plans which include Custom Domain/SSL and Slots as well which should serve your purpose even if you are running any production workloads in real-world scenarios.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Plan S1: A Series compute with 1.75GB Memory, ~82.23 CAD/Month (Estimated)&lt;/li&gt;
&lt;li&gt;Plan P1V2: Dv2 Series compute, 3.5 GB Memory, ~103.72 CAD/Month (Estimated)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You also have a lot more options in the app service plan if you need more memory or dedicated CPUs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why should you use Deployment Slots?
&lt;/h2&gt;

&lt;p&gt;Deployment Slots is one of the robust features available in App Service resource that enables you to run production like workload and test your code on every change before pushing the code into production. It's even more powerful when combined with CI-CD Pipeline performing the deployment, approval workflow, and automated swaps for the application slot. Below are some of the key benefits of using deployment slots.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can validate app changes in a staging deployment slot before swapping it with the production slot.&lt;/li&gt;
&lt;li&gt;Deployment slots eliminate the downtime caused by some IIS applications that need to warm up before it's fully functional. The auto-swap feature gives you the capability to swap the slots automatically if the validations aren't needed.&lt;/li&gt;
&lt;li&gt;You can always revert your application to your "last known good site" in case of any issue after code changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Prerequisite
&lt;/h1&gt;

&lt;p&gt;If you wish to test and follow the steps in this tutorial, make sure you fulfill the following requirements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;VS Code Editor (optional)&lt;/strong&gt;: You need access to an editor, VS Code or any other editor of your choice to add/modify code for slot swap testing. This can be performed directly from Azure Repo or GitHub portal as well.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Azure DevOps or GitHub Repo&lt;/strong&gt;: You need to store a sample app code for your app service. Clone/Fork my GitHub repo if you wish to use this as an example to test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/singhparveen/nodejs-plainwebapp" rel="noopener noreferrer"&gt;https://github.com/singhparveen/nodejs-plainwebapp&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I'll be referencing this new app service as "&lt;strong&gt;staging application&lt;/strong&gt;" and the primary app service as "&lt;strong&gt;production application&lt;/strong&gt;".&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating an App Service Resource
&lt;/h1&gt;

&lt;p&gt;The very first thing you would want to do is to set up the app service with a sample webserver to test changes and perform the swap. The process includes creating an app service slot with sample code, creating a deployment slot, connecting your slot with CI-CD to enable auto-sync, making changes to the codebase, and finally triggering the slots for the swap.&lt;/p&gt;

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

&lt;p&gt;Use the following steps to create a new app service if you don't have one set up already.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://parveensingh.com/azure-app-service-continuous-integration-github-azure-repos/#using-azure-portal-for-app-service-deployment" rel="noopener noreferrer"&gt;Using Azure Portal for App Service Deployment&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once your app service is ready, you should see a similar webpage with some generic text confirming that your application is up and running.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F57up7c4zseyecwcz1zf0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F57up7c4zseyecwcz1zf0.png" alt="app-service-web-service-created"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating an App Service Slot
&lt;/h1&gt;

&lt;p&gt;The next thing you need to do it to create a new slot for running a staging environment. This creates a new resource with the name specified in the steps that will run your staging application. This can be done with a few clicks from the Azure Portal. Follow the instructions below to create your first app service slot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to your Azure App Service that you created in your environment.&lt;/li&gt;
&lt;li&gt;Click on "&lt;strong&gt;Deployment Slots&lt;/strong&gt;" in the left panel and click "&lt;strong&gt;Add Slot&lt;/strong&gt;" to create a new slot.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Give it a name like "&lt;strong&gt;staging&lt;/strong&gt;" so that you can identify it easily.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;At this point, your deployment slot is ready and you should see a new app service (slot) in your resource group as a dedicated resource that will host your code as you push it from the repository. The staging app name is given a name as "&lt;strong&gt;staging/&lt;/strong&gt;" in resource group for easy identification.&lt;/p&gt;

&lt;h1&gt;
  
  
  Setting up Deployment Center for Staging Slot
&lt;/h1&gt;

&lt;p&gt;Once you configure your staging slot, it's time to connect that slot to a git repo, whether you are using GitHub or Azure DevOps, so that any code change is deployed to staging for testing before it goes live. This process ensures that you can validate any code changes in the staging environment and then swap when changes are validated. Follow the steps below to configure your deployment source for staging slot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the deployment slot and click on your newly created staging slot.&lt;/li&gt;
&lt;li&gt;Navigate to "&lt;strong&gt;Deployment Center&lt;/strong&gt;" for the slot. Make sure you are working with your slot named "&lt;strong&gt;staging&lt;/strong&gt; (appname/staging)"&lt;/li&gt;
&lt;li&gt;Choose the repo location of your choice and finish the repo integration.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Give it about 5-10 mins for the deployment to finish and code to update in the app service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now you should start seeing your staging application running on &lt;strong&gt;&lt;em&gt;&lt;a href="https://appname-staging.azurwebsites.net" rel="noopener noreferrer"&gt;https://appname-staging.azurwebsites.net&lt;/a&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Changing Code on Local Repo
&lt;/h1&gt;

&lt;p&gt;The next step is to make changes to your code and push it back to your repository so that the changes can be synced and visible on staging slot. You can use VS Code or any other editor of your choice. If you are using GitHub or Azure DevOps, you can make changes directly to the file by clicking "&lt;strong&gt;edit&lt;/strong&gt;" for any particular file while logged in to GitHub or Azure DevOps portal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open "&lt;strong&gt;index.js&lt;/strong&gt;" file, if you are using "&lt;strong&gt;&lt;em&gt;nodejs-planwebapp&lt;/em&gt;&lt;/strong&gt;" from my GitHub Repo.&lt;/li&gt;
&lt;li&gt;Add the following text at line 167/168.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If you using VS Code, run the following commands in your terminal to save and commit your code back to the remote repository.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;PS&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;git&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;PS&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;git&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;commit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Adding line-3 for staging slot"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;PS&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;git&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The changes should reflect on your staging environment. If you see the changes on your staging website, Good job! Keep going through the rest of the article to finish the swap process.&lt;/p&gt;

&lt;h1&gt;
  
  
  Swapping Production Slot with Staging Slot
&lt;/h1&gt;

&lt;p&gt;If you made it to this point, you are almost done. The last steps in here it to press "&lt;strong&gt;swap&lt;/strong&gt;" button to perform the swap and observe the magic app service does in the backend to replace the production app code with staging and vice-versa. Follow along the steps explained below to finish the swap:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate back to your production app and click on "&lt;strong&gt;Deployment Slots&lt;/strong&gt;".&lt;/li&gt;
&lt;li&gt;Click "&lt;strong&gt;Swap&lt;/strong&gt;" option to initiate the swap process.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Select the source and target repo to deploy to and proceed with the swap.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdpg8ykxurtgdqi666euu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdpg8ykxurtgdqi666euu.png" alt="07-DeploymentSlot-Swap2"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You should see a success message saying that the swap is complete now.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;The swap should take only a few seconds and your code will reflect on the production slot. You should see that your production code is swapped with a staging app and the production application is running the latest changes made to the code earlier.&lt;/p&gt;

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

&lt;p&gt;As you saw, swapping two slots only takes a few clicks. However, it's never that simple in production running applications. Is it? 😉 You should always test your application in non-production environment before using slots for your production application as there might be little nuances that can cause trouble during the swap.&lt;/p&gt;

&lt;p&gt;Start using Deployment Slots and let me know what you think of them in the comments below!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Feel free to send me your feedback or ideas if you'd like me to write about any particular configuration in Azure App Service.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>appservice</category>
      <category>automation</category>
    </item>
    <item>
      <title>Continuous Deployment for Azure App Service: GitHub and Azure Repos</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Thu, 08 Oct 2020 04:07:20 +0000</pubDate>
      <link>https://forem.com/parveensingh/continuous-deployment-for-azure-app-service-github-and-azure-repos-4oog</link>
      <guid>https://forem.com/parveensingh/continuous-deployment-for-azure-app-service-github-and-azure-repos-4oog</guid>
      <description>&lt;p&gt;DevOps has become a hot topic in the IT industry due to the increased demand for reducing manual efforts and operationalize the workflow using automation tools and techniques. The idea of using the DevOps strategy is to reduce the overall efforts and errors, ultimately building more scalable and stable application environments.&lt;/p&gt;

&lt;p&gt;Continuous Integration(CI) and Continuous Development(CD) strategy has become one of the core components and best practices of building agile workloads that can support frequent updates by multiple contributors and still be able to build, test and deploy robust infrastructure.&lt;/p&gt;

&lt;p&gt;In the last article, I introduced you to Azure App Service and explained some high-level information about its capabilities and functionalities. I'll be continuing the series and giving you in-depth tutorials on how to leverage app services to get the maximum out of its capabilities. Check out my previous article below, in case you missed it.&lt;/p&gt;

&lt;p&gt;In this article, I'll guide you through how to create Azure App Service resources and also enable continuous deployment to leverage DevOps capabilities for your application code. Stick with me to the end and you'll see how painless and straightforward it is to enable CI/CD capabilities for your application.&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Assumptions&lt;/li&gt;
&lt;li&gt;
Creating a Resource Group for App Service

&lt;ul&gt;
&lt;li&gt;Creating a Resource Group using PowerShell/CLI&lt;/li&gt;
&lt;li&gt;Creating Resource Group using Azure Portal&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Creating Azure App Service Resource

&lt;ul&gt;
&lt;li&gt;Using PowerShell for App Service Deployment&lt;/li&gt;
&lt;li&gt;Using Azure Portal for App Service Deployment&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Setting up Continuous Integration and Continuous Deployment (CI/CD)

&lt;ul&gt;
&lt;li&gt;Configuring CI/CD with Azure Repos&lt;/li&gt;
&lt;li&gt;Configuring CI/CD with GitHub Repos&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Assumptions
&lt;/h1&gt;

&lt;p&gt;Before I begin with the configuration and deployment, I'll make some assumptions so that you can catch and prepare yourself before we being.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You should be familiar with Azure Portal and navigating inside the portal.&lt;/li&gt;
&lt;li&gt;You should have an active account on GitHub or Azure DevOps.&lt;/li&gt;
&lt;li&gt;You should be able to access &lt;a href="http://shell.azure.com/" rel="noopener noreferrer"&gt;shell.azure.com&lt;/a&gt; using your Azure account or be able to use PowerShell or CLI on your local computer (optional).&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Creating a Resource Group for App Service
&lt;/h1&gt;

&lt;p&gt;First of all, you need a resource group that will host your App Service and other dependent resources like App Service Plan and App Insights. You can choose to leverage any existing resource group if you already have one. The creation of a resource group is pretty simple and you can use either PowerShell or Azure Portal for this task as described below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Resource Group using PowerShell/CLI
&lt;/h2&gt;

&lt;p&gt;Use the following PowerShell or CLI command based on your preference. Feel free to change the resource group name and location as needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;New-AzResourceGroup&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"RGName"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Canada Central"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;## OR&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="n"&gt;az&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;group&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"RGName"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;canadacentral&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating Resource Group using Azure Portal
&lt;/h2&gt;

&lt;p&gt;If you are comfortable using Azure Portal, follow the steps below to create a new resource group.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login to Azure Portal (portal.azure.com)&lt;/li&gt;
&lt;li&gt;In the top search bar, search for "&lt;strong&gt;Resource Group"&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Click "&lt;strong&gt;Add&lt;/strong&gt;" on the next screen.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Fill the information for your resource group name and click "&lt;strong&gt;Review and Create&lt;/strong&gt;". This should give you an option to create the resource group once you review the final configuration.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Once you deploy the resource group, move to the next section for some more interesting work now.&lt;/p&gt;

&lt;h1&gt;
  
  
  Creating Azure App Service Resource
&lt;/h1&gt;

&lt;p&gt;Before setting up the CI/CD Pipeline, a Web App resource is required that'd connect with your Repository of choice for the code integration. You can deploy the necessary resources using either PowerShell or Azure Portal. I've provided the steps for both options, feel free to choose one of them to deploy the app service resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using PowerShell for App Service Deployment
&lt;/h2&gt;

&lt;p&gt;Creating App Service using PowerShell or CLI involves deploying dependent resources like App Service Plan before the app service itself. App Service Plan is used to host the application and its runtime environment. Follow through the steps below and be sure to change the variable names based on your resource naming convention.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"East US"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$ResourceGroupName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ps-webcicd-rg"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$PlanName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AppServicePlan01"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$AppName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CICDApp-&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="n"&gt;Get-Random&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$Plan&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;New-AzAppServicePlan&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ResourceGroupName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ResourceGroupName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$PlanName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Tier&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Free"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$App&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;New-AzWebApp&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ResourceGroupName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ResourceGroupName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$AppName&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-AppServicePlan&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$PlanName&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Using Azure Portal for App Service Deployment
&lt;/h2&gt;

&lt;p&gt;Are you a fan of using Azure Portal instead? I've got you covered!&lt;/p&gt;

&lt;p&gt;Follow the steps below to deploy your app service resource using the Azure Portal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the resource group that you wish to use for your App Service resource.&lt;/li&gt;
&lt;li&gt;Click "&lt;strong&gt;Add&lt;/strong&gt;" on the top left to see the list of resources to choose from.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Choose "&lt;strong&gt;Web App&lt;/strong&gt;" from the list.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Fill out the details as per your application's usage. I'll be using NodeJS with "&lt;strong&gt;Node 12 LTS&lt;/strong&gt;" Runtime. Be sure to use "&lt;strong&gt;F1&lt;/strong&gt;" Free tier for your application to avoid any resource cost. &lt;em&gt;It's FREE of cost&lt;/em&gt; 😉&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Finish the next steps by clicking "&lt;strong&gt;Review and Create&lt;/strong&gt;".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now with that, you deployed your web app and an app service plan from a single panel. In the next step, you'll configure the continuous deployment for the newly created app service with GitHub and Azure DevOps.&lt;/p&gt;

&lt;h1&gt;
  
  
  Setting up Continuous Integration and Continuous Deployment (CI/CD)
&lt;/h1&gt;

&lt;p&gt;At this point, you should have your application up and running with a generic web page that you get out-of-box. The next step is to configure the deployment repo for your application. To do this, you'll be connecting the app service with GitHub using an option in the app service called "&lt;strong&gt;deployment center&lt;/strong&gt;".&lt;/p&gt;

&lt;p&gt;Before you move forward with the configuration, use the link below to copy, clone or fork my Repository that contains a sample node web application so that you have a sample code to play with during the setup. Store the code in either GitHub or &lt;a href="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization?view=azure-devops" rel="noopener noreferrer"&gt;Azure DevOps Repo&lt;/a&gt; depending on which platform you choose for connection. I'll be using this repository as a CI/CD source for the demo of both Azure and GitHub Repos.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/singhparveen/nodejs-plainwebapp" rel="noopener noreferrer"&gt;GitHub:singhparveen/nodejs-plainwebapp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next final step to this configuration is to enable Repo access for continuous development. To do this, you need to navigate to the newly deployed app service resource and choose &lt;strong&gt;Deployment Center&lt;/strong&gt; from the left panel.&lt;/p&gt;

&lt;p&gt;Refer to this same page whether you want to connect Azure Repos or GitHub repo. I'll be explaining both approaches from here.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Configuring CI/CD with Azure Repos
&lt;/h2&gt;

&lt;p&gt;If you are connecting your Azure Repos with Azure App, make sure you have already created an Azure DevOps Organization to store your project files. Once ready, continue with the steps below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on "&lt;strong&gt;Azure Repos"&lt;/strong&gt; and press &lt;strong&gt;Continue&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Azure Repo supports Azure Pipeline build which creates a pipeline and release build for you in Azure DevOps that is automatically triggered on code updates.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If you see the image below when trying to connect, you probably haven't created the Azure DevOps Organization and Projects yet. Follow the &lt;a href="https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization?view=azure-devops" rel="noopener noreferrer"&gt;steps here&lt;/a&gt; to configure your Project and store repos. Once the project is configured, refresh the Azure Portal and follow the steps again to add Azure Repo for deployment center integration.&lt;/p&gt;

&lt;p&gt;Make sure that the Account used for Azure Portal Login has permissions to the DevOps Organization as well or it won't be able to access any projects and repos.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Once the Connection is successful with the Azure DevOps, you should start seeing the Organization that you have access to and the projects within each organization.&lt;/li&gt;
&lt;li&gt;Choose the repo that you copied or cloned earlier. Since it's a Node project, make sure you set the startup command to &lt;code&gt;npm start&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Click finish when done and your application should be up and running now without much effort.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Configuring CI/CD with GitHub Repos
&lt;/h2&gt;

&lt;p&gt;If you wish to use GitHub Repos instead of Azure Repo, follow the same steps to choose Deployment Center from the application blade.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unlike last time, choose "&lt;strong&gt;GitHub&lt;/strong&gt;" instead and press &lt;strong&gt;Continue&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You might need to authorize and allow permission to your GitHub account. Use the sign-in form when prompted to authenticate to GitHub and connect your repos with App Service.&lt;/li&gt;
&lt;li&gt;Choose the "&lt;strong&gt;App Service Build Service&lt;/strong&gt;" for your build provider as it'll compile your code automatically during deployment.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Choose the repo that you copied earlier and finish the process.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Just within a few minutes, your application should be up and running on App Service.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, your application is fully integrated with App Service and any changes that you make to your code repo will be synced and changes will reflect in real-time.&lt;/p&gt;

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

&lt;p&gt;I hope that sets you up for success with deploying CI/CD Pipeline for your Azure App Service to sync code updates to your web application without any effort during the change process.&lt;/p&gt;

&lt;p&gt;Leave a comment down below if you liked what you read, and I will see you in the next one.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>serverless</category>
      <category>webdev</category>
      <category>devops</category>
    </item>
    <item>
      <title>Up and Running with Azure App Service</title>
      <dc:creator>Parveen Singh</dc:creator>
      <pubDate>Tue, 06 Oct 2020 05:58:40 +0000</pubDate>
      <link>https://forem.com/parveensingh/up-and-running-with-azure-app-service-45b1</link>
      <guid>https://forem.com/parveensingh/up-and-running-with-azure-app-service-45b1</guid>
      <description>&lt;p&gt;This article was originally published at: &lt;br&gt;
&lt;a href="https://parveensingh.com/up-and-running-with-azure-app-service/"&gt;https://parveensingh.com/up-and-running-with-azure-app-service/&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Are you still running your web servers on Linux or Windows-based VMs in the cloud? When was the last time you checked how much resources your web app is using and whether you need to scale it up or down to improve performance or save cost? Probably, not so often!&lt;/p&gt;

&lt;p&gt;The whole point of being in the cloud is leveraging the ability to run scalable and resilient infrastructure without compromising user experience. If you are using cloud services and still practicing the traditional route of using VMs instances for development, you clearly haven't migrated to the cloud yet! Start using the services that are built for the purpose so that you uncover all the possibilities of improvement and enhancement in your application that you would not think of otherwise.&lt;/p&gt;

&lt;p&gt;In this article, I'll be providing a high-level overview of the exact tools that you need to build modern, scalable, resilient, and redundant applications all with cost-saving in mind so that you only pay for what you use.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Azure App Service?
&lt;/h1&gt;

&lt;p&gt;Microsoft provides a solution to host web-based services in form of application, REST APIs, or mobile backend known as Azure App Service. It's similar to a web server, but here you only focus on your code instead of updating your host for patches every other week. With the wide range of support for the language, you can deploy your application in .NET, .NET Core, Java, Python, Ruby, PHP, or Node.js. App Service support running application at scale on either Windows or Linux based environment.&lt;/p&gt;

&lt;p&gt;App Service is &lt;strong&gt;the easiest way&lt;/strong&gt; of running your application in Azure as it lets you focus on creating the application code, not on running it. Let's see what App Service can do and how it can solve your application needs.&lt;/p&gt;

&lt;h1&gt;
  
  
  App Service Capabilities and Functionality
&lt;/h1&gt;

&lt;p&gt;Azure App Service includes a wide variety of functionality including auto-scaling, load-balancing, automated deployment, and security integration with Azure AD. As the demand for CI/CD and automation increases, App Service lets you configure those DevOps capabilities and configure the deployments using GitHub, Azure DevOps, Docker Hub, and may other sources..&lt;/p&gt;

&lt;p&gt;Let's explore some of the core features that App Service offers and how you can leverage them to solve your business needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  App Service Plan
&lt;/h2&gt;

&lt;p&gt;As with any traditional web service, you need a hosting server where the code will be published and hosted. Azure offers that with "&lt;strong&gt;App Service Plan&lt;/strong&gt;" that provides you with a fully isolated and dedicated environment to securely run your applications at a high scale. Think of this as Azure VM running in a secure environment that is fully managed by Azure.&lt;/p&gt;

&lt;p&gt;As of today, you can choose from the following pricing tier for using an app service plan.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shared Compute&lt;/strong&gt;: App Service Plan offers two-tier on shared compute, &lt;strong&gt;Free&lt;/strong&gt; and &lt;strong&gt;Shared&lt;/strong&gt; which runs your services on the same Azure VM, sharing the underlying host instance. The resources are allocated for each customer instance that runs on the shared resource based on the chosen tier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dedicated Compute&lt;/strong&gt;: If you choose to run your service on a dedicated host, you get three tiers to choose from. The &lt;strong&gt;Basic&lt;/strong&gt;, &lt;strong&gt;Standard,&lt;/strong&gt; and &lt;strong&gt;Premium&lt;/strong&gt; tier offers you a dedicated host that hosts only the services you choose to run on top of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolated Instance&lt;/strong&gt;: If you ever need to run your service or application without any connection or exposure to other instances in the same Azure network, &lt;strong&gt;Isolated Instance&lt;/strong&gt; provides you with a fully isolated compute option running on a dedicated Azure virtual network which can integrate with your local virtual network for network-level isolation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Operating System Support
&lt;/h2&gt;

&lt;p&gt;With the mixture of Linux and Windows-based web services in the cloud, App Services also allows you to choose the type of operating systems that you need so that your application architecture doesn't suffer and it provides the same runtime environment that your application needs for your code to function properly.&lt;/p&gt;

&lt;p&gt;Since the App Service is a managed service, you don't get direct access to the host operating systems that the apps run on. Likewise, if you are hosting a container in App Service, you still get full access to your container instance through but not the host it runs on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment Slots
&lt;/h2&gt;

&lt;p&gt;Deployment Slot is one of the features in App Service that provides more value than you'd expect. It lets you create a slot for your application and act as a fully-functional version of your production application. It gives you an opportunity to test your application in your App Service environment before pushing directly to production.&lt;/p&gt;

&lt;p&gt;Let's suppose your application takes 2-5 minutes(may vary in your case) to warm up and perform initial tasks before it's functional, you would not want your customers to wait for that long whenever a new update is released. That's where you'd use Deployment Slot by creating a new slot and switch the slot with your production app when your application is ready and running as normal. It is as simple as clicking one button to switch your slots and push your code to production.&lt;/p&gt;

&lt;p&gt;Check out more details at the link below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots?WT.mc_id=parveensingh.com"&gt;https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots?WT.mc_id=parveensingh.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment Center
&lt;/h2&gt;

&lt;p&gt;Are you already using GitHub or Azure DevOps as your code repository? If yes, Integrate it right within your application and get a seamless deployment experience without any complex setup. &lt;/p&gt;

&lt;p&gt;Deployment Center enables you to connect your Application with any repository for continuous delivery and code change updates. App Service supports continuous deployment from Azure DevOps, GitHub, and Bitbucket where app services pull the latest changes seamlessly from the source control to keep your app code up to date.&lt;/p&gt;

&lt;p&gt;More information at the link below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment"&gt;https://docs.microsoft.com/en-us/azure/app-service/deploy-continuous-deployment&lt;/a&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots?WT.mc_id=parveensingh.com"&gt;?WT.mc_id=parveensingh.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scale Up-Out
&lt;/h2&gt;

&lt;p&gt;How would you scale your application if it's running on an Azure VM? Probably shut it down and resize, right? Hold right there!&lt;/p&gt;

&lt;p&gt;The scale-out feature has just the right configuration that you need for your application to scale automatically without even touching it. Whether you want 1 or 10 instances of your application, the auto-scaling feature provides you just that with a simple rule setup defined with pre-configured conditions that will trigger resource creation and destruction based on the workload of your application.&lt;/p&gt;

&lt;p&gt;See what else can you do with Scaling in Azure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/manage-scale-up"&gt;https://docs.microsoft.com/en-us/azure/app-service/manage-scale-up&lt;/a&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots?WT.mc_id=parveensingh.com"&gt;?WT.mc_id=parveensingh.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication and Authorization
&lt;/h2&gt;

&lt;p&gt;If you are building any production running application, chances are that you are either handling the Authentication and Authorization in your code or using a third-party module to support that feature. Luckily, Microsoft provides you with direct integration of application authorization and authentication without you worrying about all the maintenance and management.&lt;/p&gt;

&lt;p&gt;Since App Service uses the Federated Identity, you can integrate any major identity provide in your codebase like Azure Active Directory, Microsoft Account, Facebook, Google, and Twitter along with support for other OpenID Connect providers as well.&lt;/p&gt;

&lt;p&gt;More in-depth information below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization"&gt;https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization&lt;/a&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/manage-backup?WT.mc_id=parveensingh.com"&gt;?WT.mc_id=parveensingh.com&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Backups
&lt;/h2&gt;

&lt;p&gt;Backups are a crucial part of running the application in production where you'd want to make sure you have a safe copy of your application in case you need to roll back to the previous date. App Service provides you with an in-built option to enable backups for your application with support for one-click restore to either a different application or overwriting existing app.&lt;/p&gt;

&lt;p&gt;Check out more in-depth information on the article below: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/manage-backup?WT.mc_id=parveensingh.com"&gt;https://docs.microsoft.com/en-us/azure/app-service/manage-backup?WT.mc_id=parveensingh.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom Domains and SSL
&lt;/h2&gt;

&lt;p&gt;If you are running your application in Azure, you should set up your own domain as an entry point instead of azurwebsites.com subdomain provided by Microsoft for free. App Service allows you to either purchase a domain directly from the app service options or connect your existing domain by verifying the domain membership.&lt;/p&gt;

&lt;p&gt;Domain Verification usually involves adding a CNAME and A record for either root or subdomain based on what you are adding. Since Shared Infrastructure is intended to be used for development only, Custom Domain is not supported in "&lt;strong&gt;F1 Shared Infrastructure&lt;/strong&gt;" as you'd need to be on at least "&lt;strong&gt;D1 Shared Infrastructure&lt;/strong&gt;" plan to support the customer domain and &lt;strong&gt;B1 Plan&lt;/strong&gt;, if you want to bind an SSL certificate to your application.&lt;/p&gt;

&lt;p&gt;Refer to the article below for more information: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain"&gt;https://docs.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-custom-domain&lt;/a&gt;&lt;a href="https://docs.microsoft.com/en-us/azure/app-service/manage-backup?WT.mc_id=parveensingh.com"&gt;?WT.mc_id=parveensingh.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Application Insights
&lt;/h2&gt;

&lt;p&gt;Is your application performing the way you expect it to? Well, App Service got Application Insights that you tell you exactly what you need to know from the hardware level to application-level diagnostics of your application. All it takes is to add a simple piece of code to your application and let the data come through application insights where you can monitor the real-time performance of your application. How cool is that?&lt;/p&gt;

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

&lt;p&gt;I hope you got at least a brief overview of what Azure App Service is. I'll be covering in-depth tutorials in the coming weeks on using CI/CD Pipelines with Azure App Service.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Looking for information or article on any particular Azure Service? Leave a comment down below or reach out to me on &lt;a href="https://twitter.com/singh_cloud"&gt;Twitter&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>azure</category>
      <category>serverless</category>
      <category>webdev</category>
      <category>node</category>
    </item>
  </channel>
</rss>
