<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Richard Basson</title>
    <description>The latest articles on DEV Community by Richard Basson (@bassonrichard).</description>
    <link>https://dev.to/bassonrichard</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%2F160534%2F627694fa-bcbe-4332-8e22-9bf9d85f56ce.jpg</url>
      <title>DEV Community: Richard Basson</title>
      <link>https://dev.to/bassonrichard</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bassonrichard"/>
    <language>en</language>
    <item>
      <title>Sustainable Software Engineering for a greener digital world</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Sun, 23 Jul 2023 16:48:54 +0000</pubDate>
      <link>https://dev.to/bassonrichard/sustainable-software-engineering-for-a-greener-digital-world-2i6p</link>
      <guid>https://dev.to/bassonrichard/sustainable-software-engineering-for-a-greener-digital-world-2i6p</guid>
      <description>&lt;p&gt;When it comes to sustainability, what can we as software engineers and architects do? It turns out, quite a lot. We have the power 😜 to make a difference, and I'm going to show you how by starting with the core concepts of Sustainable Software Engineering (SSE). It’s a lot easier and more in reach than you might think.&lt;/p&gt;

&lt;h2&gt;
  
  
  Core concepts and philosophies of Sustainable Software Architecture &amp;amp; Sustainable Software Engineering
&lt;/h2&gt;

&lt;p&gt;Sustainable Software Engineering is built upon two core philosophies and eight core principles. Let's delve deeper into these concepts, understanding this will help with the practical applications later.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Philosophies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Everyone has a part to play in the climate solution:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It might not always seem like it but we &lt;strong&gt;can all&lt;/strong&gt; make a difference. We have a lot more to offer when it comes to the climate solution than we think, and it’s easier to make these changes than we think. &lt;/p&gt;

&lt;p&gt;I will talk more about this in the upcoming sections. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sustainability is enough, all by itself, to justify our work.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This philosophy may seem strange at first glance, but it’s really important to be sustainable to be able to keep on doing what we are doing for generations to come.  Hopefully this sets a precedent for how people can easily do this going forward. Sustainable practices can also help financially by reducing waste and increasing efficiency. This can save money and make businesses more profitable in the long run.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Eight Core Principles&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Carbon:&lt;/strong&gt; Minimise the carbon emissions generated by your software and its underlying infrastructure. This includes optimising code, reducing computational complexity, and selecting energy-efficient hardware.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suggestions:&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Utilise energy-efficient algorithms and data structures.
- Monitor and minimise power consumption of your software.
- Choose cloud providers that prioritise renewable energy sources.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Electricity:&lt;/strong&gt; Reduce the electricity consumption of your software and hardware by optimising resource utilisation and eliminating waste.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suggestions:&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Implement techniques such as dynamic voltage and frequency scaling (DVFS) to optimise power usage.
- Use virtualisation and containerisation to optimise resource utilisation.
- Optimise idle times, sleep states, and power-saving modes.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Carbon intensity:&lt;/strong&gt; Be aware of the carbon intensity of the energy sources powering your software and infrastructure, and prioritise lower-carbon options when possible.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suggestions:&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Choose data center locations with low-carbon energy sources.
- Work with cloud providers that prioritise carbon reduction strategies.
- Consider carbon offset programs to balance out your emissions.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Embodied carbon:&lt;/strong&gt; Understand the carbon footprint of your software's entire lifecycle: including production, distribution, and disposal of hardware.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suggestions:&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Prioritise hardware with lower embodied carbon.
- Implement effective recycling and disposal policies for hardware.
- Promote hardware longevity through software compatibility and modularity.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Energy proportionality:&lt;/strong&gt; Strive for energy usage that is proportional to the workload, ensuring that idle resources consume less energy.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suggestions:&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Use auto-scaling features to dynamically allocate resources based on demand.
- Implement energy-efficient workload scheduling.
- Optimise server utilisation through load balancing and resource management.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Network efficiency:&lt;/strong&gt; Optimise network usage to minimise energy consumption and reduce latency.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suggestions:&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Minimise data transfer by compressing and caching data.
- Optimise API calls and utilise content delivery networks (CDNs) to reduce latency.
- Use edge computing to move computation closer to the data source.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Demand shaping:&lt;/strong&gt; Manage and shape user demand to spread it across time, reducing peak loads and energy consumption.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suggestions:&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Implement features that incentivise off-peak usage.
- Utilise demand forecasting and load management techniques.
- Encourage users to adopt energy-saving settings and behaviors.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimisation:&lt;/strong&gt; Continuously improve and optimise your software's energy efficiency and carbon footprint through monitoring, analytics, and automation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Suggestions:&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Set up monitoring and analytics to track energy consumption and carbon emissions.
- Implement automated testing and optimisation tools to continuously improve efficiency.
- Encourage a culture of sustainability within your organisation.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

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

&lt;h3&gt;
  
  
  &lt;strong&gt;Normalising Conversations about SSE&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For SSE to become a standard practice in the software industry, it's important to normalise conversations around it. Encourage your colleagues and peers to discuss sustainability, share best practices, and create a culture of accountability for environmental impact.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Cascading Benefits of SSE&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Adopting SSE practices not only benefits the environment but also has cascading benefits for businesses and individuals. Sustainable practices can help financially by reducing waste, increasing efficiency, and ultimately saving money. This makes businesses more profitable and supports long-term growth.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Embodied Carbon&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Embodied carbon is the carbon footprint of a product or service throughout its entire lifecycle, from production to disposal. By understanding and reducing the embodied carbon of software and hardware, engineers can make a significant impact on overall carbon emissions.&lt;/p&gt;

&lt;p&gt;It does not matter in which space you might find yourself, working with cloud services or on-premise. Whether you’re working on the backend or building for devices (including web) you have a role to play. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Practical Applications of SSE&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this section, we will explore some practical applications of SSE in different domains, including cloud services, devices, networking energy usage, and demand shaping.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cloud Services
&lt;/h3&gt;

&lt;p&gt;The cloud has created an illusion of abundant resources, making it easy to overlook the actual physical resources consumed. Remember that "the cloud is just someone else's computer." The abstraction hides the fact that we still use power from the region where the data centers are located and that hardware components are produced using rare earth metals.&lt;/p&gt;

&lt;p&gt;When running a server at only 10% utilisation, the server still consumes static power, resulting in a low power-to-work ratio. By provisioning only the capacity you need and avoiding overprovisioning, you can achieve a higher power-to-work ratio and reduce costs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Devices
&lt;/h3&gt;

&lt;p&gt;Developers often encounter device compatibility issues. While it may be frustrating to address these problems, consider the carbon footprint of the devices you build for. Devices have a larger carbon footprint during manufacturing than usage over their lifetime. The more often people have to replace their devices, the larger their carbon footprint.&lt;/p&gt;

&lt;p&gt;By continuing to support older devices, you can help reduce the overall carbon footprint of your users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Networking Energy Usage
&lt;/h3&gt;

&lt;p&gt;Network infrastructure consumes power, and the further data needs to travel over a network the more devices are needed and the more power is consumed. When designing software, try to have your data be as close as possible to the consumer. This not only reduces energy consumption but also helps with latency, giving you a double win.&lt;/p&gt;

&lt;h3&gt;
  
  
  Demand Shaping
&lt;/h3&gt;

&lt;p&gt;In the digital cloud world, demand shaping involves balancing when and how people use online services to avoid overloading servers during peak times. This helps reduce the energy used by the servers and makes the digital world more sustainable.&lt;/p&gt;

&lt;p&gt;For example, imagine an online video game company encouraging players to play during off-peak hours when fewer people are online. They could offer in-game rewards or bonuses to incentivise off-peak gaming, helping to spread out the demand for game servers. This way, servers don't have to work as hard and use as much energy all at once.&lt;/p&gt;

&lt;p&gt;By implementing similar strategies, you can shape demand to match supply and contribute to a more sustainable digital world.&lt;/p&gt;

&lt;p&gt;Sustainable Software Engineering is not just a responsibility for software engineers and architects; it's an opportunity to create a positive impact on our environment. By understanding the core concepts of SSE, normalising conversations around sustainability, and implementing sustainable practices in our work, we can play a crucial role in building a greener world.&lt;/p&gt;

</description>
      <category>sustainabledevelopment</category>
      <category>energy</category>
      <category>architecture</category>
    </item>
    <item>
      <title>GitHub Actions - Azure Container Apps build/deploy</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Tue, 07 Feb 2023 06:59:33 +0000</pubDate>
      <link>https://dev.to/bassonrichard/github-actions-azure-container-apps-builddeploy-2gh8</link>
      <guid>https://dev.to/bassonrichard/github-actions-azure-container-apps-builddeploy-2gh8</guid>
      <description>&lt;p&gt;This is a tutorial on how to deploy Azure Container Apps using GitHub Actions. I will provide examples and step-by-step instructions on how to build custom Github Actions workflows for deploying container apps to Azure. This will show you how to create your own actions for container deployments based on your needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Some assumptions:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have an &lt;a href="https://portal.azure.com/" rel="noopener noreferrer"&gt;Azure account&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You have a &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;GitHub account&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You have the &lt;a href="https://learn.microsoft.com/en-gb/cli/azure/?view=azure-cli-latest" rel="noopener noreferrer"&gt;Azure CLI&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You have access to create resources and service principles in the Azure subscription you’re going to deploy to.&lt;/li&gt;
&lt;li&gt;You have an image repository where you can store container images.&lt;/li&gt;
&lt;li&gt;You have code to deploy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is an example of an action workflow that I use to deploy my container apps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# The name of the deployment&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Trigger auto deployment for containerapps&lt;/span&gt;

