Deploy Ruby App to Azure Web Apps

Hello friends.

I was trying to deploy a Ruby application to Azure Web Apps now that it supports running Ruby (2.3) application stack natively on Linux with the Azure Web App on Linux (In Preview at the time of writing this post).  And I thought I’d share the steps I took and the issues I stumbled on during.

Although you were previously able to run Ruby on Rails Web applications on an Azure VM, running a Ruby Application on Web Apps brings a lot of PaaS benefits .

I have a local machine operated by Windows 10 (creators update) so to get started I needed to run the Ruby on rails application locally before deploying it to an Azure Web App. As a prerequisite, make sure Ruby 2.3.3 or higher is installed on your development machine along with Git as I will use it to deploy to Azure. RubyInstaller is a great project to help you install Ruby and it gives you everything you need to set up a full Ruby development environment on Windows.

To start, I created a new basic ruby on rails application locally with the following commands

//create a directory for the new app to work with and navigate to that directory. As you can see in the below screenshot first I navigated to another directory where I wanted to create my application

mkdir test
cd test

Next, we need to Initialize Ruby and check the version using the following command

ruby -v

and then install rails using the gem install rails command.

Here is where I faced the first issue as you can see in the screenshot below, I had an error “Error installing rails, native gem requires build tools”, so I went and downloaded the Ruby Development Kit to resolve this.


Next, I created a rails application called hello-world using the following command:

rails new hello-world --skip-yarn

hello-world create rails

Afterward, navigate to the newly created to the hello-world directory, and start the server with the following command:

cd hello-world
rails server

Now you can browse the newly created rails web application locally on your browser by navigating to http://localhost:3000.

But here is where I faced the 2nd issue as when I browsed the application I got the error:

AbstractController::Helpers::MissingHelperError (Missing helper file helpers/d:/ code/test/hello_world/app/helpers/application_helper.rb_helper.rb):

The commands I’ve been passing were on Git Bash, so I tried starting the rails server on a Windows command prompt and it worked.

But when I wanted to start the rails server from a Windows command prompt it mentioned that “A server is already running. Check d:/Code/test/hello-world/tmp/pids/

So I went to that file and deleted it and then ran the command rails server again and this time it launched successfully.

rails server error

Now that the app is running locally, I needed to make an extra step before proceeding to deploy it to Azure. We need to configure a default route before we deploy to Azure otherwise we will receive a 404 error when browsing the site. Since this is a basic “Hello World” rails app, there’s no Route in routes.rb. For now, we’ll to add the default route in the routes.rb file found in the config folder. Just add the following line there

root 'application#hello'

The above line routes the app to the application controller and the action hello. This is because when controllers are generated in Rails they are empty by default unless you tell it your desired actions during the generation process.

To manually define an action inside a controller, all you need to do is to define a new method inside the controller. So navigate and open the application controller file in app/controllers/application_controller.rb and inside the ApplicationController class, define the hello method so that your controller now looks like this:

class ApplicationController < ActionController::Base
   protect_from_forgery with: :exception
           def hello
               render html: “Hello again world, from Azure Web Apps!”

So when you refresh the local URL <http://localhost:3000>, the rails application will display a plain HTML page that has the above line “Hello again world, from Azure Web Apps”

Now we can begin the deployment stage. First, we need to create a Ruby web app on Azure which is straightforward and easy.

On your Azure portal navigate to Add a Web App on Linux and complete the actions in the Create Blades as the following screenshots show:Create Web App on Linux

