Blog Post

Apps on Azure Blog
2 MIN READ

Steps to install Drush on Azure App Service.

vinku85's avatar
vinku85
Icon for Microsoft rankMicrosoft
Mar 28, 2023

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:

 

 

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

 

 

 

 

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

 

 

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

 

 

Updated Mar 28, 2023
Version 1.0
No CommentsBe the first to comment