Ftp Visual Studio Code



In VS Code, select Remote-SSH: Connect to Host. From the Command Palette ( F1) and use the same user@hostname as in step 1. If VS Code cannot automatically detect the type of server you are connecting to, you will be asked to select the type manually. Visual Studio Code includes multiple extensions for FTP, allowing the software to be used as a free alternative for web development. Code can be synced between the editor and the server, without downloading any extra software.

-->

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.

Note

The Development Center (Classic) page in the Azure portal, which is the old deployment experience, will be deprecated in March, 2021. This change will not affect any existing deployment settings in your app, and you can continue to manage app deployment in the Deployment Center page.

Get deployment credentials

  1. Follow the instructions at Configure deployment credentials for Azure App Service to copy the application-scope credentials or set the user-scope credentials. You can connect to the FTP/S endpoint of your app using either credentials.

  2. Craft the FTP username in the following format, depending on your choice of credential scope:

    Application-scopeUser-scope
    <app-name>$<app-name><app-name><deployment-user>

    In App Service, the FTP/S endpoint is shared among apps. Because the user-scope credentials aren't linked to a specific resource, you need to prepend the user-scope username with the app name as shown above.

Get FTP/S endpoint

Ftp Visual Studio Code

In the same management page for your app where you copied the deployment credentials (Deployment Center > FTP Credentials), copy the FTPS endpoint.

Run the az webapp deployment list-publishing-profiles command. The following example uses a JMES path to extract the FTP/S endpoints from the output.

Each app has two FTP/S endpoints, one is read-write, while the other is read-only (profileName contains ReadOnly) and is for data recovery scenarios. To deploy files with FTP, copy the URL of the read-write endpoint.

Run the Get-AzWebAppPublishingProfile command. The following example extracts the FTP/S endpoint from the XML output.

Deploy files to Azure

  1. From your FTP client (for example, Visual Studio, Cyberduck, or WinSCP), use the connection information you gathered to connect to your app.
  2. Copy your files and their respective directory structure to the /site/wwwroot directory in Azure (or the /site/wwwroot/App_Data/Jobs/ directory for WebJobs).
  3. Browse to your app's URL to verify the app is running properly.

Note

Unlike Git-based deployments and Zip deployment, FTP deployment doesn't support build automation, such as:

  • dependency restores (such as NuGet, NPM, PIP, and Composer automations)
  • compilation of .NET binaries
  • generation of web.config (here is a Node.js example)

Generate these necessary files manually on your local machine, and then deploy them together with your app.

Enforce FTPS

For enhanced security, you should allow FTP over TLS/SSL only. You can also disable both FTP and FTPS if you don't use FTP deployment.

  1. In your app's resource page in Azure portal, select Configuration > General settings from the left navigation.

  2. To disable unencrypted FTP, select FTPS Only in FTP state. To disable both FTP and FTPS entirely, select Disabled. When finished, click Save. If using FTPS Only, you must enforce TLS 1.2 or higher by navigating to the TLS/SSL settings blade of your web app. TLS 1.0 and 1.1 are not supported with FTPS Only.

Run the az webapp config set command with the --ftps-state argument.

Possible values for --ftps-state are AllAllowed (FTP and FTPS enabled), Disabled (FTP and FTPs disabled), and FtpsOnly (FTPS only).

Studio

Run the Set-AzWebApp command with the -FtpsState parameter.

Possible values for --ftps-state are AllAllowed (FTP and FTPS enabled), Disabled (FTP and FTPs disabled), and FtpsOnly (FTPS only).

What happens to my app during deployment?

Visual studio code ftp workspace

All the officially supported deployment methods make changes to the files in the /home/site/wwwroot folder of your app. These files are used to run your app. Therefore, the deployment can fail because of locked files. The app may also behave unpredictably during deployment, because not all the files updated at the same time. This is undesirable for a customer-facing app. There are a few different ways to avoid these issues:

  • Run your app from the ZIP package directly without unpacking it.
  • Stop your app or enable offline mode for your app during deployment. For more information, see Deal with locked files during deployment.
  • Deploy to a staging slot with auto swap enabled.

Ssh Visual Studio Code

Troubleshoot FTP deployment

Configure Ftp Visual Studio Code

How can I troubleshoot FTP deployment?

The first step for troubleshooting FTP deployment is isolating a deployment issue from a runtime application issue.

A deployment issue typically results in no files or wrong files deployed to your app. You can troubleshoot by investigating your FTP deployment or selecting an alternate deployment path (such as source control).

A runtime application issue typically results in the right set of files deployed to your app but incorrect app behavior. You can troubleshoot by focusing on code behavior at runtime and investigating specific failure paths.

To determine a deployment or runtime issue, see Deployment vs. runtime issues.

I'm not able to FTP and publish my code. How can I resolve the issue?

Check that you've entered the correct hostname and credentials. Check also that the following FTP ports on your machine are not blocked by a firewall:

  • FTP control connection port: 21, 990
  • FTP data connection port: 989, 10001-10300

How can I connect to FTP in Azure App Service via passive mode?

Azure App Service supports connecting via both Active and Passive mode. Passive mode is preferred because your deployment machines are usually behind a firewall (in the operating system or as part of a home or business network). See an example from the WinSCP documentation.

More resources

  • Sample: Create a web app and deploy files with FTP (Azure CLI).
  • Sample: Upload files to a web app using FTP (PowerShell).