Azure Deployment Slots Cost
- Azure Deployment Slots Cost
- Azure Deployment Slots Cost Calculator
- Azure Deployment Slots Cost Chart
- Azure Deployment Slots Cost Per
DevOps has become a hot topic in the IT industry due to the increased demand for reducing manual efforts and operationalize the workflow using automation tools and techniques. The idea of using the DevOps strategy is to reduce the overall efforts and errors, ultimately building more scalable and stable application environments.
Before I tell you even more about what make Azure deployment slots awesome, let me state the facts about deployment slots: Each deployment slot is like a full-fledged App Service instance. The original App Service deployment slot is also called the production slot. Azure Deployment Slot is a very useful feature of the Azure App Service. With this feature, it is possible to create one or more slots that can host different versions of your app. You can then swap these deployment slots without causing any downtime for your users. Creating a deployment slot is very easy and, as always, there are many ways to do it. You can use the Azure Portal, Azure CLI, Azure PowerShell and the Azure Management API. I’ll show you how to do it using the Azure Portal. In the Azure Portal, navigate to your App Service - let’s say it’s a Web App - and click the deployment slots menu. One great feature of Azure Web Apps is deployment slots. I recently had an excellent use case for them as a small startup I’m working with is trying out ASP.NET MVC. In the process, we learned how effectively deployment slots allowed their team to work on the project commit code, test it against a test DB as if in production, then quickly. During the swap operation the site in the staging slot is warmed up by making an HTTP request to its root directory. More detailed explanation of that process is available at How to warm up Azure Web App during deployment slots swap. By default the swap will proceed as long as the site responds with any status code. However, if you prefer the.
Continuous Integration(CI) and Continuous Development(CD) strategy has become one of the core components and best practices of building agile workloads that can support frequent updates by multiple contributors and still be able to build, test and deploy robust infrastructure.
In the last article, I introduced you to Azure App Service and explained some high-level information about its capabilities and functionalities. I'll be continuing the series and giving you in-depth tutorials on how to leverage app services to get the maximum out of its capabilities. Check out my previous article below, in case you missed it.
In this article, I'll guide you through how to create Azure App Service resources and also enable continuous deployment to leverage DevOps capabilities for your application code. Stick with me to the end and you'll see how painless and straightforward it is to enable CI/CD capabilities for your application.
- Creating a Resource Group for App Service
- Creating Azure App Service Resource
- Setting up Continuous Integration and Continuous Deployment (CI/CD)
Before I begin with the configuration and deployment, there are some requirements that you must have in place to follow along:
- You should be familiar with Azure Portal and navigating inside the portal.
- You should have an active account on GitHub or Azure DevOps.
- You should be able to access shell.azure.com using your Azure account or be able to use PowerShell or CLI on your local computer (optional).
First of all, you need a resource group that will host your App Service and other dependent resources like App Service Plan and App Insights. You can choose to leverage any existing resource group if you already have one. The creation of a resource group is pretty simple and you can use either PowerShell or Azure Portal for this task as described below.
Creating a Resource Group using PowerShell/CLI
Use the following PowerShell or CLI command based on your preference. Feel free to change the resource group name and location as needed.
Creating Resource Group using Azure Portal
If you are comfortable using Azure Portal, follow the steps below to create a new resource group.
- Login to Azure Portal (portal.azure.com)
- In the top search bar, search for 'Resource Group'
- Click 'Add' on the next screen.
- Fill the information for your resource group name and click 'Review and Create'. This should give you an option to create the resource group once you review the final configuration.
Once you deploy the resource group, move to the next section for some more interesting work now.
Before setting up the CI/CD Pipeline, a Web App resource is required that'd connect with your Repository of choice for the code integration. You can deploy the necessary resources using either PowerShell or Azure Portal. I've provided the steps for both options, feel free to choose one of them to deploy the app service resources.
Using PowerShell for App Service Deployment
Creating App Service using PowerShell or CLI involves deploying dependent resources like App Service Plan before the app service itself. App Service Plan is used to host the application and its runtime environment. Follow through the steps below and be sure to change the variable names based on your resource naming convention.
Using Azure Portal for App Service Deployment
Are you a fan of using Azure Portal instead? I've got you covered!
Follow the steps below to deploy your app service resource using the Azure Portal.
- Navigate to the resource group that you wish to use for your App Service resource.
- Click 'Add' on the top left to see the list of resources to choose from.
- Choose 'Web App' from the list.
- Fill out the details as per your application's usage. I'll be using NodeJS with 'Node 12 LTS' Runtime. Be sure to use 'F1' Free tier for your application to avoid any resource cost. It's FREE of cost 😉
- Finish the next steps by clicking 'Review and Create'.
Now with that, you deployed your web app and an app service plan from a single panel. In the next step, you'll configure the continuous deployment for the newly created app service with GitHub and Azure DevOps.
At this point, you should have your application up and running with a generic web page that you get out-of-box. The next step is to configure the deployment repo for your application. To do this, you'll be connecting the app service with GitHub using an option in the app service called 'deployment center'.
Before you move forward with the configuration, use the link below to copy, clone or fork my Repository that contains a sample node web application so that you have a sample code to play with during the setup. Store the code in either GitHub or Azure DevOps Repo depending on which platform you choose for connection. I'll be using this repository as a CI/CD source for the demo of both Azure and GitHub Repos.
The next final step to this configuration is to enable Repo access for continuous development. To do this, you need to navigate to the newly deployed app service resource and choose Deployment Center from the left panel.
Refer to this same page whether you want to connect Azure Repos or GitHub repo. I'll be explaining both approaches from here.
Configuring CI/CD with Azure Repos
If you are connecting your Azure Repos with Azure App, make sure you have already created an Azure DevOps Organization to store your project files. Once ready, continue with the steps below.
- Click on 'Azure Repos' and press Continue
- Azure Repo supports Azure Pipeline build which creates a pipeline and release build for you in Azure DevOps that is automatically triggered on code updates.
- If you see the image below when trying to connect, you probably haven't created the Azure DevOps Organization and Projects yet. Follow the steps here to configure your Project and store repos. Once the project is configured, refresh the Azure Portal and follow the steps again to add Azure Repo for deployment center integration.
Make sure that the Account used for Azure Portal Login has permissions to the DevOps Organization as well or it won't be able to access any projects and repos.
- Once the Connection is successful with the Azure DevOps, you should start seeing the Organization that you have access to and the projects within each organization.
- Choose the repo that you copied or cloned earlier. Since it's a Node project, make sure you set the startup command to
npm start
.
- Click finish when done and your application should be up and running now without much effort.
Configuring CI/CD with GitHub Repos
If you wish to use GitHub Repos instead of Azure Repo, follow the same steps to choose Deployment Center from the application blade.
- Unlike last time, choose 'GitHub' instead and press Continue.
- You might need to authorize and allow permission to your GitHub account. Use the sign-in form when prompted to authenticate to GitHub and connect your repos with App Service.
- Choose the 'App Service Build Service' for your build provider as it'll compile your code automatically during deployment.
- Choose the repo that you copied earlier and finish the process.
- Just within a few minutes, your application should be up and running on App Service.
At this point, your application is fully integrated with App Service and any changes that you make to your code repo will be synced and changes will reflect in real-time.
I hope that sets you up for success with deploying CI/CD Pipeline for your Azure App Service to sync code updates to your web application without any effort during the change process.
Leave a comment down below if you liked what you read, and I will see you in the next one.
If it’s your first time here, check out other articles in the series:
Part 1: Up and Running with Azure App Service
Part 2: Continuous Deployment for Azure App Service
Part 3: Using Deployment Slots with Azure App Service
Part 4: Setup Custom Domain for Azure App Service
Part 5: Deploying Next.JS App on Azure App Service
Part 6: Next.JS App with Cosmos DB on Azure App Service
Part 7: Why Should You Use Azure App Service?
Part 8: Easy Auth for Azure App Service
Part 9: How To Clone An Azure Web App?
This is part 2 of a 4-part series about Azure App Service. You can find the other posts in this series here:
You can also learn more about Azure App Service from my Pluralsight course Introduction to Azure App Services. It is a bit older, but still very useful.
And if you like these posts and want to support me in what I do, please visit my Pluralsight page and follow me.
Hosting Web Applications with Web Apps
Azure App Service Web Apps are one of the most popular services in Azure. This is because they are very easy to get started with and enable you to run your web application in Azure in minutes.
The power of Web Apps (and the other App Service types) is their ability to abstract the infrastructure. Let me explain. Traditionally, when you would develop and host a web application, you would develop it and then host it in a webserver, like IIS, which would run on an operating system, like Windows Server. All of this would typically run on either a virtual machine or a physical server that must be kept secure, performant and available.
In this traditional scenario, you, as a developer, would be responsible for developing the application. And you would also be responsible for some of the webserver configurations, like setting up the application pools and configuring the right security settings and language runtimes (for instance, configuring the correct version of the .NET Framework).
When you host your web application in an Azure Web App, Azure takes care of a lot of plumbing for you. The Service Fabric keeps the server and operating system secure, performant and available. And all you have to do, is to develop the application and deploy it to the Web App, which is basically an abstraction of a webserver. It is a webserver-as-a-service. You can still configure some of the security settings and runtime versions of the Web App, but you don’t have to do that in most cases.
Web Apps and other App Service types take care of a lot of work for you. This enables you to focus on creating the application – on adding value to your business.
Web App facts
An Azure Web App is a webserver-as-a-service. Here are some of its properties:
- Web Apps run web applications. These could be websites, general web applications and APIs
- You can run all sorts of applications in a Web App. You can run applications that are written in .NET, .NET Core, Python, PHP, Node.js, Java, Go, Ruby and more
- Web Apps come with an SLA (Service Level Agreement) that promises that they will stay up and running 99.95% of the time
- You can use all of the App Service shared features with Web Apps, including custom domains, deployment slots, scaling and hybrid connections
Web Apps run on Windows and Linux and can run Containers
When you create a Web App, you can choose what the underlying operating system should be. You can run a Web App on a Windows OS or on Linux. You don’t get to choose which version of Windows or Linux you use, because App Service will take care of that for you. You should focus on creating the application.
Alternatively, you can choose to create an Azure Web Apps for Containers. This is just like a regular Web App but expects you to run a Windows Server or Linux based (Docker), container in it. This is a container that you store in a registry like Docker Hub, or in the Azure Container Registry service. Web Apps for Containers doesn’t come with or require a container orchestrator. It is perfect to run a single container in.
The advantage of running a container in Web Apps for Containers, as supposed to running it in another service, like in the Azure Container Instance service, is that you can use some of the App Service features, like deployment slots.
Zero downtime deployments with Deployment slots
Deployment slots. We’ve discussed this feature in the shared features section of the first post in this series, but I want to discuss it in more detail here. This is a feature that all of the App Service types can use, so it is not unique to Web Apps.
Deployment slots are sometimes called staging slots and that makes sense. You can use them as staging environments for the new version of your application.
When you have an Azure Web App, you can create one or more deployment slots for it. These can all run in the same App Service Plan, so they don’t cost you any money.
A deployment slot is a Web App, just like the original Web App that you create deployment slots from. This means that a deployment slot has almost all the same features that a Web App has and can host your application in exactly the same way as your Web App does. And when you create a deployment slot, you can also copy the configuration of your Web App. You can copy things like application settings and connection strings.
Web Apps have a unique URL and unique public IP address assigned to them. You use these when you access the Web App from the internet. A deployment slot is also a Web App (or another App Service type) and also has a unique URL and IP address. If you use your deployment slot for staging purposes, you might include staging in the name of the URL of the slot. You can reach the deployment slot with this URL. So when you deploy a new version of your application to the deployment slot, you can start testing it with that URL. This is one of the benefits of using a deployment slot – it provides a separate testing environment that is the same as your production environment.
You can also route some of the production traffic to your deployment slot. Normally, 100% of the traffic would go to your original Web App. In the Azure portal, you can indicate that you want, for instance, 20% of the production traffic, routed to your deployment slot. This way, 20% of your users will use the new version of your application and you can verify if and how they are using the new features in that version.
Once you are satisfied with the new version of your application, you can put it in production by performing a “swap” operation. A swap operation makes sure that your users experience no downtime when you promote the new version to production. It does that by:
- Warming up the source slot by hitting a URL to make the application load its assemblies into memory (you can also customize this behavior)
- Swapping the IP address and URL of the deployment slot and the original Web App (which we also call the production slot). This makes the source deployment slot the production slot
The swap operation can also be used to revert a deployment. If you are not happy with the new version, you can just swap it back to the deployment slot, thereby putting the old version of your application back into production.
To me, deployment slots offer enough value to use App Service. You can easily integrate the swap functionality into your deployment tool, like Azure DevOps or any other tool, to automate the process when you release a new version.
Scaling up and out
One of the benefits of running your application in the cloud is that you can scale endlessly. Or at least as far as your credit card stretches. This enables you to keep your application up and running when traffic is unusually high. And it enables you to save costs when there aren’t as many users.
There are two types of scaling; scaling up and down and scaling out and in.
Scaling up and down
One way of scaling is to increase the amount of resources that run your application. For instance, you run your application on a bigger server, with more CPU, memory, disk space and networking bandwidth. This is called scaling up.
You can also scale down by decreasing the amount of resources that you run your application on. By running it on a smaller machine.
Azure Deployment Slots Cost
In App Service, you can scale up and down by choosing a different pricing tier for the App Service Plan that runs your App Service. This increase or decreases the amount of resources that run your app.
Scaling out and in
You can also run your application on more instances, by scaling out. This increases the amount of throughput that is available for users and can increase the performance of your application.
Scaling out can be very difficult. Your application needs to be ready to run on multiple instances. For it to run on multiple instances, it should not rely on any resources that are tied to any particular instance. For instance, your application shouldn’t store data in local memory (of the VM it runs on) or save information on the local disk. Instead, your application should use external services, like Azure Storage, to store and retrieve information.
Just like scaling out, you can save costs by running your application on less instances – by scaling in.
Scaling out and in used to be very difficult. It involved setting up and running web farms, which isn’t easy. In Azure App Service, scaling out and in is easy. You can do it manually, by increasing the number of instances, or automated, by configuring a schedule or configuring metrics.
You can configure a Web App to scale automatically by telling it when to scale, based on one or more metrics. You can, for instance, tell it to increase the number of instances to 5 when the CPU hits 70%. The automated scaling can also work on a schedule. For instance, you could configure your Web App to scale in, to 1 instance every day at 17:00 as you know the application won’t be used as much anymore. This can save you costs. You can also combine a schedule with metric rules.
A word of warning: whenever you scale your App Service, it takes a while for it to scale up or scale out. This is because the Service Fabric needs to copy over your application workload to other instances or to a bigger VM or to another VM. This usually takes a minute or so at most, but it is something that you need to plan for when you design your scaling strategy.
Deploying your application to a Web App
By now you might be wondering how you can get started. You can do that by deploying your application to a Web App (or another App Service type).
There are many methods that you can use to deploy your application to Azure App Service:
- Use the deployment center feature in App Service
- This enables you to couple a source control repository (like GitHub, Azure DevOps Repos or something else) to your Web App and build and deploy whenever you push new changes
- Use Azure DevOps
- This is the go-to build and deployment center of the Microsoft technology family. This is the online version of what was called Team Foundation Server (which is now called DevOps Server). Azure DevOps used to be called Visual Studio Team Services and Visual Studio Online before that
- Use the Azure API
- Azure has a management API that you can use to do almost anything in Azure. You can use this API directly, or from a number of clients, including the Azure Command Line Interface (CLI)
- Use your Integrated Development Environment (IDE) with the Azure SDK
- The Azure SDK is available for most modern IDEs, like Visual Studio and Eclipse, and enables you to work with Azure from there. This also enables you to deploy your application straight from your IDE
Let’s look at deploying your application from your favorite IDE to an Azure Web App. You can do this for development and testing purposes, but you shouldn’t do this for production. You should deploy to production using an automation tool, like Azure DevOps or the App Service deployment center.
Deploying from an IDE is easy. You just need the Azure SDK or relevant Azure tools for your IDE. For Visual Studio, the Azure SDK is already included. You do need to make sure that it is enabled. You do that by indicating that you want the Azure workload to be installed in Visual Studio.
After that, deploying to a Web App is very simple.
Azure Deployment Slots Cost Calculator
- From the solution explorer, right-click on your application and choose Publish. This will open the publish window.
- In the publish window, select App Service as the publish target
- You can now create a new App Service or pick an existing one
- Now click publish to deploy your application
Azure Deployment Slots Cost Chart
That is how simple it is. You don’t even need to have an existing App Service, you can just create one including an App Service Plan and even an Azure SQL Database or Azure Storage account from the publish window.
Summary
Azure Deployment Slots Cost Per
In this post, you’ve learned what Azure Web Apps are.
- Azure Web Apps are used to run web applications in the cloud
- Web Apps run on Windows, Linux and you can run containers in them
- All App Service types can use deployment slots to do zero-downtime deployments
- Scaling up and down increases and decreases the amount of resources your app runs on
- Scaling out and in increases and decreases the number of instances your app runs on
- All App Service types can scale up and down and out and in. You can scale manually and configure automated scaling
- There are many ways to deploy your application to an App Service, including Azure DevOps, the deployment center feature and deploying manually through the API, CLI or tools like Visual Studio