Azure Mobile Services: How to See the WebConfig File Published

Scope

The purpose of this article is to show how to see the WebConfig file published in Azure Mobile Services.

Introduction

In Azure Mobile Services it is possible to have different environments, for example an application can require the “Dev” and “Prod” environments to allow multiple versions. To support many environments the tips are to use conditional directives and transform files, like as is described in the article Azure Mobile Services: How to creating a Dev and Prod environments.

Transform files
                  Figure 1 Transform files

In the deployment, based in the build configuration the WebConfig is transformed, like we can see in Figure 2:

Publishing
                                                                     Figure 2 Publishing

The Azure Portal allows the creation of Azure Mobile Services, monitoring, configuring and it is possible to see the logs. For some reason however we need to see the WebConfig in the server, where is it? In this article we will see how to see it.

Description

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

The Kudu project is available in GitHub at this reference and the wiki contains all the documentation about it. For each website it 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 Kudo page we need to use https://mymenuapp.scm.azure-mobile.net and we will get something like in Figure 3:

Kudu main page
                              Figure 3 Kudu main page

To see the WebConfig we need to click in “Debug Console” and then we need to choose one of the options, let's choose “PowerShell” as in the following:

      PowerShell
      Figure 4 Selection PowerShell

The following page will be shown:

PowerShell page
                                                           Figure 5 PowerShell

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

Navigate to wwwroot
                                                   Figure 6 Navigate to wwwroot

At the end we will see the following table:

The wwwroot folder
                                                Figure 7 The wwwroot folder

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:

The WebConfig content
                                                      Figure 8 The WebConfig content

Conclusion

In conclusion, we can conclude that to get the WebConfig in an Azure Mobile Service server it is very simple and in some cases can be useful, but each developer should understand that the changes made has impact in production.