Azure Cloud Service Slot Setting - azure

I have a staging and a production slot on a Azure "Cloud Service (classic)".
My app polls a hangfire db for jobs. I don't want the staging instance to also pick up jobs. An "App Service" appears to have slot specific settings but there is no option in the portal for the "Cloud Service".
Is there a way to set slot specific settings for a Cloud Service in Azure?

Is there a way to set slot specific settings for a Cloud Service in
Azure?
AFAIK, No. Other than the DNS name a staging slot is similar to production slot. The main purpose behind having staging and production slot is to quickly test the application in production like environment without actually deploying the code in production.
You could consume Azure Service Management API inside your Cloud Service code to decide whether the current code is running in production or staging environment and accordingly pick up the job.

Related

Azure Devops: agentless deployment to Azure App Service

I´m preparing a release to deploy a web app to a Azure App Service and seems that this task is not available as part of an agentless job. Thinking a bit about it, I wonder why. I mean: In my understanding, deploy to Azure is essentially take the artifact (assuming that is already stored in Azure devops) and deploy in the resource provided in the service connection through the actions performed by the Deployment task.
I would say that this process does not (necessarily) requires an agent out of the Azure Devops environment to be done (at the end, we are moving things between PaaS) but seems that we are enforced to use it.
Is my thought correct or I'm missunderstanding anything?
Any way to perform this kind of deployment without agents? (my Azure App Service has a private endpoint, so only self-hosted agents are able to reach it and I would like to avoid create them)
Any Azure DevOps Pipeline needs an Agent to run it (the workload must run somewhere, right?). If you use private endpoints and you want to PUSH your deployment to Azure App Services, you will have to create a self-hosted Agent that is connected to the App Service VNET. There is no way around it.
However, Azure App Service enables continuous deployment from Azure Repos repositories by pulling the sources (See Continuous deployment to Azure App Service. This will probably also work with private endpoints (not tested it).

Use approval with deployment to azure app service from azure pipeline

We are creating a yaml pipeline that uses the AzureRmWebAppDeployment#4 task to deploy the code to an app service.
Before, we deployed to our own virtual machines, and we could register the virtual machine as an environment in azure devops, and register a deployment agent as a resource to it. Then we could add an approval gate to the environment to make sure approval is required to be able to deploy to the environment.
Now with azure app services, there doesn't seem to be a way to register the app service as an environment, so we have not Environment to set the approval gate on.
How can we add an approval to the deployment of our app? I find it hard to believe it is not possible for app services.
I discovered it's possible to add approvals to a service connection in the same way you can with environments. This allows me to add a gate to my deployment!

Azure Deployment Slots with multiple websites hosted under one App Service plan

I am in the process of moving multiple websites to Azure under one Premium App Service plan. Following the instructions provided here https://dotnetthoughts.net/deploying-multiple-application-in-webapp/ I was able to host multiple sites under one App Service Plan but I am struggling to figure out how I can make use of Deployment Slots for multiple sites. It looks like there is only one "Production" Slot per App Service plan which means I can only swap a Deployment Slot with the only Production Slot. Does someone know how each website can have a Production Slot and a corresponding "Testing" Slot?
You can have multiple web apps under a single Azure App Service Plan. Meanwhile, under every web app(App Service), you can create multiple slots and you can have production and staging for every web app separately.
Each App Service plan tier supports a different number of deployment slots. Azure App Service Plan Premium (v2) supports = 20 and standard supports = 5 deployment slots.
Based on your requirement you can put all your apps in one App Service plan and have multiple deployment slots. If you have multiple deployment slots for an app, all deployment slots also run on the same VM instances.
Since you pay for the computing resources your App Service plan allocates, you can potentially save money by putting multiple apps into one App Service plan. You can continue to add apps to an existing plan as long as the plan has enough resources to handle the load. However, note that the apps in the same App Service plan all share the same compute resources. Overloading an App Service plan can potentially cause downtime for your new and existing apps.
You don't get charged for using the App Service features that are available to you (configuring custom domains, SSL certificates, deployment slots, backups, etc.)
Checkout this document for more details: https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots

How to design the environments hosting (dev, stage, prod) for my Azure API App?

I'm writing an API that will basically provide services to read and write to a Database.
My goal would be to have three environment. Dev, Stage and Production.
The first idea was to have three different resource groups, each with three different App Service Plans to host each environment.
Then i started reading and the recommended strategy seems to be to have all of the environments hosted within one App Service Plan. This way you could take advantage of swapping deployment slots. Also I'd be paying one third of the price.
But i also read that it's good to have a production environment isolated from the rest. So this way I'd need one App Service Plan for Prod, and another one for the rest of my environments.
So my first question is, is there a suggested/standard way to proceed setting up environments?
Is swapping exclusive to environments within a single App Service Plan?
Also i was comparing specs of Standard, Premium and Isolated tiers, and i couldn't find info on if Isolated App Services Plan have 'Staging Slots' for deployment. I know that Standard tier comes with 5 slots and Premium tier has 20. Does Isolated App Service Plans not support multiple deployment slots?
Thanks in advance for any insight that you guys can provide me.
is there a suggested/standard way to proceed setting up environments?
As far as I know, it is convenient for us to create deployment slot in the azure portal when the app is running in the Standard or Premium App Service plan tier.
Add a deployment slot
In the azure portal, open your app's resource blade-->Deployment slots-->Add Slot-->give the slot a name and select Configuration Source. If you have several slots, you could swap them manually or set the Auto Swap.
Configuration for deployment slots
When you using the swap feature, you should know the settings that can be swapped or not. Also, you could set slot setting, note that marking a configuration element as slot specific has the effect of establishing that element as not swappable across all the deployment slots associated with the app.
For more details, you could refer to this article.
Is swapping exclusive to environments within a single App Service Plan?
Per my understanding, App Service Plan is like a VM, it holds your app, deployment slot is like a copy of the web app that you can make different configurations. It also be held with the App Service Plan. If the App Service Plans have different pricing tier, they will have different features. So we could not swap the slots in different Service Plans.
Does Isolated App Service Plans not support multiple deployment slots?
Actually, Isolated App Service Plan supports deployment slots.You could view full details for App Service Plans.The Isolated tier is special.In the Isolated tier, the App Service Environment defines the number of isolated workers that run your apps, and each worker is charged hourly. In addition, there's an hourly base fee for the running the App Service Environment itself.
You could select the tier when creating the App Service Plan, but cannot scale up to this tier in the scale up option in the resource blade.

Azure web app - Additional deployment slots affect production slot?

I am using Azure app service for hosting my web application. I have three slots namely 1. Development, 2.Staging , 3.Production.
I usually go with publishing my website into Development slot and I will swap to Staging and Production.
Whether running additional two slots will affect my production slot performance? And will be billed separately?
As described in the Azure pricing page, specific tiers of Azure App Services contain a number of staging environments (deployment slots). These are included in the app service plan, whether you use them or not. Cost is based on tier and number of instances, not number of slots.
All resources within an App Service plan share the same resources (e.g. if you launch many web apps in the same App Service plan, they all share the same instances). All deployment slots for a given web app reside within the same App Service plan.

Resources