&lt;span class="c1"&gt;# When this action will be executed&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# Automatically trigger it when detected changes in repo&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Branched to look out for changes on&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
      &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;main&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;

  &lt;span class="c1"&gt;# Allow manually trigger of the jobs&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# Job run image.&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

   &lt;span class="c1"&gt;# Steps that need to happen in this job run.&lt;/span&gt;
      &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Check out the code&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Check out code&lt;/span&gt;
          &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;

        &lt;span class="c1"&gt;# Log in to Azure CLI&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Log in to Azure&lt;/span&gt;
          &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/login@v1&lt;/span&gt;
          &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# Azure CLI credentials&lt;/span&gt;
            &lt;span class="na"&gt;creds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.AZURE_CREDENTIALS }}&lt;/span&gt;

        &lt;span class="c1"&gt;# Build and deploy the container app&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build and deploy Container App&lt;/span&gt;
          &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/container-apps-deploy-action@v0&lt;/span&gt;
          &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;appSourcePath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.workspace }}&lt;/span&gt;
            &lt;span class="na"&gt;acrName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-Registery-Name&amp;gt;&lt;/span&gt;
            &lt;span class="na"&gt;acrUsername&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.REGISTRY_USERNAME }}&lt;/span&gt;
            &lt;span class="na"&gt;acrPassword&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.REGISTRY_PASSWORD }}&lt;/span&gt;
            &lt;span class="na"&gt;containerAppName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-App-Name&amp;gt;&lt;/span&gt;
            &lt;span class="na"&gt;containerAppEnvironment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-App-Environment-Name&amp;gt;&lt;/span&gt;
            &lt;span class="na"&gt;resourceGroup&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-App-Resource-Group&amp;gt;&lt;/span&gt;
            &lt;span class="na"&gt;imageToBuild&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-Registry&amp;gt;/&amp;lt;Image-Name&amp;gt;:&amp;lt;Tag e.g. ${{ github.sha }}&amp;gt;&lt;/span&gt;
            &lt;span class="na"&gt;dockerfilePath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/Path/to/Dockerfile&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is quite a lot so let’s unpack it.&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Actions File structure
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Workflow Name
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;name: Trigger auto deployment for containerapps&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is the name you want to give your deployment run. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Workflow triggers&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# When this action will be executed&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# Automatically trigger it when detected changes in repo&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Branched to look out for changes on&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
      &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;main&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;

  &lt;span class="c1"&gt;# Allow manually trigger of the jobs&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The worflow trigger is how you choose to trigger your deploy. This example creates a trigger based on me pushing code to my main branch; you can set this based on the branch you trigger deploys from. It’s also possible to use wildcards, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;main&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;releases/**'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;workflow_dispatch&lt;/code&gt; allows you to manually trigger the workflow in GitHub actions. I found this particularly useful when I’ve made changes to the infrastructure and I need to trigger a deployment again.&lt;/p&gt;

&lt;p&gt;You can read more about workflow triggers here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows" rel="noopener noreferrer"&gt;Events that trigger workflows - GitHub Docs&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Jobs
&lt;/h3&gt;

&lt;p&gt;This is a grouping of steps that need to run. You can have one or multiple jobs. &lt;/p&gt;

&lt;p&gt;The example above only has 1 job called "build" which builds and deploys the project and runs on  the ubuntu image.&lt;/p&gt;

&lt;p&gt;These jobs run in parallel by default but you can create a dependency on other jobs by using the needs: keyword. You can also conditionally run jobs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;review&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy/Review&lt;/span&gt;

  &lt;span class="na"&gt;staging&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy/Staging&lt;/span&gt;

  &lt;span class="na"&gt;production&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy/Production&lt;/span&gt;
    &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ always() }}&lt;/span&gt;
    &lt;span class="na"&gt;needs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;staging&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;review&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;In the above image the Deploy/Staging, Deploy/Review and Deploy/Production blocks are jobs.&lt;/p&gt;

&lt;p&gt;You can read more about jobs here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow" rel="noopener noreferrer"&gt;Using jobs in a workflow - GitHub Docs&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps
&lt;/h3&gt;

&lt;p&gt;These are tasks that need to run as part of the job. In this case, we have 3 steps that need to run as part of the job.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check out code&lt;/li&gt;
&lt;li&gt;Log in to Azure&lt;/li&gt;
&lt;li&gt;Build and deploy Container App&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These can consist of actions from the marketplace or custom actions, but in this case, we are using standard marketplace actions.&lt;/p&gt;

&lt;p&gt;The “Check out code” step checks out the code from the repo you’re running this action from into the container that the build/deploy is running in.&lt;/p&gt;

&lt;p&gt;The“ Log in to Azure” step logs you into the azure CLI and gives the deployment an access token to deploy the container app.&lt;/p&gt;

&lt;p&gt;The “Build and deploy Container App” builds and deploys the container app in the coming section we’ll get into more detail on what that does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Credentials and secret setup
&lt;/h2&gt;

&lt;p&gt;We need to first of all, create a service principal in Azure. The best way would be to use this Azure CLI.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Make sure you’re logged into the subscription you want to deploy the container app.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You then run the following command to create the service principle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az ad sp create-for-rbac --name "myApp" --role contributor \
                            --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \
                            --sdk-auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the &lt;code&gt;{subscription-id}&lt;/code&gt; and &lt;code&gt;{resource-group}&lt;/code&gt; with the subscription Id and the resource group, you want to deploy to respectively. You should also replace &lt;code&gt;myApp&lt;/code&gt; with your service principles name.&lt;/p&gt;

&lt;p&gt;This command will create an RBAC (role-based access control) service principle which then has contributor access to the subscription and resource group.&lt;/p&gt;

&lt;p&gt;You will then get an output that looks like the one below. You should be careful &lt;strong&gt;not to share&lt;/strong&gt; this as it is sensitive information. You will need to &lt;strong&gt;keep this&lt;/strong&gt; as you will use it soon.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"clientId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;GUID&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"clientSecret"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;STRING&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"subscriptionId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;GUID&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"tenantId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;GUID&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"resourceManagerEndpointUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;URL&amp;gt;"&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="err"&gt;(...)&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now to create the Secret in GitHub on the repo so it can be used for the action.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on the repo you want to deploy.&lt;/li&gt;
&lt;li&gt;Navigate to Settings&lt;/li&gt;
&lt;li&gt;Then under Security expand Secrets and variables&lt;/li&gt;
&lt;li&gt;Click “Actions”&lt;/li&gt;
&lt;li&gt;While on the secrets tab click on “New repository secret”&lt;/li&gt;
&lt;li&gt;Create a secret called “&lt;strong&gt;AZURE_CREDENTIALS&lt;/strong&gt;”&lt;/li&gt;
&lt;li&gt;Make the secret value the value you got above from creating the service principle.&lt;/li&gt;
&lt;/ol&gt;

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

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

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

&lt;p&gt;This part is only required if you want to use a container registry.&lt;/p&gt;

&lt;p&gt;While you are creating secrets you will need 2 more. The “&lt;strong&gt;REGISTRY_USERNAME&lt;/strong&gt;” and “&lt;strong&gt;REGISTRY_PASSWORD&lt;/strong&gt;”. This can be obtained from your Azure container registry. &lt;/p&gt;

&lt;p&gt;REGISTRY_USERNAME is the username of the registry user. &lt;/p&gt;

&lt;p&gt;REGISTRY_PASSWORD is the password of the registry user. &lt;/p&gt;

&lt;h2&gt;
  
  
  The bare minimum
&lt;/h2&gt;

&lt;p&gt;Your first half of the workflow page should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# The name of the deployment&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Trigger auto deployment for containerapps&lt;/span&gt;

&lt;span class="c1"&gt;# When this action will be executed&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# Automatically trigger it when detected changes in repo&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Branched to look out for changes on&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
      &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;main&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;

  &lt;span class="c1"&gt;# Allow mannually trigger of the jobs&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Job run image.&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following steps you add will be based on different scenarios.&lt;br&gt;
So lets start with the first three. &lt;/p&gt;

&lt;p&gt;1.) You are deploying an existing container image with public registry access.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Log in to Azure&lt;/span&gt;
    &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/login@v1&lt;/span&gt;
    &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;creds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.AZURE_CREDENTIALS }}&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build and deploy Container App&lt;/span&gt;
    &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/container-apps-deploy-action@v0&lt;/span&gt;
    &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;imageToDeploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcr.microsoft.com/azuredocs/containerapps-helloworld:latest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.) You are building and deploying an image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Log in to Azure&lt;/span&gt;
    &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/login@v1&lt;/span&gt;
    &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;creds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.AZURE_CREDENTIALS }}&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build and deploy Container App&lt;/span&gt;
    &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/container-apps-deploy-action@v0&lt;/span&gt;
    &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;appSourcePath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.workspace }}&lt;/span&gt;
      &lt;span class="na"&gt;acrName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mytestacr&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.) You don’t have a dockerfile or built image but you have the runtime stack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Log in to Azure&lt;/span&gt;
    &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/login@v1&lt;/span&gt;
    &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;creds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.AZURE_CREDENTIALS }}&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build and deploy Container App&lt;/span&gt;
    &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/container-apps-deploy-action@v0&lt;/span&gt;
    &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;appSourcePath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.workspace }}&lt;/span&gt;
      &lt;span class="na"&gt;acrName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mytestacr&lt;/span&gt;
      &lt;span class="na"&gt;runtimeStack&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;dotnetcore:7.0'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With these scenarios if you don’t have the container app, container environment, or resource group created either manually or by a previous run, it will create these resources for you. &lt;/p&gt;

&lt;p&gt;The resources will be named as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Container App&lt;/strong&gt;: github-action-container-app-&amp;lt;github-run-id&amp;gt;-&amp;lt;github-run-attempt&amp;gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource Group:&lt;/strong&gt; &amp;lt;container-app-name&amp;gt;-rg&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Container App Environment:&lt;/strong&gt; &amp;lt;container-app-name&amp;gt;-env&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have found this to not be ideal in most cases, so let’s see what we need to give it to not create these. &lt;/p&gt;

&lt;h2&gt;
  
  
  Additional arguments
&lt;/h2&gt;

&lt;p&gt;So to prevent the action from creating these resources, you will need to give it the name of existing resources or give it names of resources you want to initally create and subsequently re-use.&lt;/p&gt;

&lt;p&gt;You can then add these arguments to your “Build and deploy Container App” step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;containerAppName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-App-Name&amp;gt;&lt;/span&gt;
&lt;span class="na"&gt;containerAppEnvironment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-App-Environment-Name&amp;gt;&lt;/span&gt;
&lt;span class="na"&gt;resourceGroup&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-App-Resource-Group&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have a custom Docker image you want to build and deploy, you need to use these arguments to build the image and deploy it. This is if you have an existing &lt;code&gt;Dockerfile&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;imageToBuild&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-Registry&amp;gt;/&amp;lt;Image-Name&amp;gt;:&amp;lt;Tag e.g. ${{ github.sha }}&amp;gt;&lt;/span&gt;
&lt;span class="na"&gt;dockerfilePath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/Path/to/Dockerfile&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will also need to log into your container registry to push the image, so you will need these below arguments as well. You will also need these if you’re pulling an image from a private image repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;acrName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;Container-Registery-Name&amp;gt;&lt;/span&gt;
&lt;span class="na"&gt;acrUsername&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.REGISTRY_USERNAME }}&lt;/span&gt;
&lt;span class="na"&gt;acrPassword&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.REGISTRY_PASSWORD }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some of the other ones I have not used but can be useful are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;environmentVariables&lt;/code&gt; A list of environment variable(s) for the container. Space-separated values in 'key=value' format. Empty string to clear existing values. Prefix value with 'secretref:' to reference a secret.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;targetPort&lt;/code&gt; The target port that the Container App will listen on. If not provided, this value will be "80" for Python applications and "8080" for all other supported platforms.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Well done! You’ve made it all the way to the end.&lt;/p&gt;

&lt;p&gt;You’ve now unlocked the skill to deploy Azure container apps using GitHub action&lt;/p&gt;

&lt;p&gt;If you like this post consider following me here or on Twitter &lt;a class="mentioned-user" href="https://dev.to/bassonrichard"&gt;@bassonrichard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to do some more reading here is the documentation for the GitHub Action&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/marketplace/actions/azure-container-apps-build-and-deploy" rel="noopener noreferrer"&gt;Azure Container Apps Build and Deploy - GitHub Marketplace&lt;/a&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>coding</category>
      <category>mentorship</category>
    </item>
    <item>
      <title>AWS Cognito — Client credentials flow .NET 6</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Mon, 30 May 2022 14:55:42 +0000</pubDate>
      <link>https://dev.to/bassonrichard/aws-cognito-client-credentials-flow-net-6-32k8</link>
      <guid>https://dev.to/bassonrichard/aws-cognito-client-credentials-flow-net-6-32k8</guid>
      <description>&lt;h2&gt;
  
  
  AWS Cognito User pool creation
&lt;/h2&gt;

&lt;p&gt;Navigate to the AWS Cognito service page&lt;/p&gt;

&lt;p&gt;Click on create user pool&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Step 1: &lt;strong&gt;Configure sign-in experience&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Select Email and click next&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Step 2: &lt;strong&gt;Configure security requirements&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Under password policy select cognito defaults&lt;/li&gt;
&lt;li&gt;Under Multi-factor authentication select No MFA&lt;/li&gt;
&lt;li&gt;Under User account recovery select Enable self-service account recovery and then Email Only&lt;/li&gt;
&lt;li&gt;Click next&lt;/li&gt;
&lt;/ul&gt;

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

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

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

&lt;h3&gt;
  
  
  Step 3: Configure sign-up experience
&lt;/h3&gt;

&lt;p&gt;Keep all selections as default and click next&lt;/p&gt;

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

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

&lt;h3&gt;
  
  
  Step 4: &lt;strong&gt;Configure message delivery&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Select Send email with Cognito and keep the rest of the configuration as default then click next&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Step 5: &lt;strong&gt;Integrate your app&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Configure the User pool name with your preferred naming convention&lt;/li&gt;
&lt;li&gt;Select Confidential client&lt;/li&gt;
&lt;li&gt;Configure the App client name&lt;/li&gt;
&lt;li&gt;Click next&lt;/li&gt;
&lt;/ul&gt;

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

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

&lt;h3&gt;
  
  
  Step 6: &lt;strong&gt;Review and create&lt;/strong&gt;
&lt;/h3&gt;

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

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

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

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

&lt;ul&gt;
&lt;li&gt;Review your configuration&lt;/li&gt;
&lt;li&gt;Click Create user pool&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  User Pools
&lt;/h3&gt;

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

&lt;p&gt;See your created user pool &lt;/p&gt;

&lt;h2&gt;
  
  
  Application configuration and resource server creation
&lt;/h2&gt;

&lt;p&gt;Navigate to your created user pool&lt;/p&gt;

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

&lt;p&gt;Navigate to the App Integration tab&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Step 1: Create Domain
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;On the Domain section click on Actions and then click on Create Cogniro domain&lt;/li&gt;
&lt;li&gt;Enter a unique domain prefix&lt;/li&gt;
&lt;li&gt;Click Create Cognito domain&lt;/li&gt;
&lt;/ul&gt;

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

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

&lt;h3&gt;
  
  
  Step 2: Create Resource server
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Click Create resource server&lt;/li&gt;
&lt;li&gt;Configure the resource server name and identifier&lt;/li&gt;
&lt;li&gt;Create custom scopes for your application to use when authenticating&lt;/li&gt;
&lt;li&gt;Click create resource server&lt;/li&gt;
&lt;/ul&gt;

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

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

&lt;h3&gt;
  
  
  Step 3: Configure client application
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Select the app client you created&lt;/li&gt;
&lt;li&gt;Under Hosted UI click edit&lt;/li&gt;
&lt;li&gt;Under Hosted sign-up and sign-in pages select the identity provider cognito user pool&lt;/li&gt;
&lt;li&gt;Select Client Credentials OAuth 2.0 Grant type&lt;/li&gt;
&lt;li&gt;Select the custom scope you created and want to assign to the application&lt;/li&gt;
&lt;li&gt;Click Save changes&lt;/li&gt;
&lt;/ul&gt;

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

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

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

&lt;h2&gt;
  
  
  Create Weather API
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create API
&lt;/h3&gt;

&lt;p&gt;Create a API project if you don’t have one&lt;/p&gt;

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

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

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

&lt;h3&gt;
  
  
  Step 2: Add NuGet packages
&lt;/h3&gt;

&lt;p&gt;Add the following NuGet packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.nuget.org/packages/Amazon.AspNetCore.Identity.Cognito/" rel="noopener noreferrer"&gt;https://www.nuget.org/packages/Amazon.AspNetCore.Identity.Cognito/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.JwtBearer/6.0.5" rel="noopener noreferrer"&gt;https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.JwtBearer&lt;/a&gt;/&lt;/li&gt;
&lt;/ul&gt;

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

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

&lt;h3&gt;
  
  
  Step 3:  Setup auth in Program.cs
&lt;/h3&gt;

&lt;p&gt;Add this block of code to the Program.cs under the builder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddCognitoIdentity&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddAuthentication&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DefaultAuthenticateScheme&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JwtBearerDefaults&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AuthenticationScheme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DefaultChallengeScheme&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JwtBearerDefaults&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AuthenticationScheme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddJwtBearer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Authority&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Configuration&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"AWSCognito:Authority"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TokenValidationParameters&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;TokenValidationParameters&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;ValidateIssuerSigningKey&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;ValidateAudience&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following under app.UseHttpsRedirection(); in Program.cs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;app.UseAuthentication();&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;app.UseAuthorization();&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following using's to the Program.cs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.AspNetCore.Authentication.JwtBearer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Microsoft.IdentityModel.Tokens&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your Program.cs will end up looking like this when you’re done.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;using&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Microsoft.AspNetCore.Authentication.JwtBearer;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;using&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Microsoft.IdentityModel.Tokens;&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;builder&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;WebApplication.CreateBuilder(args);&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Add&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;services&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;container.&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;builder.Services.AddControllers();&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Learn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;more&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;configuring&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Swagger/OpenAPI&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;at&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;https://aka.ms/aspnetcore/swashbuckle&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;builder.Services.AddEndpointsApiExplorer();&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;builder.Services.AddSwaggerGen();&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;builder.Services.AddCognitoIdentity();&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;builder.Services.AddAuthentication(options&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;options.DefaultAuthenticateScheme&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;JwtBearerDefaults.AuthenticationScheme;&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;options.DefaultChallengeScheme&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;JwtBearerDefaults.AuthenticationScheme;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;.AddJwtBearer(options&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;options.Authority&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;builder.Configuration&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"AWSCognito:Authority"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;options.TokenValidationParameters&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;TokenValidationParameters&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="err"&gt;ValidateIssuerSigningKey&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="err"&gt;ValidateAudience&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;);&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;app&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;builder.Build();&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Configure&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;HTTP&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;request&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;pipeline.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;(app.Environment.IsDevelopment())&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;app.UseSwagger();&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;app.UseSwaggerUI();&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;app.UseHttpsRedirection();&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;app.UseAuthentication();&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;app.UseAuthorization();&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;app.MapControllers();&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;app.Run();&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Setup configuration file
&lt;/h3&gt;

&lt;p&gt;Add this section to the appsettings.Development.json file&lt;/p&gt;

&lt;p&gt;This URL for the authority is made up of the following &lt;/p&gt;

&lt;p&gt;&lt;a href="https://cognito-idp/" rel="noopener noreferrer"&gt;https://cognito-idp&lt;/a&gt;.{region}.amazonaws.com/{userpoolid}&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"AWSCognito"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"Authority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"[https://cognito-idp](https://cognito-idp/).{region}.amazonaws.com/{userpoolid}"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can find the user pool id in AWS on the Amazon Cognito page under user pools&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Step 5: Add authorize attribute to GetWeatherForecast endpoint
&lt;/h3&gt;

