Azure WebApp Extension to Log API Calls

Introduction

The Moesif Azure Web App Extension is an agent that will log any incoming API requests into your Web App. This extension can be used in lieu of the standard SDK integrations if you are using Azure WebApps.

How to Install

1. Add Moesif Extension

Install the extension within the Azure Portal by selecting your webapp and then the Extensions subpanel.

You can then select add+ and scroll down to Moesif REST API Insights

Azure Portal Add Extension

Click Add button at the top, find the Moesif Extension, and click install.

2. Set Application Id

Goto your Azure Application Settings subpanel. Add a new key/value with the name MOESIF_APPLICATION_ID. You can find your Application Id from Moesif Dashboard -> Top Right Menu -> Extensions Setup -> Azure WebApp Extension

MOESIF_APPLICATION_ID: my_application_id

Azure Portal Add Extension

Configuration options

The extension supports a few additional app settings.

Setting Name Required Description Example
MOESIF_APPLICATION_ID true Your Application Id from Moesif’s Settings to authorize this app with Moesif my_application_id
MOESIF_DISABLED false Disables Moesif Logging true
MOESIF_SESSION_TOKEN_HEADER false The Header Key you use internally for customer’s access token/session token X-My-Session-Token
MOESIF_DEBUG false Prints debug messages to standard output. (Useful for debugging integration issues) true

These settings can be set as an app setting in your web.config or as an environment variable.

Checkout: https://[MY_SITE].scm.azurewebsites.net/MoesifDebugger for more info on extension configuration where [MY_SITE] is your Azure App service name found in the Azure Portal.

Troubleshooting

Sometimes certain files may be locked while installing the extension. If you are experiencing errors accessing your site after installing the extension or no data is showing up in Moesif, try the following two things:

  1. Disable all Azure extensions and then re-enable them. This can be done by setting WEBSITE_PRIVATE_EXTENSIONS to 0 in Microsoft Azure Application Settings. Then enable them again by setting WEBSITE_PRIVATE_EXTENSIONS back to 1 (or delete the setting).

  2. Stop the web app, wait a few seconds, and then start the web app.

If you’re still having trouble, you can set MOESIF_DEBUG to true to print debug log messages, or contact us

Updated: