I recently got a request to install a PHP extension in an Azure Web Service running PHP 7.1, Cake PHP and MySQL. The extension to install was Imagick 3.4.3 x64, which is used for all kinds of image manipulation. The marketplace extension Composer was installed already.
Since Azure Web Service is a managed service, installing non-marketplace extensions is not as straight forward as on a managed machine running Windows or Linux. But even though the required steps are not officially documented, there are some resources available on the issue. I used the following manual.

After doing all the copying steps (including an applicationHost.xdt) and adding the application settings using the Azure Portal

AppSettings

I got an Internal Server Error when trying to access any page in this web app. Removing the PHP_EXTENSIONS setting resolved the issue, but Imagick obviously was not working and not showing up in phpinfo().

The detailed error logs provided by Kudu listed a top level error

HTTP Error 500.0 – Internal Server Error
D:\Program Files\PHP\v7.1\php-cgi.exe – The FastCGI process exited unexpectedly

Error500

and an underlying error of

HTTP Error 401.0 – Unauthorized
D:\Program Files\PHP\v7.1\php-cgi.exe – The FastCGI process exited unexpectedly.

Error401

Those rather generic and therefore unhelpful error messages did not help with finding the underlying cause of the issue.

After verifying that I used the correct dlls and also trying the path of the Microsoft documentation nothing had changed. Following this documentation I used an .ini file which only added the extension setting as well. Therefore it was not surprising that nothing had changed. Phpinfo() provided no help either, since it wouldn’t run with the extension pointing to the dll and couldn’t show anything after removing it.

In the end (after consulting the Microsoft Azure Support) we discovered that the Composer extension, too had its own applicationHost.xdt which took precendent over the one I added following the documentation(s). Composer has its applicationHost.xdt located in d:\SiteExtensions\ComposerExtension\ and I added mine to d:\home\site as described in the documentations. Since my added xdt just added a path to %PATH% I solved it simply by adding the added path to the existing applicationHost.xdt that Composer added, resulting in phpinfo showing me the correct imagick entry with all relevant details.

Imagick