The Create blade

  • Give the web app a unique name.
  • Choose an existing resource group or create a new one
  • Choose an existing Azure App Service plan or create a new one
  • Choose the Ruby 2.3 built-in runtime stack for your container configuration (only one available at the time of writing
  • Hit OK

In no time, the web app is created, and you can see the Overview blade displayed. Feel free to browse the URL of the web it should take you to the default Hosting Start page

Next, the deployment.
I used Git to deploy the local Rails application to Azure. Go to Deployment options in the Azure Web App menu under Deployment, choose source and select Local Git Repository. This will set up deployment source for your web app and populate the Git clone url value in the overview blade as the below screenshots show


git clone url

Now that we have the Git deployment URL, mine was <>, we will need to get the deployment credentials (basically an ftp user) which will be used to authenticate against when the repo is pushed to Azure, so if you don’t have these yet create one. On the portal, when on the web app blade, just navigate to Deployment Credentials under Deployment from the left menu and set the username and password.

Finally, we can run the followings git commands to publish the local application to the Azure web app (Assuming you are in the root directory of your local app, hello-world in our case):

//if git is not initialized yet, run the git init command first
git remote add azureweb
git add -A
git commit -m "initial upload ruby on rails"
git push azureweb master

In the push command, I used “azureweb” as I created a reference named ‘azureweb’ for the web app’s repository in the first command. this should prompt the

After running these commands, the Git Credential Manager for Windows should prompt you for the username and password that are in your ftp settings within the deployment credentials.

git deploy authenticate

And that’s it. At the end, you should get from remote that the operation “Finished successfully” and that the “Deployment successful” To

Browse to the URL of your web app and you should see that Ruby on Rails application is now running on Azure.

ruby running on azure

Happy Coding!

PS: I am not a Ruby expert, I was trying it out to check the new Web Apps on Linux feature so please feel free to share your feedback if I might have had any inaccurate info above.


Posted in Microsoft Azure Tagged with: ,

How to setup Application Insights for WordPress sites

Hello friends!

I just wrapped up connecting my blog over here which is a WordPress site to Application Insights on Microsoft Azure. I thought I’d share with you how it’s done.

First, a brief into about Application Insights for those who don’t know what it is. In short, Visual Studio Application Insights (previously Application Insights) is a cloud-based service from Microsoft Azure that allows you to analyze performance and usage of your web apps hosted on Azure or on your own IIS or J2EE servers. Some of the features are:

  • Detect and diagnose issues, monitor load and discover usage patterns
  • Easily diagnose exceptions and web app performance issues
  • Perform root cause analysis with ad-hoc queries and full-text search
  • Integrate with DevOps processes using Visual Studio Team Services
  • Monitor web apps hosted on Azure, other cloud services, or on-premises servers

It’s very easy to set it up, you install a small instrumentation package in your application, and set up an Application Insights resource in the Microsoft Azure portal. The instrumentation monitors your app and sends telemetry data to the portal. The portal shows you statistical charts and provides powerful search tools to help you diagnose any problems.

From the Plugin Directory at you will find the Application Insights plugin.

This Plugin basically integrates a WordPress site with Microsoft Application Insights. The plugin uses the Application Insights PHP SDK to send site data to Azure. The installation part is straightforward in the following 3 steps:

  1. Upload all files to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. On your WordPress site, go to Settings -> Application Insights and enter the Instrumentation Key you received from (Application Insights -> [App Insights Name] – Properties)
  4. Start monitoring the stats in the Azure portal!

Application Insights gathers a huge amount of interesting statistics and data, some of which is similar to what tools like Google Analytics provide and some are even more granular and helpful to web developers. The features of the service also include Performance and availability testing and a favorite of mine called Application Map which is a visual layout of the dependency relationships of your application components. Each component shows KPIs such as load, performance, failures, and alerts, to help you discover any component causing a performance issue or failure.

Happy monitoring 🙂


Posted in Microsoft Azure

A whole lotta free stuff with Visual Studio Dev Essentials

Visual Studio Dev Essentials

I recently created a new Visual Studio account to share some code and collaborate with friends. Low and behold, I received an email to activate my “Visual Studio Dev Essentials membership” which include a good and long list of benefits and free stuff! Some of which are:

  • Visual Studio Tools and Services
  • $25/month of Azure Cloud credits for 1 year
  • Xamarin University Training
  • 6-month subscription to Pluralsight
  • SQL Server 2014 Developer Edition
  • Microsoft R Server Developer Edition (Allows you to build advanced Analytics solutions in R on Windows, Hadoop, Terradata and Linux)
  • Application Insights – Free plan
  • Hockey App – Free plan

Great stuff in there, at least for the small and demo projects am working on. I guess any developer would benefit from these  and I thought I’d share.

If you want to have a look and get access to this program, it’s as simple as signing up with your name and email over here:

Once you’ve signed up, you will be able to access your account from here and start activating those benefits.


Posted in Uncategorized Tagged with: ,

Replacing your Parse hosted mobile backend

Hello developers!

As you might have heard, Facebook is shutting down their mobile app development platform Parse which stirred some mixed emotions among developers out there. Parse was indeed a great a toolkit for creating and running mobile apps. Developers used Parse hosting as the backend for their mobile apps between push notifications, storage and analytics.

If you are looking for a replacement to that backend, a rather good one, you might want to try out Azure App Service For FREE!. App Service is a powerful cloud platform that allows developers to build intelligent web and mobile apps that connect to data anywhere, in the cloud or on-premises. For mobile apps, it makes it easy to add authentication, push notification, and data sync to iOS, Android, or Windows app, in addition to auto scale capability.

To help you with that migration, Microsoft released a comprehensive guide with step by step instructions for how to migrate a Parse application to Azure App Service. You can check it on the following link:

Happy coding 🙂

Posted in Microsoft Azure

Multi-User Access in Windows Dev Center

Hello Developers!

Earlier this month, Microsoft released an update to the Dev Center that includes several new capabilities and improvements. With this release comes one of the most requested features:  “Multi-user access” and…… wait for it….. with roles!!!

This feature is perfect for scenarios like having a project outsourced and solution provider has to submit a package/publish the app and you don’t want to end up giving that provider your credentials and change these later. Now you can add multiple dev users into one account.

In summary, Multi-user access with roles feature includes support for multiple users in a single account, with permissions controlled through user roles. It enables a greater account management flexibility with different permissions through managed roles. Here is a screenshot that shows the different roles available:

The roles will allow you to choose the users that can manage and submit packages, restrict access to account financial information. Even more, you can allow only select users to be able to respond to reviews,  among other features.

This new capability requires an Azure Active Directory (Azure AD) account with admin permissions to create and manage accounts.

Additiontally, the update included the following features and improvements:

  • Windows Store APIs: validate apps or in-app product acquisitions, useful for cross-platform services, or to add another layer of validation for customer purchases
  • In-app purchase discounts: schedule IAP price discounts for apps running on Windows 10
  • Access to Office and Azure programs: access the Office and Azure developer programs at no extra cost through the Dev Center registration
  • More effective Store lists: The Store is updating the algorithms for the “New and Rising” and “Best Rated” lists to be able to show more apps than before
  • Update to the Windows App Certification Kit: with additional validation tests for UWP app submissions. You can now download and install the latest version of the WACK to validate your UWP submissions.

These are great additions to the Windows Dev Center and will light up the experience for developers and app owners!


Posted in Windows Development
Skip to toolbar