Deploy an existing web app over a new one - azure

I have a working app service named "matanwebserver" over a subscription in Azure.
This is a website that I am working on. I work with Visual Studio and I wrote my code inside this app service in Visual Studio.
Now I want to create an Integration site so I can test my code before publishing to the production site.
For that, I created a new app service in azure under the name "matanwebservertest" and I want to use the code I wrote for "matanwebserver" over the new app service that I just created.
I could not find any source which provides a solution, so thanks in advance.
Added some screenshots for a better understanding of the issue
In Visual Studio I do right click on the web app which is called "MatanWebServer" and choose "publish".
Then I choose the new web app that I just created on Azure portal which called "matanwebserertest", and publish successfully.
enter image description here
This is the original (production) website. which its address is http://matanwebserver.azurewebsites.net
enter image description here
After publish to the matanwebservertest web app, I expect to see a "copy" of the original site, but it seems like nothing is there.
enter image description here

To get the current app cloned to the new one, have a look at the 'Clone App' option.
What you're trying to do feels like a perfect example to use for using Deployment Slots Please refer to Set up staging environments in Azure App Service.
When you deploy your web app, web app on Linux, mobile back end, and API app to App Service, you can deploy to a separate deployment slot instead of the default production slot when running in the Standard or Premium App Service plan tier. Deployment slots are actually live apps with their own hostnames. App content and configurations elements can be swapped between two deployment slots, including the production slot. Deploying your application to a deployment slot has the following benefits:
You can 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 ensures that all instances of the slot are warmed up before being swapped into production. This eliminates downtime when you deploy your app. The traffic redirection is seamless, and no requests are dropped as a result of swap operations. This entire workflow can be automated by configuring Auto Swap when pre-swap validation is not needed.
After a swap, the slot with previously staged app now has the previous production app. If the changes swapped into the production slot are not as you expected, you can perform the same swap immediately to get your "last known good site" back.

Related

configBuilder 'Secrets' failed

After the initial attempt to publish my web app to Azure I got the following error. I'm using Visual Studio 2019.
Is there a way to undo the publish?
How do I determine what is missing?
The configBuilder 'Secrets' failed while processing the configuration section 'appSettings'.: 'Secrets' Initialization Error: Method not found: 'System.String Microsoft.Configuration.ConfigurationBuilders.Utils.MapPath(System.String)'.
How do I undo the changes that Publish did within my project:
Approach-1:-
Generally, Azure Web Apps provides back up feature which you may enable in your app to keep a backup of your site. If you are sure that the deployment did not go as planned, you can restore the backup.
Goto App Service -> Choose BackUps
You can see the status of the webapps for every hour as shown here:
Click on Restore icon if needed.
Enter the restore location in Choose a location. Select Create new under the App Service box to restore to a new app. Select Create new beneath the Deployment slot box to restore to a new deployment slot.
You can choose the site configuration as well as per requirements. After providing all these, restore it.
Approach-2:-
Usually after publishing any web app to azure from local, it will be deployed on production server.
You may want to undertake some activity or verification before delivering/after delivering the website to production. You can use deployment slots in this case.
Azure provides non-production deployment slots for each web app, on which we can deploy the website temporarily.
Detailed in article given by #Krishna Kumar.
Create deployment slot by adding a slot under app service as shown:
Alternative Reference: Get publish profile

How to deploy single cshtml file in Azure app service

I have a .Net core app developed using Visual Studio 2019 and deployed on Azure app service. I have function app as well in the same solution. I have to do couple of things and then redeploy to Azure app service.
Add one .cshtml file
Modify one .cshtml file
My question is, how to deploy the CSHTML file only to the Azure app service? Without affecting the existing functionality of application.
As per my understanding, if web app is deployed in Azure app service then the whole thing (solution) has to be deployed even though there are/is very small code modifications.
Please let me know.Thanks.
Even if you have Web App and Function App in the same solution, they should be separated units of deployment. That said, your deployment pipeline should be separately triggered for Web App and Function App.
From the technical point of view(or architecture) there's no concept of "solution". Solution(.sln) is a Visual Studio specific being and even though it's supported e.g. in VS Code, I'd never treat it as deployment unit. Especially in your scenario, when in fact two separate services are responsible for handling your code.
Even if you deploy Function App as a part of the same App Service Plan as your Web App, it's still a separate Azure service. In such a scenario they only share compute.
Yes its possible if you have access to kudu deployment center you can perform manual add/update information , please visit below URL:-
https://[yourAppName].scm.azurewebsites.net
You can also navigate to this site using the azure portal , once you open the app service blade you will find the kudu deployment center option in the bottom left of the menu.
It will provide an online file explorer of your application hosted on the app service and from there you can migrate to relevant folder and perform add/update.

In Azure, how to deploy to production slot using Visual Studio?

I'm trying to learn how to deploy Web Application to Azure using Visual Studio 2015. I could successfully deploy a simple Web Application (without creating any slot). I moved to the ARM portal and found that there isn't any slot. However, when I try to swap, I can see "production" as an option in the source & destination drop down lists.
I created another slot and then I tried to publish the Web Application again, but I could only see one slot, which is the newly created slot (please see the screen shot)
I'm a bit confused. According to my understanding, there should be a default slot which I can deploy specifically to it and then swap to/from it.
Any ideas?
As far as I know, the "TestWithDB20170822062605" application is your default application. You could directly select this web app. If you publish the application to this. It will be regard as production app.
If select the TestWithDBSlot2, it will publish the application to your newly created slot.
Firstly, if you select the "TestWithDB20170822062605" application, VS will publish the application to the TestWithDB20170822062605.azurewebsites.net.
This is according to the url not the slot or something else.
But if you swap the web app.
It will like this
TestWithDB20170822062605.azurewebsites.net --------> TestWithDBSlot2
TestWithDBSlot2.azurewebsites.net -----------> Production
So you will find you publish the application to the slot TestWithDBSlot2, but the url is still TestWithDB20170822062605.azurewebsites.net. This is according to the url not the slot name.

API App in Azure does not reflect changes after continuous integration deployments

I have setup continuous deployment of a standard web api project to an API App on Azure. The new version is deployed to the staging slot and then swapped with production at the end of the release task. I can see that (by going to App Service Editor in azure portal) the dll file versions reflect the latest changes. But when I access the APIs (from a webapp or postman) on this Azure app the result does not reflect the published changes. The only way I can force the new changes is either restarting the API app or stopping and starting the app service.
Am I missing anything in using continuous integration with API app on Azure?
I have solved this by adding a new task available in VSO release which restarts the staging slot before swapping with production. This makes sure that the new changes are part of the IIS process.

How To Update a Web Application In Azure and Keep The App Up the whole time

I've a MVC Web Application (.NET) and from time to time I need to upgrade the deployment version on Azure, the problem is that I have customers that are using the Web-App and I cant take it down and make it unavailable.
There is a way to deploy a new version of my Web-App and still be up and running the all time? (during the deployment process)
One way that I could think of it to do it is by deploy the the Web-App to somewhere other than my current deployment and "play" with the DNS record on my external domain.
Use deployment slots.
Azure Web Apps let you create staging slots for your site. They're effectively independent sites that you can deploy your test/staging bits to.
Then when you have the staging site ready you can push a button and make it your public production site.
See here for more details: https://azure.microsoft.com/en-us/documentation/articles/web-sites-staged-publishing/

Resources