This article re-edits "Azure App Service deployment using Zip is better than FTP deployment" published on "cloud.config Tech Blog" provided by FIXER.
About the FTP deployment of App Service
App ServiceにはFTPデプロイが提供されており、Azureポータルから[デプロイセンター] > [FTPS資格情報]にアクセスすることで、FTPエンドポイントと認証情報が確認でき、WinSCPなどのクライアントを利用することで、FTP接続ができます。
FTPS qualification information for App Service
また、[構成] > [全般設定] > [FTPの状態]で受け入れる接続の制限ができます。
By default, all licenses can be changed to FTPS only and disabled.
FTP status of the application service
You can use the above steps to FTP to connect and deploy the application, and deploy the application to App Service.
Status of connecting to App Service through WinSCP FTP
Access restrictions cannot be imposed on App Service's FTP
App Service has simple IP restrictions and features and services such as private endpoints that trap App Service in a virtual network, but these features do not restrict access to the source, for example, from the office or deployment server via FTP.
This is why when you access App Service, you usually access staff running applications through a load balancer located in the foreground, but FTP access (and Web deployment in Visual Studio) is not through the foreground, but through a role called publisher Access the file server attached to App Service.
Because of this architecture, FTP deployment of App Service is provided by public IP, and access sources cannot be controlled even with IP restrictions or private endpoints.
Measures to deal with.
FTP is an unencrypted communication protocol and, as mentioned above, does not restrict access to the source.
In addition, FTP deployment has the disadvantage of not being able to control the version of the application.
Automated deployment using Azure DevOps Pipeline and GitHub is imma-style, but due to various limitations, I think there are cases where deployment needs to be done manually.
In this case, you can deploy using Zip.
About Zip deployment
Zip deployment is deployed by creating a project Zip archive and uploading it to App Service's management site (SCM site).
In this case, access to the SCM website can be restricted to the virtual network through IP restrictions or private endpoints, so it is good in terms of security.
In addition, you can automatically delete deleted files and directories compared to your last deployment, so your application's integrity is less likely to be lost compared to FTP.
The deployment method also provides both GUI and API modes. There is only API in the Linux App service.
Actual Zip deployment
Describes the steps for Zip deployment when creating A. NET 5 network application in Visual Studio 2019
Web applications created locally
First, execute the following command in the package manager console, and then publish the application.
The following command is the command for "expand according to frame" in .NET 5.
If your version is different, or if you want to set the deployment mode to self-complete, change the options appropriately.
dotnet publish -c Release -p:UseAppHost=false
Publish the application in Visual Studio
Since you created a set of files in bin\ Release\ net 5.0\ publish in the project, execute the following command and create the Zip archive.
Compress-Archive -Path * -DestinationPath {ファイル名}.zip
Create a Zip archive in PowerShell
AzureポータルからApp Serviceの[高度なツール] > [移動]を押下し、SCMサイトに移動します。
App Service's SCM website
Add "/ ZipDeployUI" to the end of the URL of the SCM Web site, and then go to the Zip deployment page.
The Zip deployment page of the SCM website
Drag and drop the Zip file you just created from Explorer and wait for the deployment to complete.
Deploy Zip in a browser
If the deployment progress is shown at the bottom of the page, and "Deployment successful." is displayed at the end, the deployment is successful.
Progress of deployment
When you access App Service, the application is deployed.
App Service after deployment
Last
I think it is rare to use FTP deployment in App Service, but if you are using it, it is best to consider switching to Zip deployment.
In addition, set the FTP status of App Service to disabled.
Kanda Jen / FIXER
We are building the infrastructure using the Azure to which cloud.config Division belongs. It would be nice if you could introduce the experience of building and the efficient methods of using Terraform.
[reprint source] in Azure App Service, deploy using Zip through FTP deployment
Related websites.