Azure App Service On Linux Copy Files From Container That Does Not Use Websites_enable_app_service_storage
- 04 Feb 2019
If you need to move files from a container and you are not using WEBSITES_ENABLE_APP_SERVICE_STORAGE, you will notice you cannot see the files when you SSH into the Kudu container. In order to get these files into Kudu to easily transfer them you can use the linux tool ‘ncftp’.
Steps
In this example we will get the entire wwwroot directory. SSH into the container and install ncftp and zip as follows:
i. SSH into the Docker container and run the following to get into the correct directory and install zip and ncftp
cd /home/site/wwwroot
apk update
apk add zip
apk add ncftp
zip -r wwwroot.zip . (don’t forget the trailing “.”).
ii. In the Azure Portal, go to the Overview blade for the app and press “Get publish profile”
iii. Find the username and password as well as the ftp site in that publish profile. Make sure you add the username in a single quote when connecting using ncftp as shown below.
ncftp -u ‘jefflinuxtest$jefflinuxtest’ ftp://waws-prod-bay-081.ftp.azurewebsites.windows.net site
iv. Enter your password then perform the following.
cd site/wwwroot
put wwwroot.zip.
v. Sample output provided below.
c6b6f3bd43fd:/home/site/wwwroot# ncftp -u ‘jefflinuxtest$jefflinuxtest’ ftp
://waws-prod-bay-081.ftp.azurewebsites.windows.net site
NcFTP 3.2.6 (Dec 04, 2016) by Mike Gleason (http://www.NcFTP.com/contact/).
Connecting to 40.118.171.137…
Microsoft FTP Service
Logging in…
Password requested by 40.118.171.137 for user “jefflinuxtest$jefflinuxtest”.
Password required
Password: ********************
User logged in.
Logged in to waws-prod-bay-081.ftp.azurewebsites.windows.net.
Current remote directory is /.
ncftp / > cd site/wwwroot
ncftp /site/wwwroot > put wwwroot.zip
wwwroot.zip: 47.61 MB 42.56 MB/s
ncftp /site > exit
Thank you for using NcFTP Client.
If you find it useful, please consider making a donation!
http://www.ncftp.com/ncftp/donate.html
vi. Check that /home/site contains the wwwroot.zip file using KUDU/Bash.
vii. Now simply use the vfs feature of kudu to download the files! https://github.com/projectkudu/kudu/wiki/REST-API In this example go to https://jsanderscontainerl.scm.azurewebsites.net/api/vfs/site/wwwroot/wwwroot.zip in a browser and you can download the file!
<< Go Back