Deployment slots are very useful service from Azure cloud services, this isolate enviorment for developers to develope and test the codes in a seamless manner.The feature swap, enable the developers to rapid deployment and easy roll out roll back.
For an example your web users connected and accessing the original production site on the production slot,you can deploy a new version of the Web App into a secondary deployment slot, so you can test it before it goes live.
If this is the case, should the queue connectionstring be moved from app.config into Azure Website config so my Staging and Production slots can run on different queues? Azure azure-web-app-service azure-webjobs. This article shows you how to use FTP or FTPS to deploy your web app, mobile app backend, or API app to Azure App Service. The FTP/S endpoint for your app is already active. No configuration is necessary to enable FTP/S deployment. Open FTP dashboard. In the Azure portal, search for and select App Services. Select the web app you want to deploy. For every web app, Azure provides four non-production deployment slots on which we can deploy the website. Every deployment slot provides a different URL to access the web app for the verification of the application. What is the usage of Deployment Slots? Deployment slots provide the option to deploy websites in other environments rather than. I've worked a lot in the past with Azure Cloud Services Web Roles, but I am a bit new with Azure Websites/WebApps. I really loved the concept of multiple deployment slots you could define for WebApps, that enables some useful CD scenarios. In my case, I will have Test-PreProd-Prod slots defined. About Deployment Slots. Azure web app service has a fantastic feature called “Deployment Slots”, available on standard or premium mode pricing tiers.This feature allows you to spin up multiple slots (full instances) of your web application for test/development and staging uses.
![Azure web app deployment slots pricing guide Azure web app deployment slots pricing guide](/uploads/1/3/5/8/135806213/520196016.png)
Slots are based on the application services(standard ,premium or isolated)and running on the same application services.There won,t be any additional cost.
Features
Hot deployments to production with out downtime
Easy roll out and roll back
Hot deployments to production with out downtime
Easy roll out and roll back
Benifits of Deploying application to a non-production slot
Validate app changes in a staging deployment slot before swapping it with the production slot.
Deploying an app to a slot first and swapping it into production makes sure that all instances of the slot are warmed up before being swapped into production.
If the changes swapped into the production slot aren’t as you expect, you can perform the same swap immediately to get your “last known good site” back.
Validate app changes in a staging deployment slot before swapping it with the production slot.
Deploying an app to a slot first and swapping it into production makes sure that all instances of the slot are warmed up before being swapped into production.
If the changes swapped into the production slot aren’t as you expect, you can perform the same swap immediately to get your “last known good site” back.
Setting up
Suppose, you have a production site which is running and don’t want to disturb the site,create a clone site and modify the codes and test it.
In the Azure Portal, navigate to App Service and click the deployment slots menu item
click on the add slot
clone the site
This will create a same your production site,but the site name is different(with your slot name).
divide your traffic
By default, Traffic % is set to 0 for the new slot, and all traffic routed to the production slot.We can change the traffic % divided to both the slots.
By default, Traffic % is set to 0 for the new slot, and all traffic routed to the production slot.We can change the traffic % divided to both the slots.
swap
When swap the slots,from a staging slot into the production slot after code changes to know,how the web page looks like with out production downtime and revert back to old.
When swap the slots,from a staging slot into the production slot after code changes to know,how the web page looks like with out production downtime and revert back to old.
To configure auto swap:
Go to your app’s resource page. Select Deployment slots > <desired source slot> > Configuration > General settings.
For Auto swap enabled, select On. Then select the desired target slot for Auto swap deployment slot, and select Save on the command bar.
Go to your app’s resource page. Select Deployment slots > <desired source slot> > Configuration > General settings.
For Auto swap enabled, select On. Then select the desired target slot for Auto swap deployment slot, and select Save on the command bar.
Using powershell create web app
New-AzWebApp -ResourceGroupName [resource group name] -Name [app name] -Location [location] -AppServicePlan [app service plan name]
New-AzWebApp -ResourceGroupName [resource group name] -Name [app name] -Location [location] -AppServicePlan [app service plan name]
create slot
New-AzWebAppSlot -ResourceGroupName [resource group name] -Name [app name] -Slot [deployment slot name] -AppServicePlan [app service plan name]
New-AzWebAppSlot -ResourceGroupName [resource group name] -Name [app name] -Slot [deployment slot name] -AppServicePlan [app service plan name]
Azure Web App Deployment Slots Pricing List
Initiate a swap with a preview (multi-phase swap), and apply destination slot configuration to the source slot
$ParametersObject = @{targetSlot = “[slot name – e.g. “production”]”}
Invoke-AzResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action applySlotConfig -Parameters $ParametersObject -ApiVersion 2015-07-01
$ParametersObject = @{targetSlot = “[slot name – e.g. “production”]”}
Invoke-AzResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action applySlotConfig -Parameters $ParametersObject -ApiVersion 2015-07-01
Cancel a pending swap (swap with review) and restore the source slot configuration
Invoke-AzResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action resetSlotConfig -ApiVersion 2015-07-01
Invoke-AzResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action resetSlotConfig -ApiVersion 2015-07-01
Swap deployment slots
$ParametersObject = @{targetSlot = “[slot name – e.g. “production”]”}
Invoke-AzResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-07-01
$ParametersObject = @{targetSlot = “[slot name – e.g. “production”]”}
Invoke-AzResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action slotsswap -Parameters $ParametersObject -ApiVersion 2015-07-01
Monitor swap events in the activity log
Get-AzLog -ResourceGroup [resource group name] -StartTime 2018-03-07 -Caller SlotSwapJobProcessor
Get-AzLog -ResourceGroup [resource group name] -StartTime 2018-03-07 -Caller SlotSwapJobProcessor
Delete a slot
Remove-AzResource -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots –Name [app name]/[slot name] -ApiVersion 2015-07-01
Remove-AzResource -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots –Name [app name]/[slot name] -ApiVersion 2015-07-01
Azure Web App Deployment Slots Pricing Guide
See the video
other references
https://teckadmin.wordpress.com/2019/07/06/create-demo-app-web-site-in-azure-using-azure-cli/
https://teckadmin.wordpress.com/2019/07/06/create-your-first-we-application-in-azure/
https://teckadmin.wordpress.com/2019/07/06/create-demo-app-web-site-in-azure-using-azure-cli/
https://teckadmin.wordpress.com/2019/07/06/create-your-first-we-application-in-azure/