How to copy a file from azure web app to local

Huhn, Alexander 105 Reputation points
2023-04-20T17:17:03.19+00:00

I have a running Azure web app and SSH into it while it is running: User's image

I can see some files that are generated within the web app. Is there a way to copy if from the azure web app folder to my local? How can this be done?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Grmacjon-MSFT 19,151 Reputation points Moderator
    2023-04-21T04:11:39.1533333+00:00

    Hi @Huhn, Alexander yes, this is possible.

    Option 1: Use FTP

    1. Open the Azure portal and navigate to your web app.
    2. Click on "Deployment Center" in the left-hand menu.
    3. Under "Deployment Center," click on "FTP / FTPS."
    4. Note the FTP hostname, username, and password. You'll need these to connect to the web app using an FTP client.
    5. Use an FTP client (such as FileZilla or WinSCP) to connect to the web app using the FTP hostname, username, and password.
    6. Navigate to the folder containing the file you want to copy.
    7. Drag the file from the web app folder to your local machine.

    Option 2: Azure CLI

    1. Open a terminal or command prompt on your local machine.
    2. Install the Azure CLI if you haven't already done so.
    3. Log in to your Azure account using the Azure CLI by running the command az login.
    4. Once you are logged in, navigate to the directory where you want to copy the files to on your local machine.
    5. Use the Azure CLI to copy the files from the Azure Web App to your local machine. The command to do this is az webapp log download --resource-group <resource-group-name> --name <web-app-name> --log-file <path-to-log-file>. Replace <resource-group-name> with the name of the resource group that contains the Azure Web App, <web-app-name> with the name of the Azure Web App, and <path-to-log-file> with the path to the file you want to copy. For example, if you want to copy a file named example.txt from the site/wwwroot directory of an Azure Web App named mywebapp in a resource group named myresourcegroup, you would run the command az webapp log download --resource-group myresourcegroup --name mywebapp --log-file site/wwwroot/example.txt.

    This will download the file from the Azure Web App to your local machine. You can then open the file using a text editor or other application as needed.

    Note that this method only works for files that are generated within the Azure Web App. If you need to copy files that are part of the application code or other files that are not generated within the Azure Web App, you will need to use a different method, such as deploying the files to a source control repository and then cloning the repository to your local machine.

    Hope that helps

    Best, Grace


  2. Constantine Ketskalo 0 Reputation points
    2025-02-15T02:36:31.6133333+00:00

    Finally I've found out the answer for myself and can share it as well.

    Seems like there's a structure of files and folders like this:

    root@abc1234/
    ├─ home/
    │  ├─ site/
    │  │  ├─ wwwroot/
    ├─ [some other files and folders...]
    ├─ tmp/
    │  ├─ zxc0987/
    │  │  ├─ [all the website files here...]
    

    So that's not intuitive but here's what I've found out:

    You can access only folder root@abc1234/home from FileZilla and everything inside it. Actual website files I've found in the folder root@abc1234/tmp/zxc0987 and that's the folder where ssh console opens at start.

    So I didn't test it so far yet. But hypothetically we should be able to copy files from the PROD website that we need to one of folders that are available via ftp and then we'll be able to download them.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.