&lt;p&gt;In the WeatherForecastController.cs add the Authorize attribute to the GetWeatherForecast endpoint and add Microsoft.AspNetCore.Authorization to the usings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;using&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Microsoft.AspNetCore.Authorization;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;using&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Microsoft.AspNetCore.Mvc;&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;namespace&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;AWSCognitoWeatherAPI.Controllers&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;ApiController&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;Route(&lt;/span&gt;&lt;span class="s2"&gt;"[controller]"&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;class&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;WeatherForecastController&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ControllerBase&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="err"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;static&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;readonly&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Summaries&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;new&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"Freezing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bracing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Chilly"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Cool"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Mild"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Warm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Balmy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Sweltering"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Scorching"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;;&lt;/span&gt;&lt;span class="w"&gt;

        &lt;/span&gt;&lt;span class="err"&gt;private&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;readonly&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ILogger&amp;lt;WeatherForecastController&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;_logger;&lt;/span&gt;&lt;span class="w"&gt;

        &lt;/span&gt;&lt;span class="err"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;WeatherForecastController(ILogger&amp;lt;WeatherForecastController&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;logger)&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="err"&gt;_logger&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;logger;&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;Authorize&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;HttpGet(Name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"GetWeatherForecast"&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="err"&gt;public&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;IEnumerable&amp;lt;WeatherForecast&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Get()&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="err"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Enumerable.Range(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="err"&gt;).Select(index&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;new&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;WeatherForecast&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;Date&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;DateTime.Now.AddDays(index)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;TemperatureC&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Random.Shared.Next(&lt;/span&gt;&lt;span class="mi"&gt;-20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="err"&gt;Summary&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Summaries&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="err"&gt;Random.Shared.Next(Summaries.Length)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="err"&gt;.ToArray();&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Call the Weather Forecast API using Postman
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create new collection
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a new collection for the API&lt;/li&gt;
&lt;li&gt;Add new request to the collection for the weather forcast endpoint (&lt;a href="https://localhost:7214/WeatherForecast" rel="noopener noreferrer"&gt;https://localhost:7214/WeatherForecast&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

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

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

&lt;h3&gt;
  
  
  Step 2: Setup Collection Auth
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Click on the Weather Forcast API collection and navigate to the Authorization tab&lt;/li&gt;
&lt;li&gt;From the Type dropdown select OAuth 2.0&lt;/li&gt;
&lt;li&gt;In the Configure New Token Section give the token a name&lt;/li&gt;
&lt;li&gt;In Grant Type dropdown select Client Credentials&lt;/li&gt;
&lt;li&gt;In the app integration section of the user pool in AWS get the domain url&lt;/li&gt;
&lt;li&gt;Add the domain to the Access Token URL section in postman and append it with /oauth2/token&lt;/li&gt;
&lt;li&gt;Get the client id from the client app in AWS&lt;/li&gt;
&lt;li&gt;Get the client secret from the client app in AWS&lt;/li&gt;
&lt;li&gt;Get the custom scope form the Hosted UI&lt;/li&gt;
&lt;li&gt;Add the clientid, client secret and scope in postman&lt;/li&gt;
&lt;li&gt;Click get new access token&lt;/li&gt;
&lt;li&gt;Click use token on the pop-up&lt;/li&gt;
&lt;li&gt;On the Weather Forecast request under the Authorization tab ensure the Type is set to Inherit auth from parent.&lt;/li&gt;
&lt;/ul&gt;

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

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

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

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

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

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

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

&lt;h3&gt;
  
  
  Step 3: Call the Weather API
&lt;/h3&gt;

&lt;p&gt;Click send on the weather forecast request to get the response on the API&lt;/p&gt;

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

&lt;p&gt;It’s as easy as that !🎉&lt;/p&gt;

&lt;p&gt;You can have a look at the repo below to find the full codebase.&lt;br&gt;
&lt;a href="https://github.com/Bassonrichard/aws-cognito-weather-api" rel="noopener noreferrer"&gt;https://github.com/Bassonrichard/aws-cognito-weather-api&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>dotnet</category>
      <category>cognito</category>
      <category>api</category>
    </item>
    <item>
      <title>How to deploy to IIS using Azure DevOps YAML pipelines</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Thu, 19 Aug 2021 12:05:32 +0000</pubDate>
      <link>https://dev.to/bassonrichard/how-to-deploy-to-iis-using-azure-devops-yaml-pipelines-36ib</link>
      <guid>https://dev.to/bassonrichard/how-to-deploy-to-iis-using-azure-devops-yaml-pipelines-36ib</guid>
      <description>&lt;p&gt;This blog is intended as a practical guide on how to deploy to IIS on a virtual machine using Azure DevOps YAML pipelines. If you want to read more about Azure DevOps and the benefits of DevOps check this out:&lt;br&gt;
&lt;a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/?view=azure-devops" rel="noopener noreferrer"&gt;https://docs.microsoft.com/en-us/azure/devops/pipelines/?view=azure-devops&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Some assumptions before we start:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You have access to the server you want to deploy on and admin 
access to PowerShell.&lt;/li&gt;
&lt;li&gt;You have access to the internet on the remote server you want to 
deploy on.&lt;/li&gt;
&lt;li&gt;You have admin access to install the .net core hosting bundle on 
the server.&lt;/li&gt;
&lt;li&gt;You can create environments, push code to your repo and create 
pipelines.&lt;/li&gt;
&lt;li&gt;You have a .net core API to deploy.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Creating Environment
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to Pipelines, and then select Environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select Create environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type the name of the environment, enter the description and &lt;br&gt;
select Virtual machines and click next.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ol&gt;
&lt;li&gt;Then select the Generic provider in the dropdown and select 
Windows as the operating system. You can then copy the 
registration script using the copy icon.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open an Administrative Powershell terminal on the windows &lt;br&gt;
machine you want to deploy to, paste the registration script in &lt;br&gt;
the terminal, and run the script. This step usually takes a &lt;br&gt;
while.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When the agent is done downloading you will be prompted if you &lt;br&gt;
want to add a tag to the machine. This is not required if there &lt;br&gt;
is a single machine in the environment but you will need to add &lt;br&gt;
the associated tags if you have multiple machines in the &lt;br&gt;
environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You will then be prompted to ask if you want to unzip for each &lt;br&gt;
task, which is not required — so you can say no.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You will then be prompted to enter a user account for the agent &lt;br&gt;
running on the machine. You can leave it as default or create a &lt;br&gt;
new service account under which the agent will run.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;When your agent creation succeeds you will be able to go back to Azure DevOps and see your virtual machine added as a resource in the environment!&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating build stage
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to Pipelines, and then select Pipelines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select Create Pipeline and connect to your application's source &lt;br&gt;
code.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ol&gt;
&lt;li&gt;Choose to show more on the configure pipeline step then select 
ASP.NET Core.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ol&gt;
&lt;li&gt;You will then have a base pipeline for ASP.NET Core applications, you can then add the build stage by adding the following code snippet:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;master&lt;/span&gt;

&lt;span class="na"&gt;pool&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;vmImage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

&lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;buildConfiguration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Release'&lt;/span&gt;

  &lt;span class="c1"&gt;#Replace these variables to suit your application&lt;/span&gt;
  &lt;span class="na"&gt;projectName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WeatherService'&lt;/span&gt;
  &lt;span class="na"&gt;websiteName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WeatherService'&lt;/span&gt;
  &lt;span class="na"&gt;appPoolName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WeatherService'&lt;/span&gt;

&lt;span class="na"&gt;stages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Build'&lt;/span&gt;
  &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Build'&lt;/span&gt;
  &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;job&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
       &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;  
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DotNetCoreCLI@2&lt;/span&gt;
          &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;dotnet&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;restore'&lt;/span&gt;
          &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;restore'&lt;/span&gt;
            &lt;span class="na"&gt;projects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*.sln'&lt;/span&gt;

        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DotNetCoreCLI@2&lt;/span&gt;
          &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build&lt;/span&gt;
          &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;build'&lt;/span&gt;
            &lt;span class="na"&gt;projects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*.sln'&lt;/span&gt;
            &lt;span class="na"&gt;arguments&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;--configuration Release&lt;/span&gt;

        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DotNetCoreCLI@2&lt;/span&gt;
          &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Test&lt;/span&gt;
          &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;test&lt;/span&gt;
            &lt;span class="na"&gt;projects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*.sln'&lt;/span&gt;
            &lt;span class="na"&gt;arguments&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--configuration&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$(BuildConfiguration)'&lt;/span&gt;

        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DotNetCoreCLI@2&lt;/span&gt;
          &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Publish&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;the&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;project&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$(buildConfiguration)'&lt;/span&gt;
          &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;publish'&lt;/span&gt;
            &lt;span class="na"&gt;projects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;**/*.csproj'&lt;/span&gt;
            &lt;span class="na"&gt;publishWebProjects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
            &lt;span class="na"&gt;arguments&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--no-build&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;--configuration&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$(buildConfiguration)&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;--output&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$(Build.ArtifactStagingDirectory)/$(buildConfiguration)'&lt;/span&gt;
            &lt;span class="na"&gt;zipAfterPublish&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;publish&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(Build.ArtifactStagingDirectory)'&lt;/span&gt;
          &lt;span class="na"&gt;artifact&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;drop&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Replace the variables at the top to suit your application by 
replacing the app pool name, website name, and project name 
with your project’s details.&lt;/li&gt;
&lt;li&gt;You can then click Save and run to have a pipeline to build 
that creates your application.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Create release pipeline
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to Pipelines and select Pipelines.&lt;/li&gt;
&lt;li&gt;You will see the pipeline that you have created, on the left- 
hand side of your pipeline select more options and then select 
edit.&lt;/li&gt;
&lt;li&gt;Your pipeline will load then you can append the following YAML 
code to your pipeline:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dev'&lt;/span&gt;
  &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dev'&lt;/span&gt;
  &lt;span class="na"&gt;dependsOn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Build'&lt;/span&gt;
  &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))&lt;/span&gt;
  &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;deployment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Dev&lt;/span&gt;
     &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Dev&lt;/span&gt;
     &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
       &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dev'&lt;/span&gt;    
       &lt;span class="na"&gt;resourceType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;VirtualMachine&lt;/span&gt;
     &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;websitePhysicalPath&lt;/span&gt;
       &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%SystemDrive%\inetpub\wwwroot\$(websiteName)'&lt;/span&gt;

     &lt;span class="na"&gt;strategy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;runOnce&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;deploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;IISWebAppManagementOnMachineGroup@0&lt;/span&gt;
            &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;            
              &lt;span class="na"&gt;IISDeploymentType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;IISWebsite'&lt;/span&gt;
              &lt;span class="na"&gt;ActionIISWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;CreateOrUpdateWebsite'&lt;/span&gt;
              &lt;span class="na"&gt;WebsiteName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(websiteName)'&lt;/span&gt;
              &lt;span class="na"&gt;WebsitePhysicalPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(websitePhysicalPath)'&lt;/span&gt;
              &lt;span class="na"&gt;WebsitePhysicalPathAuth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WebsiteUserPassThrough'&lt;/span&gt;
              &lt;span class="na"&gt;CreateOrUpdateAppPoolForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
              &lt;span class="na"&gt;AppPoolNameForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(appPoolName)'&lt;/span&gt;
              &lt;span class="na"&gt;DotNetVersionForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;No&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Managed&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Code'&lt;/span&gt;
              &lt;span class="na"&gt;PipeLineModeForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Integrated'&lt;/span&gt;
              &lt;span class="na"&gt;AppPoolIdentityForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ApplicationPoolIdentity'&lt;/span&gt;
              &lt;span class="na"&gt;AddBinding&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
              &lt;span class="na"&gt;Bindings&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
                  &lt;span class="s"&gt;{&lt;/span&gt;
                      &lt;span class="s"&gt;bindings:[&lt;/span&gt;
                          &lt;span class="s"&gt;{&lt;/span&gt;
                              &lt;span class="s"&gt;"protocol":"http",&lt;/span&gt;
                              &lt;span class="s"&gt;"ipAddress":"",&lt;/span&gt;
                              &lt;span class="s"&gt;"hostname":"",&lt;/span&gt;
                              &lt;span class="s"&gt;"port":"80",&lt;/span&gt;
                              &lt;span class="s"&gt;"sslThumbprint":"",&lt;/span&gt;
                              &lt;span class="s"&gt;"sniFlag":false&lt;/span&gt;
                          &lt;span class="s"&gt;}&lt;/span&gt;
                      &lt;span class="s"&gt;]&lt;/span&gt;
                  &lt;span class="s"&gt;}&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;IISWebAppDeploymentOnMachineGroup@0&lt;/span&gt;
            &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;WebSiteName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(websiteName)'&lt;/span&gt;
              &lt;span class="na"&gt;Package&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(Pipeline.Workspace)/drop/$(buildConfiguration)/$(projectName).zip'&lt;/span&gt;

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

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;After adding the script select Save and run you will be able to 
release it to the environment you created earlier.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;When you are done your script it should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;master&lt;/span&gt;

&lt;span class="na"&gt;pool&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;vmImage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

&lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;buildConfiguration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Release'&lt;/span&gt;
  &lt;span class="na"&gt;projectName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WeatherService'&lt;/span&gt;
  &lt;span class="na"&gt;websiteName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WeatherService'&lt;/span&gt;
  &lt;span class="na"&gt;appPoolName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WeatherService'&lt;/span&gt;

&lt;span class="na"&gt;stages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Build'&lt;/span&gt;
  &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Build'&lt;/span&gt;
  &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;job&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
       &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;  
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DotNetCoreCLI@2&lt;/span&gt;
          &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;dotnet&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;restore'&lt;/span&gt;
          &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;restore'&lt;/span&gt;
            &lt;span class="na"&gt;projects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*.sln'&lt;/span&gt;

        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DotNetCoreCLI@2&lt;/span&gt;
          &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build&lt;/span&gt;
          &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;build'&lt;/span&gt;
            &lt;span class="na"&gt;projects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*.sln'&lt;/span&gt;
            &lt;span class="na"&gt;arguments&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;--configuration Release&lt;/span&gt;

        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DotNetCoreCLI@2&lt;/span&gt;
          &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Test&lt;/span&gt;
          &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;test&lt;/span&gt;
            &lt;span class="na"&gt;projects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;*.sln'&lt;/span&gt;
            &lt;span class="na"&gt;arguments&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--configuration&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$(BuildConfiguration)'&lt;/span&gt;

        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;DotNetCoreCLI@2&lt;/span&gt;
          &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Publish&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;the&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;project&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$(buildConfiguration)'&lt;/span&gt;
          &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;publish'&lt;/span&gt;
            &lt;span class="na"&gt;projects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;**/*.csproj'&lt;/span&gt;
            &lt;span class="na"&gt;publishWebProjects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
            &lt;span class="na"&gt;arguments&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--no-build&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;--configuration&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$(buildConfiguration)&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;--output&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;$(Build.ArtifactStagingDirectory)/$(buildConfiguration)'&lt;/span&gt;
            &lt;span class="na"&gt;zipAfterPublish&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;publish&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(Build.ArtifactStagingDirectory)'&lt;/span&gt;
          &lt;span class="na"&gt;artifact&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;drop&lt;/span&gt;

&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dev'&lt;/span&gt;
  &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dev'&lt;/span&gt;
  &lt;span class="na"&gt;dependsOn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Build'&lt;/span&gt;
  &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))&lt;/span&gt;
  &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;deployment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Dev&lt;/span&gt;
     &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Dev&lt;/span&gt;
     &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
       &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dev'&lt;/span&gt;    
       &lt;span class="na"&gt;resourceType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;VirtualMachine&lt;/span&gt;
     &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;websitePhysicalPath&lt;/span&gt;
       &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;%SystemDrive%\inetpub\wwwroot\$(websiteName)'&lt;/span&gt;

     &lt;span class="na"&gt;strategy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;runOnce&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;deploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;IISWebAppManagementOnMachineGroup@0&lt;/span&gt;
            &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;            
              &lt;span class="na"&gt;IISDeploymentType&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;IISWebsite'&lt;/span&gt;
              &lt;span class="na"&gt;ActionIISWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;CreateOrUpdateWebsite'&lt;/span&gt;
              &lt;span class="na"&gt;WebsiteName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(websiteName)'&lt;/span&gt;
              &lt;span class="na"&gt;WebsitePhysicalPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(websitePhysicalPath)'&lt;/span&gt;
              &lt;span class="na"&gt;WebsitePhysicalPathAuth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;WebsiteUserPassThrough'&lt;/span&gt;
              &lt;span class="na"&gt;CreateOrUpdateAppPoolForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
              &lt;span class="na"&gt;AppPoolNameForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(appPoolName)'&lt;/span&gt;
              &lt;span class="na"&gt;DotNetVersionForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;No&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Managed&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Code'&lt;/span&gt;
              &lt;span class="na"&gt;PipeLineModeForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Integrated'&lt;/span&gt;
              &lt;span class="na"&gt;AppPoolIdentityForWebsite&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ApplicationPoolIdentity'&lt;/span&gt;
              &lt;span class="na"&gt;AddBinding&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
              &lt;span class="na"&gt;Bindings&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
                  &lt;span class="s"&gt;{&lt;/span&gt;
                      &lt;span class="s"&gt;bindings:[&lt;/span&gt;
                          &lt;span class="s"&gt;{&lt;/span&gt;
                              &lt;span class="s"&gt;"protocol":"http",&lt;/span&gt;
                              &lt;span class="s"&gt;"ipAddress":"",&lt;/span&gt;
                              &lt;span class="s"&gt;"hostname":"",&lt;/span&gt;
                              &lt;span class="s"&gt;"port":"80",&lt;/span&gt;
                              &lt;span class="s"&gt;"sslThumbprint":"",&lt;/span&gt;
                              &lt;span class="s"&gt;"sniFlag":false&lt;/span&gt;
                          &lt;span class="s"&gt;}&lt;/span&gt;
                      &lt;span class="s"&gt;]&lt;/span&gt;
                  &lt;span class="s"&gt;}&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;IISWebAppDeploymentOnMachineGroup@0&lt;/span&gt;
            &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;WebSiteName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(websiteName)'&lt;/span&gt;
              &lt;span class="na"&gt;Package&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(Pipeline.Workspace)/drop/$(buildConfiguration)/$(projectName).zip'&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;You should also have an environment to deploy your pipeline to called Dev.&lt;/p&gt;

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

&lt;p&gt;When you navigate to pipelines it should look something like this:&lt;/p&gt;

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

&lt;p&gt;You can have a look at this example repository as well:&lt;br&gt;
&lt;a href="https://github.com/Bassonrichard/azure-devops-iis-deploy" rel="noopener noreferrer"&gt;https://github.com/Bassonrichard/azure-devops-iis-deploy&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;When you release this you will have a DevOps pipeline setup using YAML pipelines, making your solution ready for the future with the ease of deployment of your solution.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>microsoft</category>
      <category>iis</category>
    </item>
    <item>
      <title>When is it a good choice to use Azure serverless functions?</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Wed, 04 Nov 2020 19:10:21 +0000</pubDate>
      <link>https://dev.to/bassonrichard/when-is-it-a-good-choice-to-use-azure-serverless-functions-3ca1</link>
      <guid>https://dev.to/bassonrichard/when-is-it-a-good-choice-to-use-azure-serverless-functions-3ca1</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5gswwq5quv608l4iy80g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5gswwq5quv608l4iy80g.jpg" alt="Bart Simpson saying serverless doesn't mean no servers" width="800" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is serverless?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s start by going into what serverless really is. No, it’s not the absence of servers but rather the abstraction of servers where you don’t have to deal with operating systems or infrastructure. This is all managed for you by Azure or your respective cloud provider.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How do Azure serverless functions work?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s start by saying Azure functions serverless scales very well, it is one of its big features in fact.&lt;br&gt;
So as the load becomes more, functions spin up and as the load decreases, the functions shut down. The Azure functions scale all the way down to 0 Azure functions. This means you don’t get billed at all for the time that there are no functions because there is no resource consumption. &lt;/p&gt;

&lt;p&gt;This is great so it’s super cost-effective and saves a lot of power but, this also means there are no functions running. So what happens when a request comes in? Azure will have to allocate server resources, load your function into memory and spin up a new instance of your function for it to be able to use the function. Now you’re possibly thinking but won’t it take long for this function to spin up? Actually, it will! It will, in fact take time to spin up. This is called cold start. You can read more about it here: &lt;a href="https://azure.microsoft.com/en-us/blog/understanding-serverless-cold-start/" rel="noopener noreferrer"&gt;Understanding serverless cold start.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The consumption plan is billed in two different ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The function can get billed based on the number of executions, and you will get the first million executions free. From there you will be charged per million executions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The second type of billing is based on resource consumption measured in gigabyte seconds.  This is an average of the memory usage of your function and the time it takes to execute.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

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

&lt;h2&gt;
  
  
  &lt;strong&gt;How do you get around cold starts?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are a couple of ways to get around cold starts, but they aren’t without their drawbacks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You could use the Dedicated (App Service) which means that you won’t have cold starts and possible execution time is much longer. This means though that you will have to configure the resources. It does not auto-scale and you will manually have to add virtual machines to scale out. This option is also a lot more expensive than the standard consumption plan and means you don’t get the benefits from serverless anymore.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can keep your Azure functions up 24/7 by calling it on a trigger every 15 minutes. You can also achieve the same results by calling the function before it shuts down. This means that you are using resources of your consumption plan that could have gone to valuable compute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You could optimize your code for the startups.  This won’t get rid of cold starts, it will just reduce the time it takes to start up.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you choose to call the function before it shuts down you might want to consider using app service plans since it will be cheaper in the long run.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;When should I use Azure serverless functions?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that we’ve gone through how it works, let’s get to the interesting part. When is it a good idea to use Azure functions? &lt;/p&gt;

&lt;p&gt;The word function in the software development world means a piece of code that performs a specific well ... function. This is also true for Azure functions: it's a piece of code written for a specific function. This is what serverless was built for and does its best in. Doing small pieces of work. When writing functions you should think of them as bite-sized pieces code with a dedicated job.&lt;/p&gt;

&lt;p&gt;They perform at their best if you have small jobs that can be triggered, run in the background, and be completed fairly quickly. If you wish to run long tasks or larger pieces of code this will probably not work for you.&lt;/p&gt;

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

&lt;p&gt;Think of Azure functions as your local handyman, coming to fix something small in your house. When you call the handyman it takes time for the handyman to come out - they aren’t going to rebuild your house - and you pay for the time he helped you.&lt;/p&gt;

&lt;p&gt;That said, you will be able to create functions that run larger pieces of code and longer tasks but you will have to weigh the benefit of serverless to the time it takes to create all the workarounds you have to do to get it to work. I have found in many cases that these workarounds were not worth it and I would have been better off simply using other services.&lt;/p&gt;

&lt;p&gt;So next time you want to use Azure functions, have a look at what you want to accomplish and see if it will be possible to do what you want in a bite-size piece of code that does not run for long and is not time-sensitive. &lt;/p&gt;

</description>
      <category>serverless</category>
      <category>azure</category>
      <category>azurefunctions</category>
      <category>triggers</category>
    </item>
    <item>
      <title>How to set up a Raspberry Pi K3s cluster</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Tue, 10 Mar 2020 08:55:21 +0000</pubDate>
      <link>https://dev.to/bassonrichard/how-to-set-up-a-raspberry-pi-k3s-cluster-508</link>
      <guid>https://dev.to/bassonrichard/how-to-set-up-a-raspberry-pi-k3s-cluster-508</guid>
      <description>&lt;h1&gt;
  
  
  The why
&lt;/h1&gt;

&lt;p&gt;Why would you use K3s on a Raspberry Pi and not plain Kubernetes? The short answer is that Kubernetes was not developed with your small Raspberry Pi processor and memory in mind.&lt;/p&gt;

&lt;p&gt;The longer answer is that K3s has everything you need for your Raspberry Pi from Kubernetes. It was developed for small servers without all of the unnecessary extras that Kubernetes has. This allows the memory footprint to be smaller on your Raspberry Pi and uses less than 40mb of space on your SD card so no wasting space.&lt;/p&gt;

&lt;p&gt;So now that you know the why, let’s get started!&lt;/p&gt;

&lt;h1&gt;
  
  
  What you need to get started.
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;(2+) x Raspberry Pi (please note raspberry pi zero won’t work with K3s)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;USB cable/charger (make sure it can support 3A output if you don’t use the &lt;br&gt;
official charger)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fly leads — as many as you have raspberry pi’s&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Micro SD cards — preferably class 10. &lt;a href="https://www.makeuseof.com/tag/5-mistakes-avoid-buying-next-microsd-card/" rel="noopener noreferrer"&gt;Here are more tips on how to choose a micro SD card&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Network Switch (or router with open ports)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Nice to haves
&lt;/h3&gt;

&lt;p&gt;Case(s) for the raspberry pi(s) with fans to keep the raspberry pi(s) cool&lt;br&gt;
A USB hub with 3A output for all ports&lt;br&gt;
Micro SD card reader&lt;/p&gt;
&lt;h1&gt;
  
  
  Now you need to setup Raspbian OS on the Raspberry Pi.
&lt;/h1&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.raspberrypi.org/downloads/" rel="noopener noreferrer"&gt;Download the latest version of Raspberry Pi Imager&lt;/a&gt; and install &lt;br&gt;
it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect an SD card reader with the SD card inside.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you used the card for another project you will first need to &lt;br&gt;
clean the micro SD card by using the erase option on the &lt;br&gt;
Raspberry Pi Imager.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open Raspberry Pi Imager and choose the Raspbian lite from the &lt;br&gt;
list presented.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose the SD card you wish to write your image to.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review your selections and click ‘WRITE’ to begin writing data &lt;br&gt;
to the SD card.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.raspberrypi.org/documentation/installation/installing-images/README.md" rel="noopener noreferrer"&gt;You can find the official guide here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you are done writing to the SD card, add a file named SSH to the card in the root folder (boot). The file does not have to contain anything, it can just be a plain text file.&lt;/p&gt;
&lt;h1&gt;
  
  
  Now to boot up your Pi’s.
&lt;/h1&gt;

&lt;p&gt;When you finally finish writing the image to the SD card, plug in your SD card. You can plug in the fly lead and the USB-C cable and power the Pi(s) up!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqx918ujll94nz3nl58t4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqx918ujll94nz3nl58t4.jpg" alt="Image of Raspberry Pi with cabels plugged in" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  The default setup of the Raspberry Pi.
&lt;/h1&gt;

&lt;p&gt;When you connect for the first time you can use the following command to access the Raspberry Pi:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh pi@raspberrypi.local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will then prompt you for a password which by default is: &lt;strong&gt;raspberry&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you’re done with that you should be in and ready to set up some defaults. First, let’s change the default password. Use the following command to access the Raspberry Pi config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo raspi-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Change the password to a secure password that you can access again. If you struggle to think of a password you can use the following tool to generate one:&lt;br&gt;
&lt;a href="https://passwordsgenerator.net/" rel="noopener noreferrer"&gt;https://passwordsgenerator.net/&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Please keep this password safe as you will need it to be able to access the Pi again.&lt;/p&gt;

&lt;p&gt;Once you’ve changed the password a good next step would be to change the hostname of the Raspberry Pi. You can get to the hostname by choosing network options on the main raspberry pi config menu then choosing the hostname. I like to change the hostname to pi0 for the master node and then the worker nodes pi1, pi2 etc…(or Blueberry Pi, Pecan Pi, Lemon Meringue Pi).&lt;/p&gt;
&lt;h1&gt;
  
  
  Getting to the clustering
&lt;/h1&gt;

&lt;p&gt;You will need to start by enabling container feature. You can do this by exiting the /boot/cmdline.txt file by using your favorite editor: I prefer to use nano.&lt;/p&gt;

&lt;p&gt;Run the following command to edit this file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /boot/cmdline.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then append the following to the top line of the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then save it to the file and reboot your Raspberry Pi by running&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Repeat the above on all of your Raspberry Pi’s&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  On your master node:
&lt;/h1&gt;

&lt;p&gt;SSH back into the Raspberry Pi. You will need to download the latest version of K3s by using the following command on the Raspberry Pi :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -sfL https://get.k3s.io | sh -
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can run the following command to see if K3s started up correctly&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl status k3s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If all went well you will see your master node up and running when you run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo k3s kubectl get nodes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Do the following on your worker nodes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You will first need to run the following command to get the K3s server token so that you can later use it to register the worker nodes. Once you have the token, keep it safe so you can use it later. If you lose the token you can always run the command again on the master node to get the token again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo cat /var/lib/rancher/k3s/server/node-token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will need to replace ‘myserver’ with the IP of your master node and xxx after K3s_TOKEN to the token on your master node which you can obtain by running on your master node.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo curl -sfL https://get.k3s.io | K3S_URL=”https://myserver:6443” K3S_TOKEN=XXX sh -
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you’re done doing that on all your worker nodes you can run the below command on your master node again to get all the nodes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo k3s kubectl get nodes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;(optional)&lt;br&gt;
K3s comes standard with containerd and not Docker to save space. If you want to use Docker you can install it by running the following command on your Raspberry Pi’s.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -sSL https://get.docker.com | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run the following command so you don’t have to run docker as sudo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo usermod -aG docker pi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to find out more about docker I wrote an article &lt;a href="https://dev.to/bassonrichard/what-is-docker-and-why-is-there-such-a-big-hype-around-it-dag"&gt;you can find here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There you have it, you’re done setting up your K3s cluster!!!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Feel free to let me know how it goes, you are welcome to dm me on twitter if you get stuck somewhere &lt;a href="https://twitter.com/bassonrichard" rel="noopener noreferrer"&gt;@bassonrichard&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Resources for some further reading:&lt;br&gt;
&lt;a href="https://github.com/rancher/K3s" rel="noopener noreferrer"&gt;https://github.com/rancher/K3s&lt;/a&gt;&lt;br&gt;
&lt;a href="https://passwordsgenerator.net/" rel="noopener noreferrer"&gt;https://passwordsgenerator.net/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.raspberrypi.org/documentation/installation/installing-images/README.md" rel="noopener noreferrer"&gt;https://www.raspberrypi.org/documentation/installation/installing-images/README.md&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.raspberrypi.org/downloads/" rel="noopener noreferrer"&gt;https://www.raspberrypi.org/downloads/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.makeuseof.com/tag/5-mistakes-avoid-buying-next-microsd-card/" rel="noopener noreferrer"&gt;https://www.makeuseof.com/tag/5-mistakes-avoid-buying-next-microsd-card/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/@bassonrichard/what-is-docker-and-why-is-there-such-a-big-hype-around-it-13badc312c28" rel="noopener noreferrer"&gt;https://medium.com/@bassonrichard/what-is-docker-and-why-is-there-such-a-big-hype-around-it-13badc312c28&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>raspberrypi</category>
      <category>k3s</category>
      <category>cluster</category>
    </item>
    <item>
      <title>Code review and the importance of it!</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Mon, 07 Oct 2019 19:18:26 +0000</pubDate>
      <link>https://dev.to/bassonrichard/code-review-and-the-importance-of-it-5hko</link>
      <guid>https://dev.to/bassonrichard/code-review-and-the-importance-of-it-5hko</guid>
      <description>&lt;p&gt;I’m here to tell you about code review (or as some may know it peer review) is, where it came from and how to effectively implement code review, without removing the important factor of psychological safety, and also share my experiences along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is code review?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Code review is a system where your team members critically look at the code you wrote then give you feedback on things like readability, quality, or perhaps business cases that you could have missed in your code. Your peers either learn from what you have done or help you correct your code and find bugs you might have missed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bU0EyFS9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/23go0wlaxed4ok6uc0rb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bU0EyFS9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/23go0wlaxed4ok6uc0rb.jpg" alt="Im scr: https://wlvdigital.files.wordpress.com/2015/07/1024px-evolution-des-wissens.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How reviews began and how it evolved into what we have now?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The initial reason for code review was to help the whole team take ownership of the software that was being created, so each person would personally have a hand in the quality of the software that was written.&lt;/p&gt;

&lt;p&gt;So not so long ago, but what feels like ages ago, in the magical world of Software any updates were not as streamlines as we have today. This meant there was less room for error, so these systems were built with no room for error. We still have systems like this even in today's time, for example, the firmware in your toaster.&lt;/p&gt;

&lt;p&gt;One of the ways they prevent errors from happening in these systems was by using a code review system. This is probably not the same as what you have in mind that we use these days, but rather a meeting room with developers that all have a printed version of your code critically evaluating every line. This I could only imagine would drive the project manager mad in these days with the tight deadlines we have in this strick ‘Agile’ world we live in today. &lt;/p&gt;

&lt;p&gt;So as the magical world of programming that we live in today changed and evolved over time so did the Code review system. We got the magical pull request system added to our version control. This means that as part of our source control we can also review the code that goes into our code, this helps prevent the code from being contaminated with code smells.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8dP8Bhds--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wutjwaax4zk24z3kiykw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8dP8Bhds--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wutjwaax4zk24z3kiykw.png" alt="SRC:https://imgflip.com/i/3cmgn4 "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why code review is important?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We need code review to share knowledge on the features that are being worked on and to help your team catch bugs before the code even goes out to be tested. The team will also be able to learn of different ways to write code because one person might be using language functions that you didn’t even know existed for example. This especially helped more junior developers as they might have some fundamentals that they don’t understand yet.&lt;/p&gt;

&lt;p&gt;When we do code reviews, the problem could be caught at the lowest point of invested time, and as they say, time is money. So having code reviews is like having a extra test environment without all the hardware costs in my opinion. The people doing the reviews might catch bugs the same as what would happen at a testing level, in the same breath I don’t think code reviews would ever replace testing environment. &lt;/p&gt;

&lt;p&gt;So code reviews will be another quality assurance gate that your code has to pass through which would be evaluated at a lower level, so the code will be evaluated at a maintainability level as well.&lt;/p&gt;

&lt;p&gt;Code reviews also allow you to enforce code standards of the team on the project you are working, creating a more readable codebase which could help future developers understand better as to what they are reading without too much effort, letting your code live on.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Code review tools&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are tons of amazing and free tools to use when you do code review, the best tool to use will mainly depend on the source control that you are using. Most of the source control providers have features where you can apply policies to branches that require you to make a pull request before you can merge your branch in and then allows you to specify how many reviewers are required to review your code before you can merge in your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;My takebacks from using code review&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;I tend to write much better code if I know someone is going to review the code that I have written so just the fact that someone is going to look at ti helps already.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I find it much easier to collaborate with people even if they are off-site as I see what new features have been added and what they are working on meaning I don’t duplicate code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I have learnt lots of good practices from looking at the code that the people around me write and I have gotten lots of constructive criticism.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It has added an extra safety net to development processes tending to keep me from committing that bug whack-a-mole code I wrote late at night.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Merge!&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Thanks for taking the time to read my take on code reviews. Now I will leave you the same way I leave all my PR’s, with a wonderful puppy gif:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XON4o4Qg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/http://giphygifs.s3.amazonaws.com/media/gxxlowyvtfS0M/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XON4o4Qg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/http://giphygifs.s3.amazonaws.com/media/gxxlowyvtfS0M/giphy.gif" alt="puppy Aircon GIF"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>codereview</category>
      <category>peerreview</category>
      <category>pr</category>
    </item>
    <item>
      <title>What is Docker and why is there such a big hype around it</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Thu, 26 Sep 2019 19:41:12 +0000</pubDate>
      <link>https://dev.to/bassonrichard/what-is-docker-and-why-is-there-such-a-big-hype-around-it-dag</link>
      <guid>https://dev.to/bassonrichard/what-is-docker-and-why-is-there-such-a-big-hype-around-it-dag</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;What is Docker, and why is there such a big hype around it 🐋?&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;Well, I am here today to tell you what docker is, and more specifically containerisation. So just like you get SaaS (Software as a Service), PaaS (Platform as a Service) and IaaS (Infrastructure as a Service) you now get CaaS (Containers as a Service) which is a service provided by Docker.&lt;/p&gt;

&lt;p&gt;Docker is the main containerisation platform that allows you to develop, run and deploy your applications using containers! So now I am going to tell you more about this amazing technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is a Container?&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;Before I can answer this question I first have to explain what a Docker image is.&lt;/p&gt;

&lt;p&gt;An image is an executable package that includes everything needed to run an application: the code, libraries, environment variables, and configuration files. So you have everything you need all boxed neatly together and ready for shipping.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://i.pinimg.com/originals/8b/e3/3e/8be33e8e6a287496ac3c9b7202d0d8e2.gif" rel="noopener noreferrer"&gt;Image Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A container contains all the dependencies that you need to be combined with the needed operations to install and run your application on the desired environment compiled into a runtime version of your Image. This includes commands that you can run to prepare your environment for all the nitty-gritty needs that your application might have.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why should I use Docker 🐳 ?&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;Have you ever had the situation where your code runs on your dev environment and as soon as you publish your code on the server it all fall apart and you get all these unexpected errors that you have no idea why you are getting them, then you get to scramble to save the release all just to find out a dependency was missing? So let’s be honest here, even with releases you still get swamped with future work and honestly we’re all humans so we tend to forget one or two things.&lt;/p&gt;

&lt;p&gt;Well, I can tell you with Docker you won’t ever have these problems. With the containers all your dependencies will be identical from the environment you are deploying from, so you will never have a problem with missing dependencies on your QA environment if you choose to use Docker. You also won’t need to worry about forgetting something, because you will be able to set this long beforehand and test it easily.&lt;/p&gt;

&lt;p&gt;Using Docker will also make it much simpler to set up a new dev environment, so you won’t have to worry about installing all the necessary dependencies and your app working with a specific version like Node or Python. So not only does Docker help with the deployment of apps but also development.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://i.redd.it/et48l7mvr5c11.jpg" rel="noopener noreferrer"&gt;Image Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Docker will allow you to encapsulate legacy projects, so the dependencies that you require will always be available. So you can set up servers that require older software and packages easily without having to worry about getting specific versions which aren’t available anymore. I have had this problem, where I needed a specific version of Devexpress which seemed to be impossible to find, so to make life easier: Dockerise.&lt;/p&gt;

&lt;p&gt;You can use Docker to provision boxes in the cloud, and with Docker Swarm or services like Kubernetes, you can then orchestrate your clusters. I might write about this sometime, but for now, this is out of this blog post’s scope.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is the difference between Docker and a Virtual Machine's&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;Docker is not OS (Operating System) dependent whereas a VM (Virtual Machine) is OS-dependent: this means you can run the same container in Windows, Mac OS (OSX) and Linux. This means your OS-dependent technology will run on any OS in a Docker container. You could run a .Net project on a Linux server! So now you can save money on your infrastructure by getting a Linux server instead of on a windows server, which I am sure is a win for everyone. You can also work on your preferred operating system and then deploy to any operating system as needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdocs.docker.com%2Fimages%2FVM%25402x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdocs.docker.com%2Fimages%2FVM%25402x.png" alt="VM Example" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/get-started/#images-and-containers" rel="noopener noreferrer"&gt;Image Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdocs.docker.com%2Fimages%2FContainer%25402x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdocs.docker.com%2Fimages%2FContainer%25402x.png" alt="Container Example" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/get-started/#images-and-containers" rel="noopener noreferrer"&gt;Image Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Docker manages the sharing of resources like memory and CPU between the host machine and the Docker containers where a Virtual Machine virtualises the resources of the host machine. This is why any container can run on any machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Docker Hub&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;Docker has an amazing tool, it is called Docker Hub. It’s like GitHub but for Docker images, so you could find prebuilt images for your tech stack and if you can’t find one you can always create your own and share it with the Docker community for the next person that might need it!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Docker is portable&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;This means you can build and run your container to your dev environment and then you can ship your built container to your server and it will work perfectly as is! You can spin up your application on your app on your local machine or hosting environment in a matter of minutes!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Docker Cheatsheet&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;Here is a list of all the basic commands that you will need for docker to get started:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## List Docker CLI commands
docker
docker container — help
## Display Docker version and info
docker — version
docker version
docker info
## Execute Docker image
docker run &amp;lt;Container NAME&amp;gt;
docker run -p 4000:80 &amp;lt;Container NAME&amp;gt;
## List Docker images
docker image ls
docker image rm
## List Docker containers (running, all, all in quiet mode)
docker container ls
docker container ls — all
docker container ls -aq
docker container stop &amp;lt;Container NAME or ID&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;How can I get started?&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;You can find more on &lt;a href="https://docs.docker.com/get-started/" rel="noopener noreferrer"&gt;https://docs.docker.com/get-started/&lt;/a&gt; so you can start learning how to use this amazing technology and build better software. Docker has an official hello-world image that you can pull and run to get a hang of how it works, you can find it at &lt;a href="https://hub.docker.com/_/hello-world/" rel="noopener noreferrer"&gt;https://hub.docker.com/_/hello-world/&lt;/a&gt;. One other thing I would suggest you can do to get yourself more familiar with Docker would be to host a simple Nginx website using a Docker image you can find here → &lt;a href="https://hub.docker.com/_/nginx/" rel="noopener noreferrer"&gt;https://hub.docker.com/_/nginx/&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now that you have an overview of why Docker is such a big hype hopefully you’re as hyped up about it as the rest of the dev community. So go out there now and try the thing and make some happy whale containers, and more importantly write better software!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>dockerhub</category>
      <category>containers</category>
    </item>
    <item>
      <title>Serverless, because who needs servers anyways</title>
      <dc:creator>Richard Basson</dc:creator>
      <pubDate>Thu, 26 Sep 2019 19:28:01 +0000</pubDate>
      <link>https://dev.to/bassonrichard/serverless-because-who-needs-servers-anyways-fok</link>
      <guid>https://dev.to/bassonrichard/serverless-because-who-needs-servers-anyways-fok</guid>
      <description>&lt;p&gt;You probably came to this blogpost wondering how is this possible, what kind of sorcery&lt;br&gt;
allows you to have an application work without servers? Well, in this post I am going to show&lt;br&gt;
you how this is possible! &lt;/p&gt;

&lt;p&gt;One of the main things that come up when you look up serverless is JAM stack, and no this is not just a bunch of jam jars stacked on top of each other, but an equally yummy stack of JavaScript, API’s and Markup. This is the basis of what serverless is built on. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is the JAM stack ?&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;According to the official definition, it is a modern web development architecture based on client-side JavaScript, reusable APIs, and prebuilt Markup.&lt;/p&gt;

&lt;p&gt;Serverless allows you to build applications without the use of servers. The JAM stack does not refer to specific languages, databases or operating systems, but rather the way you build the website or app: by not using servers as described in the name. So this means there are many options for databases and frameworks you can use for JAM stack.&lt;/p&gt;

&lt;p&gt;So now that you know about the JAM stack I can tell you what makes it so awesome!  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What makes JAM stack so great?!&lt;/strong&gt;
&lt;/h2&gt;




&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Better performance&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With JAM stack the sites files are hosted over a CDN (content delivery network) &lt;br&gt;
   which means that it can be hosted across multiple servers all over the world. This decreases loading time and gives minimal latency, so you can have better performance on your site!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Higher Security&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The server-side processes are handled by microservice APIs. This means you leave&lt;br&gt;
most of the security in the expert hands of the people who wrote these services so&lt;br&gt;
between your crazy deadlines and coffee addiction, this is one less thing you have to&lt;br&gt;
worry about.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cheaper and easier scaling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With your files being hosted over CDN it means you already have load balancing covered. So your JAM stack site will be able to keep up no matter how many users connect to your website concurrently. The services that you use with JAM stack are&lt;br&gt;
very cheap to use and depending on the number of operations and size of the app&lt;br&gt;
most of these services are free.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Better developer experience&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Yes, it is developer-friendly: you will not have to worry about keeping servers up and running, which is a big plus point. You can leave this up to the API services that you&lt;br&gt;
   are consuming, which makes it easier for devs to sleep at night without having to worry about the server being down.&lt;/p&gt;

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

&lt;p&gt;Image Source ~(&lt;a href="https://storage.googleapis.com/cdn.thenewstack.io/media/2017/12/537f29bc-42350470-jamstack.jpg" rel="noopener noreferrer"&gt;https://storage.googleapis.com/cdn.thenewstack.io/media/2017/12/537f29bc-42350470-jamstack.jpg&lt;/a&gt;) &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;My experience using JAM stack&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;When I heard about this I had the need to explore this further and experience firsthand what all the hype is about. I came across a bunch of tutorials on JAM stack. There were so many it was quite hard to choose so I ended up going with the one that covered most of what the JAM stack has to offer.&lt;/p&gt;

&lt;p&gt;With JAM stack you have a lot of open-source frameworks and languages to choose from. This helps you to choose a framework you might be familiar with and decrease the learning curve that you have to learn JAM stack.&lt;/p&gt;

&lt;p&gt;The tutorial that stuck out the most for me was a tutorial from J-Bytes, who had to create a POC (Proof Of Concept) for a project where he compared the serverless stack to one with a Node server. This was perfect to see if using this technology would be worth it. The tutorial guides you to make a Twitter/email campaign page using serverless technology. This is a very simple site and running a server for this seems like overkill. The clouds are already full of them so why add another one, right? You can follow the tutorial here&lt;br&gt;
(&lt;a href="http://robsherling.com/jbytes/index.php/2017/01/08/serverless-backends-with-aws-cloud-installs/" rel="noopener noreferrer"&gt;http://robsherling.com/jbytes/index.php/2017/01/08/serverless-backends-with-aws-cloud-installs/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;When I began this, I realised how important a role AWS plays in this tutorial which uses lots of AWS services like IAM for authentication, S3 for the site hosting, API gateway for the API calls, AWS lambda for lambda functions, and dynamodb for saving the emails. You can practically handle all of your server-side operations on AWS and at a very reasonable cost. You can also use other platforms like Azure, Google cloud platform and IBM for these services.  &lt;/p&gt;

&lt;p&gt;Learning lambda was not too steep of a learning curve and I could get the hang of it in a day. I already had experience with JavaScript wich was very beneficial so if you don't have experience it might take you a bit longer but it was pretty straightforward to grasp. So in the ever-learning dev world, you can take a slight break from having to learn everything from scratch. &lt;/p&gt;

&lt;p&gt;One of the important things I learned is to have static configuration files for each of your environments so you can easily set up a CI (Continuous Integration) pipeline to publish to your production environment and staging environments (oh yes all the buzzwords). It was a fun experience, and I encourage you to try it out as well. Below is a map of how all the services are connected with the serverless stack from the tutorial.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi0.wp.com%2Frobsherling.com%2Fjbytes%2Fwp-content%2Fuploads%2F2017%2F01%2FLamdaTwitter.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi0.wp.com%2Frobsherling.com%2Fjbytes%2Fwp-content%2Fuploads%2F2017%2F01%2FLamdaTwitter.png" alt="Lamda Twitter" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Image Source ~ (&lt;a href="https://i0.wp.com/robsherling.com/jbytes/wp-content/uploads/2017/01/LamdaTwitter.png?w=625" rel="noopener noreferrer"&gt;https://i0.wp.com/robsherling.com/jbytes/wp-content/uploads/2017/01/LamdaTwitter.png?w=625&lt;/a&gt;)&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The tech that I found to be useful when building a serverless application&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;While doing this I came across a lot of tech that you can use to create your serverless application, so here is a list of tech that I found to stand out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Lambda:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lambda expressions allow you to run code without having a server and scales as you need to make more requests, The free tier, depending on the service that you use, ranges from 1-2 million requests per day which seem to be plenty, considering that there are 86400 seconds in a day -- you will need to invoke a function way more than once every second to reach this cap. Lambda supports Node.js, Java, C#, Go and Python, so you should be able to find a language that you might know.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cloud-hosted NoSQL DB:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your cloud-hosted NoSql DB will allow you to have a database without the hassle of having a server, which is the point of serverless, and they are quite cheap. These databases are easily scalable so you don’t need to worry about how much data you are storing.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Storage and content delivery:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your website is hosted through a CDN (Content Delivery Network) when using serverless which allows you to get the lowest latency for the people who access your website. This decreases the loading times and makes your website a lot faster! So all-round awesome to use. You get about 5GB of storage for free on average, depending on the service you use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;API Gateway:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This will help you handle incoming and outgoing API requests and authorisation, and just make your life easier all-round when handling API requests. This is free for the first million requests each month on average so again this is quite cheap and not easy to deplete.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IAM:&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This provides identity and access management services., If you want to have users log in on your site, this will help you manage your users mostly.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What would I create using Serverless?&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;What I have seen and experienced from serverless is that it is great for small projects that aren't incredibly complex. You can build a simple website to gather people's information or you can use it for your pet projects. The cost of this is very attractive if you want to make something simple and still need some server-side services - like storage for example. So if you have a low-budget simple website or app that you want to create, JAM Stack would be perfect.&lt;/p&gt;

&lt;p&gt;There are a lot of frameworks using serverless that have specific templating for blogs, with CMS so you can easily create a blog with a CMS running client-side which cuts the servers out of the picture. This cuts costs, especially for someone who wants to create a very custom blog site, but does not want to spend a lot of money on the maintenance of their blog’s hosting. I have also seen serverless sites being used for documentation, knowledge bases, manuals and wikis. The possibilities are endless. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Now go out there and try things!&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;Yes, now that you know a little more about serverless, I encourage you to go try creating something using the JAM stack - and no I don’t mean Jam sandwich - but I hope you know this by now and I hope I to have sparked some interest into the JAM stack. If you would like to check out some of the frameworks you can use you can go here:&lt;br&gt;
(&lt;a href="https://www.netlify.com/blog/2017/05/25/top-ten-static-site-generators-of-2017/" rel="noopener noreferrer"&gt;https://www.netlify.com/blog/2017/05/25/top-ten-static-site-generators-of-2017/&lt;/a&gt;) &lt;br&gt;
they compiled a list of the top 10 serverless frameworks of 2017 that you can try. Don’t be scared to get your creative juices flowing. &lt;/p&gt;

&lt;p&gt;So now go out there and stop polluting the clouds with Linux servers - use serverless instead!&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>websites</category>
      <category>jamstack</category>
    </item>
  </channel>
</rss>
