Steps to install Drush on Azure App Service.
Published Mar 28 2023 01:59 AM 3,072 Views

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:


Step 1:

Go to your KUDU console http://<yoursitename> (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:




Step 2:
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: 




mkdir /home/site/ext
cd site/ext/
curl -sS | php






Step 3:

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
cd /home/site/wwwroot/
composer require --dev drush/drush






Step 4:

Create the 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 &&
sh ~/.bashrc




Step 5:
Now provide the file in App Service Application by selecting Configuration blade & then selecting General Settings and adding following command (/home/site/ 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.




Version history
Last update:
‎Mar 28 2023 01:58 AM
Updated by: