Collect data from IIS logs
IIS logs are collected only for a web role because worker and VM roles don't run under IIS.
To enable IIS logging add the following code to the web.config.
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure, Module, Page, AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server"
areas="Authentication, Security, Filter, StaticFile, CGI, Compression, Cache, RequestNotifications, Module"
verbosity="Verbose" />
</traceAreas>
<failureDefinitions statusCodes="400-599" />
</add>
</traceFailedRequests>
</tracing>
After adding this code IIS logs are automatically logged. No additional API calls are required.