Scope

This article explains how to see the Web.Config file on a published Azure Mobile Services site.

Introduction

In Azure Mobile Services it is possible to have different environments, for example an application will often require both “Dev” and “Prod” environments to allow separation between development and live. Numerous separate environments can be maintained using conditional directives and transform files as described in the article Azure Mobile Services: How to creating a Dev and Prod environments:

Transform filesFigure 1: Transform Files

During deployment, the Web.Config is transformed based on build configuration, as seen in Figure 2:

PublishingFigure 2: Publishing

The Azure Portal allows creation of Azure Mobile Services, monitoring, configure and it is possible to see the logs.  The Web.Config file is of course quite important and you cannot easily view this. This article explains how you can.

Description

Kudu is the engine behind Git deployments in Azure Web Sites, and Azure Mobile Services is not more than an extension of ASP.Net WebApi, this way the deployment used in both is the same.

The Kudu project is available in GitHub in this reference github.com/projectkudu/kudu which wiki has all documentation about it. For each Azure Mobile Service is possible to access its Kudu using something like https://<Azure Mobile Service Base Url>.scm.azure-mobile.net and the Azure Portal credentials.

Let’s use the Menu App Sample, where the Azure Mobile Service is defined in https://mymenuapp.azure-mobile.net/ to access the Kudu page we need to use  https://mymenuapp.scm.azure-mobile.net.  We then see something like Figure 3:

Kudu Main Page
Figure 3: Kudu main page

To see the Web.Config we need to click in “Debug Console” and  choose one of the options - let’s choose “PowerShell” as below:

Selecting PowerShellFigure 4: Selecting PowerShell

The following page will be showed:
PowerShell pageFigure 5: PowerShell page

In console do “cd site” and “cd wwwroot” as following in Figure 6:

Navigate to wwwrootFigure 6: Navigate to wwwroot

At the end, we see the following table

Now it is possible to download, edit or delete the WebConfig file, using the options in the left. If we click in edit we will have something like:

WebConfig FileFigure 7: WebConfig File

Conclusion

In conclusion, we can conclude to get the Web.Config in Azure Mobile Service server is very simple and in some cases can be useful, but a developer should carefully consider any changes as they are likely to impact production.

hit counter