Managing a Drupal website can be time-consuming, especially when it comes to updates, backups, and deployments. This is where Drush comes in. Drush is a command-line interface (CLI) tool for Drupal that makes managing your Drupal website faster and easier.
In this blog post, we will take a closer look at how to install Drush along with Drupal in Azure App Service.
If you wanted to know how to migrate an existing Drupal site to Azure App Service please refer Easy way to migrate an existing PHP site with MySQL to Azure App Service. - Microsoft Community Hub.
Please use following steps in order to install Drush on Azure App Service:
Go to your KUDU console http://<yoursitename>.scm.azurewebsites.net/newui (replace "yoursitename" with your actual Web App name) through the browser or you can search Advanced Tools & click on Go button as shown below from Azure portal:
Select WebSSH on the Kudu page to enter into the app container.
Create a directory called ext inside your /home/site folder & download composer.phar by running the following commands:
curl -sS https://getcomposer.org/installer | php
Add the composer into /usr/local/bin/composer to access composer globally and install Drush using command under /home/site/wwwroot directory:
cp /home/site/ext/composer.phar /usr/local/bin/composer
composer require --dev drush/drush
Create the startup.sh file under /home/site folder and add the following script.
cp /home/site/ext/composer.phar /usr/local/bin/composer &&
echo 'export PATH="/home/site/wwwroot/vendor/bin:$PATH"' >> ~/.bashrc &&
Now provide the startup.sh file in App Service Application by selecting Configuration blade & then selecting General Settings and adding following command (/home/site/startup.sh) under Startup Command as shown below:
After restarting the Azure App Service, you can access Drush in Kudu console & all changes made to application inside /home directory will persist.