I have an application which is using internal file storage (folder) I can't include this folder in the project since the build is failing. I can deploy this build package which is a zip file using Azure Deploy task in the release pipeline but how can I copy that folder to the WebApp?
I don't have access to the FTP due to company policy
I can copy that folder to storage blob but then how can copy it to web app again?
Here's one way to do it.
In the Azure Portal, locate your Web App and click on the Advanced Tools menu. Click Go to launch the Kudu console. Select CMD from the Debug Console menu. You'll be presented with a graphical file explorer and a command line prompt. Simply drag and drop your local folder in the top portion.
You can use the Kudu REST API
PUT /api/zip/{path}/
Upload a zip file which gets expanded into the specified folder. Existing files are not deleted
unless they need to be overwritten by files in the zip. The path can be nested (e.g. folder1/folder2), and needs to exist.
Related
Using the Deployment Center link on the App Service page navigation in the azure portal, I was able to find my FTP credentials and easily log in with them. However, there are no files in the wwwroot folder except for hostingstart.html.
However, when I use the Azure Console, all my files appear in the wwwroot folder and the hostingstart.html file is not there.
I'm not sure if it's relevant but we do have continuous integration setup. I just want to be able to see those files and interact with them.
If I browse into the /LogFiles folder I can confirm that the FTP and Azure Command Line show the same files. So I know I am on the right server.
After much searching I learned what is going on. If you have the WEBSITE_RUN_FROM_PACKAGE setting enabled, your site is served out of a zip file.
The FTP server shows the real folder, whereas the kudu console maps that folder to the contents of the zip file.
This announcement explains it in a lot of detail.
Go to kudu and click "Current Docker logs (Download as zip)"
I deployed a newly created Asp.Net Core web application to an Azure app service using ftp, while enabling delete existing files, directly from VS 2019.
Now whenever I view the content of the wwroot folder using Winscp, the result is as expected and I see the latest output from my local build. But whenever I view the contents of the folder in Kudu, the list of files is outdated/reflects previous local builds outputs (screenshots below from winscp and from kudu in the browser).
What is going on here ?
This is also breaking my app, since my app's initialization code cannot read an xml file that I see in winscp, but is not visible when I navigate to the folder in kudu.
I already tried restarting the app service multiple times, to no avail.
What am I missing ??
wwroot contents from kudu
wwroot contents from winscp (files order alphabetically, the vue middleware should be displayed before web.config)
I have a release in VSTS to deploy my webapp to the azure app service. For this I use a Azure App Service deploy step. After the normal deploy of the webapp I want to add an additional zip artifact from another build result. I want to copy only those file to a specific path of the web application on azure. How can I do that?
If the zip file is the web deploy package, you can refer to Joy’s answer. (Need to check Application option)
Otherwise, the simple way is using Kudu REST API (remain folder structure), steps:
Uncheck Publish using Web Deploy option of Azure App Service Deploy task
(Optional) Add Unzip task to extract zip files to a folder in artifact folder (the folder that you want in app service, e.g. D:/1/a/mylib)
Specify folder (parent folder of step 2 to remain folder structure) or package (zip) in Package or folder input box
You could use Virtual applications and directories to do it.You could check my steps.
Go to azure portal -> APPLICATION -> APPLICATION SETTINGS->Virtual applications and directories
set virtual directory with virtual path : /YourApplication to site\YourApplicationorsite\wwwroot\YourApplication
Go to VSTS-> the release option-> the Deploy Azure App Service task
set virtual application to /myApplication
Hope it can help you.
If using Azure DevOps for your CI then an alternative solution is to zip your file(s) including directory structure from the web root and add them into DevOps as a 'secure file' (find this under library/secure files once you've configured an Azure KeyVault).
Then add a pipeline task to download the secure file (use "Download secure file" task) to your build server. Make sure you add a "Reference name" to this task so you can reference the downloaded file path in a later step.
Then add a stand-alone "Azure App Service Deploy" step to deploy just this zip file. Select deployment method of "Zip deploy" and reference your downloaded secure file in the "Package or folder" section, like $(secureFileReferenceName.secureFilePath).
This effectively downloads the zip file from secure storage to the build agent and unzips it to wwwroot in the App Service.
I successfully created a backup file from my first app service using an Azure feature.
Is it possible to restore the backup file to another app service?
If not, is there a way to download the backup file, upload then extract it to the other app service? Please advise.
Yes, you can restore a backup of a web app to another one. But, you need to do more than just clicking the Restore Now button.
Log into the new Portal, on the Settings blade of your web app, click Backups, choose the backup you want to restore, and copy the file location. It would look like this:
https://<your storage account name>.blob.core.windows.net/<your container>?sv=2015-04-05&sr=c&sig=fieQjleVYxDuXG2Ym8yjPpbdPxHOnbiLo8HcRuxyluw%3D&st=2016-04-05T02%3A35%3A25Z&se=2290-01-18T02%3A35%3A25Z&sp=rwdl
From the above URL, you can format a link to download the backup file, by adding the file name after the container name. Here is a link to the zip file:
https://<your storage account name>.blob.core.windows.net/<your container>/<your web app>.zip?sv=2015-04-05&sr=c&sig=fieQjleVYxDuXG2Ym8yjPpbdPxHOnbiLo8HcRuxyluw%3D&st=2016-04-05T02%3A35%3A25Z&se=2290-01-18T02%3A35%3A25Z&sp=rwdl
Download the files with the above link. You get a zip file. Since you are restoring it to a different web app, you can ignore the xml and the log files.
Unzip the zip file, and you will see a .bacpac file, a meta file, and a "fs" folder. You can ignore the meta file.
You can use Visual Studio or SSMS to restore the .bacpac file to a database linked to your new web app.
For files inside the "fs" folder, you can use a ftp client to upload it to your new web app. Don't forget to change the connection string, before uploading.
In fact, it's quite complicated. If you are just restoring a quite recent version of your web app. I suggest you skip step 6, and use your most favorite deploy method to deploy it to you new web app.
If you just want to clone a web app, you can do it through the new portal. For more information, see Azure App Service App Cloning Using Azure Portal
I have been looking at this article. Part of the article says to place an extra file, applicationHost.xdt (the transform for an Azure Site Extension) in the site directory. The article mentions placing this file there via ftp.
The site directory in an Azure Web Site is the parent of the wwwroot directory that is used as the deployment target by the CI build that is configured when you connect an Azure Web Site to Visual Studio Online.
I would like to add the applicationHost.xdt file to source control and copy the file to the site directory on build. How would I go about modifying the automatically generated visual studio online build to accomplish this?
If you want to automatically deploy files to D:\Home\site, the only way to copy files to the D:\Home\site directory upon deployment would be to create a Custom Deployment Script
Alternatively, you could just copy the file there once and not deploy it again since it'll be a relatively static file.