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

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>.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:

 

vinku85_0-1679476713418.png

 

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 https://getcomposer.org/installer | php

 

 

 

vinku85_1-1679476713428.png

 

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

 

 

 

vinku85_2-1679476713447.png

 

Step 4:

Create the startup.sh file under /home/site folder and add the following script.

 

 

#!/bin/bash
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 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:

 

vinku85_3-1679476713472.png

 

After restarting the Azure App Service, you can access Drush in Kudu console & all changes made to application inside /home directory will persist.

 

vinku85_4-1679476713495.png

 

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