<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Unleashed</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/kaushal/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/kaushal/feed.xml</link>
    <description />
    <lastBuildDate>Mon, 30 Apr 2018 18:44:37 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>HTML Table with horizontal &amp; vertical scrolling</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/html-table-with-horizontal-vertical-scrolling</link>
      <pubDate>Tue, 13 Jun 2017 19:38:22 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=931</guid>
      <description><![CDATA[I blog very frequently and sometimes the posts contain code snippets. The site template sometimes...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: 10pt;font-family: segoe ui">I blog very frequently and sometimes the posts contain code snippets. The site template sometimes limits the available real-estate and this can cause certain issues. If there is long text in one line, then they are stripped and will not be visible.<br></span></p> <p><span style="font-size: 10pt;font-family: segoe ui">The solution to this is to:<br></span></p> <ul> <li><span style="font-size: 10pt;font-family: segoe ui">Use a template which provides more real-estate.<br><strong>OR</strong></span>  <li><span style="font-size: 10pt;font-family: segoe ui">Use a scrollable HTML table.</span></li></ul> <p><span style="font-size: 10pt;font-family: segoe ui">If you chose the second option of a scrollable HTML table, below is a sample code-snippet that you can use to achieve this. The below snippet provides horizontal scrolling only. You can modify the same to achieve vertical scrolling<br></span></p> <blockquote> <script src="https://gist.github.com/anonymous/91aa562dbb28311f66122f89a3e088a0.js"></script> </blockquote> <p>&nbsp;</p> <p><span style="font-size: 10pt;font-family: segoe ui">This is how it looks in different browsers:</span></p> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image360.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb342.png" width="645" height="531"></a><span style="font-size: 10pt;font-family: segoe ui"><br></span></p></blockquote><span style="font-size: 10pt;font-family: segoe ui"> <p>&nbsp;</p></span>]]></content:encoded>
    </item>
    <item>
      <title>Azure App Service: Understanding TLS Mutual Authentication with Web App</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/azure-app-service-understanding-tls-mutual-authentication-with-web-app</link>
      <pubDate>Mon, 12 Jun 2017 14:22:51 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1936</guid>
      <description><![CDATA[I have published 2 posts in the past on Client Certificate authentication.  Client Certificate...]]></description>
      <content:encoded><![CDATA[<p><font size="2">I have published 2 posts in the past on Client Certificate authentication. </font></p> <li><a title="https://blogs.msdn.microsoft.com/kaushal/2015/05/27/client-certificate-authentication-part-1/" href="https://blogs.msdn.microsoft.com/kaushal/2015/05/27/client-certificate-authentication-part-1/"><font size="2">Client Certificate Authentication (Part 1)</font></a>  <li><a title="https://blogs.msdn.microsoft.com/kaushal/2017/06/09/client-certificate-authentication-part-2/" href="https://blogs.msdn.microsoft.com/kaushal/2017/06/09/client-certificate-authentication-part-2/"><font size="2">Client Certificate Authentication (Part 2)</font></a>  <p>In order to enable <strong>Client Certificate </strong>authentication on azure web app, we need to flip the <code>clientCertEnabled</code> property to <code>true</code>. Please refer the following article on how to enable TLS mutual auth for an Azure Web App:</p> <p><a title="https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-configure-tls-mutual-auth" href="https://docs.microsoft.com/en-us/azure/app-service-web/app-service-web-configure-tls-mutual-auth">How To Configure TLS Mutual Authentication for Web App</a>&nbsp;</p> <h2><font size="5" face="Segoe UI"><u>HOW IT WORKS</u></font></h2> <p><font size="2">The best way to understand this is to capture a network trace by issuing a <strong><font style="background-color: #333333" color="#00ff00">HTTPS</font></strong> request to the <strong>Azure Web app</strong>. You will notice that the <strong>certificate request</strong> is not part of the <strong>Server Hello</strong>. This is because the server supports <strong>Secure Renegotiation</strong> and it tends to send this as a part of the <strong>Encrypted Handshake Message</strong> to the client. Refer my earlier post </font><a title="https://blogs.msdn.microsoft.com/kaushal/2017/06/09/client-certificate-authentication-part-2/" href="https://blogs.msdn.microsoft.com/kaushal/2017/06/09/client-certificate-authentication-part-2/"><font size="2">here</font></a><font size="2">. <br>To demonstrate this, I have enabled client certificate Authentication on one of the staging slots of my web app. Here is the link: </font><a href="https://clientcertauth-demo.azurewebsites.net"><font size="2">https://clientcertauth-demo.azurewebsites.net</font></a><br><font size="2">I have written a sample code, which accepts any certificate that is provided to it. It reads the client certificate and displays the results in a tabular format.<br>I browsed this web app and captured a network trace using WireShark. Here is a screenshot of this trace:</font></p> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image272.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb255.png" width="1304" height="216"></a></p></blockquote></li> <p><font size="2">So, how do we confirm if the server is requesting for client certificate. You can use one of the following methods:</font></p> <ol> <li><font size="2"><strong>Enable SSL traffic decryption in WireShark.</strong> <br>I found a blog post on how to do this and tested it myself. Here is the link: <a title="https://jimshaver.net/2015/02/11/decrypting-tls-browser-traffic-with-wireshark-the-easy-way/" href="https://jimshaver.net/2015/02/11/decrypting-tls-browser-traffic-with-wireshark-the-easy-way/">https://jimshaver.net/2015/02/11/decrypting-tls-browser-traffic-with-wireshark-the-easy-way/</a>&nbsp;<br>Here is a screenshot of the Decrypted message: The server is sending another Server Hello which contains the <strong>Certificate Request </strong>message.<br><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image273.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb256.png" width="1585" height="451"></a><br></font> <li><font size="2"><strong>Using cURL.exe</strong> <br>You can refer to my previous post on client cert <a title="https://blogs.msdn.microsoft.com/kaushal/2017/06/09/client-certificate-authentication-part-2/" href="https://blogs.msdn.microsoft.com/kaushal/2017/06/09/client-certificate-authentication-part-2/">here</a> to use curl. FYI, <strong>cURL</strong> is included by default on all the Azure App Service instances. Path is <font style="background-color: #cccccc" color="#c0504d" face="Courier New">D:\Program Files (x86)\Git\usr\bin</font>. This means you can do run cURL inside the command prompt window in the Kudu console. </font> <ul> <li><font size="2">Open the following URL in a browser: <a href="https://&lt;sitename&gt;.scm.azurewebsites.net/DebugConsole">https://&lt;sitename&gt;.<font style="background-color: #ffff00">scm.</font>azurewebsites.net/DebugConsole</a> (replace <strong>&lt;sitename&gt;</strong> with the name of the web app)</font>  <li><font size="2">Execute the following command:<br><font style="background-color: #000000" color="#ffffff" face="Courier New">curl -v https://&lt;hostname&gt;</font></font>  <li><font size="2" face="Courier New"></font><font size="2">Review the verbose output and search for “<strong>Request CERT (13)</strong>”. </font> <li><font size="2">Following is a brief output of the command from the Kudu console of the web app. The Server is requesting for the client certificate in the second <strong>Server Hello </strong>message. See the text highlighted in <strong>yellow</strong>. <blockquote> <table style="color: #ffffff;background-color: #000000" cellspacing="0" cellpadding="0" width="750" border="2"> <tbody> <tr> <td valign="top" width="746"><font size="2"></font> <p><font style="background-color: #ffff00" color="#0000ff" size="2" face="Courier New">D:\home&gt;curl -v </font><a href="https://clientcertauth-demo.azurewebsites.net"><font style="background-color: #ffff00" size="2" face="Courier New">https://clientcertauth-demo.azurewebsites.net</font></a><br><font size="2" face="Courier New">* STATE: INIT =&gt; CONNECT handle 0x80073200; line 1103 (connection #-5000) <br>* Rebuilt URL to: </font><a href="https://clientcertauth-demo.azurewebsites.net/"><font size="2" face="Courier New">https://clientcertauth-demo.azurewebsites.net/</font></a><br><font face="Courier New"><font size="2">* Added connection 0. The cache now contains 1 members<br>*&nbsp;&nbsp; Trying 111.221.95.27...<br>* STATE: CONNECT =&gt; WAITCONNECT handle 0x80073200; line 1156 (connection #0) <br>&nbsp; % Total&nbsp;&nbsp;&nbsp; % Received % Xferd&nbsp; Average Speed&nbsp;&nbsp; Time&nbsp;&nbsp;&nbsp; Time&nbsp;&nbsp;&nbsp;&nbsp; Time&nbsp; Current<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dload&nbsp; Upload&nbsp;&nbsp; Total&nbsp;&nbsp; Spent&nbsp;&nbsp;&nbsp; Left&nbsp; Speed<br>&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 --:--:-- --:--:-- --:--:--&nbsp;&nbsp;&nbsp;&nbsp; 0* Connected to clientcertauth-demo.azurewebsites.net (111.221.95.27) port 443 (#0)<br>* STATE: WAITCONNECT =&gt; SENDPROTOCONNECT handle 0x80073200; line 1253 (connection #0) <br>* ALPN, offering http/1.1<br><font color="#ff0000">* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH</font><br></font><font size="2"><font color="#ff0000">* successfully set certificate verify locations:<br>*&nbsp;&nbsp; CAfile: /usr/ssl/certs/ca-bundle.crt<br>&nbsp; CApath: none<br>* TLSv1.2 (OUT), TLS header, Certificate Status (22):<br>} [5 bytes data]<br>* TLSv1.2 (OUT), TLS handshake, Client hello (1):<br>} [512 bytes data]<br>* STATE: SENDPROTOCONNECT =&gt; PROTOCONNECT handle 0x80073200; line 1267 (connection #0) <br></font><font color="#00ff00">ï»¿&lt;!DOCTYPE html&gt;</font><br></font><font size="2"><font color="#00ff00">&lt;html&gt;</font></font></font></p> <p align="center"><font face="Courier New"><font size="2"><font color="#00ff00">&lt;--------------------------Trimmed HTML Response </font></font></font><font face="Courier New"><font size="2"><font color="#00ff00">--------------------------&gt;</font></font></font></p> <p><font face="Courier New"><font size="2"><font color="#00ff00">&lt;/html&gt;</font><br></font><font size="2"><font color="#ff0000">{ [5 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Server hello (2):<br>{ [81 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Certificate (11):<br>{ [3245 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Server key exchange (12):<br>{ [333 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Server finished (14):<br>{ [4 bytes data]<br>* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):<br>} [70 bytes data]<br>* TLSv1.2 (OUT), TLS change cipher, Client hello (1):<br>} [1 bytes data]<br>* TLSv1.2 (OUT), TLS handshake, Finished (20):<br>} [16 bytes data]<br>* TLSv1.2 (IN), TLS change cipher, Client hello (1):<br>{ [1 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Finished (20):</font><br><font color="#ff0000">{ [16 bytes data]</font><br><font color="#ff0000">* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA384<br>* ALPN, server did not agree to a protocol<br>* Server certificate:<br>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subject: CN=*.azurewebsites.net<br>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; start date: Sep 28 21:45:23 2016 GMT<br>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; expire date: May&nbsp; 7 17:03:30 2018 GMT<br>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subjectAltName: clientcertauth-demo.azurewebsites.net matched<br>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; OU=Microsoft IT; CN=Microsoft IT SSL SHA2<br>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SSL certificate verify ok.<br>* STATE: PROTOCONNECT =&gt; DO handle 0x80073200; line 1288 (connection #0) <br>} [5 bytes data]</font><br><font color="#00ff00">&gt; GET / HTTP/1.1<br>&gt; Host: clientcertauth-demo.azurewebsites.net<br>&gt; User-Agent: curl/7.47.1<br>&gt; Accept: */*<br>&gt; <br>* STATE: DO =&gt; DO_DONE handle 0x80073200; line 1350 (connection #0) <br>* STATE: DO_DONE =&gt; WAITPERFORM handle 0x80073200; line 1477 (connection #0) <br>* STATE: WAITPERFORM =&gt; PERFORM handle 0x80073200; line 1487 (connection #0) <br>{ [5 bytes data]</font><br></font><font size="2"><font color="#ff0000">* TLSv1.2 (IN), TLS handshake, Hello request (0):<br>{ [4 bytes data]<br>* TLSv1.2 (OUT), TLS handshake, Client hello (1):<br>} [512 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Server hello (2):<br>{ [105 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Certificate (11):<br>{ [3245 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Server key exchange (12):<br>{ [333 bytes data]<br><font style="background-color: #ffff00" size="4"><strong>* TLSv1.2 (IN), TLS handshake, Request CERT (13):</strong></font><br>{ [30 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Server finished (14):<br>{ [4 bytes data]<br>* TLSv1.2 (OUT), TLS handshake, Certificate (11):<br>} [7 bytes data]<br>* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):<br>} [70 bytes data]<br>* TLSv1.2 (OUT), TLS change cipher, Client hello (1):<br>} [1 bytes data]<br>* TLSv1.2 (OUT), TLS handshake, Finished (20):<br>} [16 bytes data]<br>* TLSv1.2 (IN), TLS change cipher, Client hello (1):<br>{ [1 bytes data]<br>* TLSv1.2 (IN), TLS handshake, Finished (20):<br>{ [16 bytes data]<br></font><font color="#00ff00">* HTTP 1.1 or later with persistent connection, pipelining supported<br>&lt; HTTP/1.1 403 Forbidden<br>&lt; Content-Type: text/html<br>* Server Microsoft-IIS/8.0 is not blacklisted<br>&lt; Server: Microsoft-IIS/8.0<br>&lt; Date: Fri, 09 Jun 2017 19:19:37 GMT<br>&lt; Connection: close<br>&lt; Content-Length: 2399</font></font></font></p> <p align="center"><font face="Courier New"><font size="2"><font color="#00ff00">&lt;--------------------------Trimmed </font></font></font><font face="Courier New"><font size="2"><font color="#00ff00">--------------------------&gt;</font></font></font></p></td></tr></tbody></table></p></blockquote></font> <p><font size="2"></font>Hope this clarifies few doubts on how TLS Mutual Auth works on Azure App Service.</p> <h3><u>RESTRICTIONS</u></h3> <li><font size="2">Currently, TLS Mutual Authentication is supported for web apps running in <strong>Basic</strong> or higher pricing tiers only. You will receive the following error if you try to enable it for a web app running in <strong>FREE/SHARED</strong> tier.</font>  <blockquote> <table style="background-color: #e5e4e2" cellspacing="0" cellpadding="2" width="558" border="2"> <tbody> <tr> <td valign="top" width="554"><font size="2">"<font color="#c0504d">Cannot enable client certificate for a site '{0}' because current site mode does not allow it.</font>"</font></td></tr></tbody></table></blockquote> <li><font size="2">When the <code>clientCertEnabled</code> property is set to <code>true</code> the web app mandates the client to provide a client certificate. If the client fails to provide a client certificate they will receive a <strong>403 </strong>error. Those familiar with <strong>IIS</strong>, this is equivalent to setting the <strong>sslFlags</strong> property (<em>inside <strong>&lt;access&gt;</strong> tags</em>) in IIS to include “<code>SslRequireCert</code>”. <br> <blockquote> <table cellspacing="0" cellpadding="2" width="600" border="2"> <tbody> <tr> <td valign="top" width="596"> <p><font size="2" face="Courier New">&lt;<font color="#c0504d">location </font><font color="#ff0000">path</font><font color="#0000ff">="Kaushal"</font>&gt;<br>&nbsp;&nbsp;&nbsp; &lt;<font color="#c0504d">system.webServer</font>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<font color="#c0504d">security</font>&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font style="background-color: #ffff00">&lt;<font color="#c0504d">access</font> <font color="#ff0000">sslFlags</font><font color="#0000ff">="Ssl, SslNegotiateCert, SslRequireCert"</font> /&gt;<br></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<font color="#c0504d">security</font>&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/<font color="#c0504d">system.webServer</font>&gt;<br>&lt;/<font color="#c0504d">location</font>&gt;</font></p></td></tr></tbody></table></blockquote></font> <li><font size="2">As of now, <strong>Azure App Service </strong>supports Secure Renegotiation and doesn’t entertain <strong>ReNego</strong>. If there are TLS clients, that are not compliant as per the <a href="https://tools.ietf.org/html/rfc5746#section-3.7">RFC 5746</a> and depend on Re-Negotiation, then they cannot connect to <strong>Azure App Service</strong>.</font>  <p><font size="2"></font></p> </li>]]></content:encoded>
    </item>
    <item>
      <title>Client Certificate Authentication (Part 2)</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/client-certificate-authentication-part-2</link>
      <pubDate>Fri, 09 Jun 2017 21:49:59 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1875</guid>
      <description><![CDATA[This is a continuation of my earlier post on Client Certificate Authentication (Part 1) aka TLS...]]></description>
      <content:encoded><![CDATA[<span style="font-size: small">This is a continuation of my earlier post on </span><a href="https://blogs.msdn.microsoft.com/kaushal/2015/05/27/client-certificate-authentication-part-1/"><span style="font-size: small">Client Certificate Authentication (Part 1)</span></a><span style="font-size: small"> aka <strong>TLS </strong>Mutual Authentication. Earlier, I had discussed on what Client Certificates are and how they work in <strong>SSL/TLS </strong>Handshake. </span>

<span style="font-size: small">In this post, I will explain how to review <strong>SSL/TLS handshake </strong>with help of tools like <strong><a href="https://www.wireshark.org/download.html">WireShark</a> </strong>&amp; <strong><a href="https://curl.haxx.se/dlwiz/?type=bin&amp;os=Win64&amp;flav=-&amp;ver=*&amp;cpu=x86_64">Curl</a></strong>. </span>

<span style="font-size: small">Before proceeding further, lets review the <strong>SERVER HELLO</strong> definition in </span><a href="https://tools.ietf.org/html/rfc5246#section-7.4"><span style="font-size: small">RFC 5246</span></a><span style="font-size: small">.  As per the RFC, the server will request the certificate from the client in the Server hello by including <strong>certificate_request</strong> message, which has the decimal code of <strong>13 (0d </strong>in Hex<strong>)</strong>. This will help us in determining the <strong>Certificate Request </strong>in <strong>Server Hello</strong>.</span>
<table style="background-color: #e5e4e2" cellspacing="0" cellpadding="0" width="500" border="0">
<tbody>
<tr>
<td>
<pre style="background-color: #e5e4e2;font-size: 13px">enum { 
    hello_request(0), 
    client_hello(1), 
    server_hello(2), 
    certificate(11), 
    server_key_exchange (12), 
    certificate_request(13), 
    server_hello_done(14), 
    certificate_verify(15), 
    client_key_exchange(16), 
    finished(20), 
    (255) 
} HandshakeType; 
struct { 
    HandshakeType msg_type;    /* handshake type */ 
    uint24 length;             /* bytes in message */ 
    select (HandshakeType) { 
        case hello_request:       HelloRequest; 
        case client_hello:        ClientHello; 
        case server_hello:        ServerHello; 
        case certificate:         Certificate; 
        case server_key_exchange: ServerKeyExchange; 
        case certificate_request: CertificateRequest;
        case server_hello_done:   ServerHelloDone; 
        case certificate_verify:  CertificateVerify; 
        case client_key_exchange: ClientKeyExchange; 
        case finished:            Finished; 
    } body; 
} Handshake;
</pre>
</td>
</tr>
</tbody>
</table>
<span style="font-size: small">Once the client sees the <strong>certificate_request </strong>message it will provide the certificate to the server. </span>
<h3><u><span style="font-weight: bold">Real world example:</span></u></h3>
<span style="font-size: small"><strong>Setup</strong>: Hosted a site on IIS inside an <strong>Azure VM. </strong>This requires a <strong>client certificate </strong>for authentication. Here is the endpoint <a href="https://azurevm.kaushal.co.in">https://azurevm.kaushal.co.in</a> </span>

<span style="font-size: small">I have added the SSL binding via <strong>netsh </strong>using the following command:</span>
<blockquote>
<table style="color: #ffffff;background-color: #2b1b17" cellspacing="0" cellpadding="0" width="800" border="0">
<tbody>
<tr>
<td width="798"><span style="font-size: small"><span style="font-family: Consolas"><b>netsh</b> http add sslcert <b>ipport</b>=0.0.0.0:443 <b>certhash</b>=&lt;certificate thumbprint goes here&gt; <b>appid</b>={4dc3e181-e14b-4a21-b022-59fc669b0914} <b>certstorename</b>=My <strong>clientcertnegotiation=enable</strong></span></span></td>
</tr>
</tbody>
</table>
<span style="font-size: small"></span></blockquote>
<h4><span style="font-size: large"><u><span style="font-weight: bold">Analyzing the TLS/SSL handshake in WireShark</span></u></span></h4>
<span style="font-size: small">As shown below, the server has sent a <strong>certificate request </strong>message to the client and the client has then responded with the certificate in the next communication.</span>
<blockquote><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image259.png"><img title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb243.png" width="1385" height="549" /></a></blockquote>
<span style="font-size: small"><span style="font-family: 'Segoe UI'">In WireShark you can set the filter to “<strong>ssl.handshake.type == 13</strong>” to specifically look for <strong>certificate_request </strong>message in <strong>Server Hello</strong></span>. </span>
<blockquote><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image260.png"><img title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb244.png" width="1271" height="96" /></a></blockquote>
<blockquote>
<table style="background-color: #e5e4e2" cellspacing="0" cellpadding="0" width="819" border="2">
<tbody>
<tr>
<td valign="top" width="815"><span style="font-size: small"><strong>NOTE:</strong> <span style="font-size: small"><span style="font-family: 'Segoe UI'">Some SSL/TLS servers support only <strong>Secure negotiation</strong>. Therefore you may not see the <strong><span style="background-color: #a5a5a5;color: #333333;font-family: Consolas">Certificate Request</span></strong> message explicitly in the <strong>Server Hello</strong>. In this case, the server will send the <span style="font-family: 'Segoe UI'"><strong>Certificate Request</strong> message as a part of the <span style="background-color: #a5a5a5;color: #000000;font-family: Consolas">Encrypted Handshake Message</span></span></span>.</span></span></td>
</tr>
</tbody>
</table>
</blockquote>
<u><span style="font-size: large"><strong>Analyzing the TLS/SSL handshake in cURL</strong></span></u>

<span style="font-size: small">By far, <strong>cURL </strong>has made it easier to determine if the server is sending the <strong>Certificate Request </strong>in Server Hello. You will have to download the version of curl that includes support SSL Protocol. This works in scenarios where the server supports only <strong>Secure Negotiation</strong>. I</span>

<span style="font-size: small">You can find various builds of <strong>cURL </strong>available for download here: <a href="https://curl.haxx.se/dlwiz/?type=bin&amp;os=Win64&amp;flav=-&amp;ver=*&amp;cpu=x86_64" title="https://curl.haxx.se/dlwiz/?type=bin&amp;os=Win64&amp;flav=-&amp;ver=*&amp;cpu=x86_64">https://curl.haxx.se/dlwiz/?type=bin&amp;os=Win64&amp;flav=-&amp;ver=*&amp;cpu=x86_64</a><a href="http://www.confusedbycode.com/curl/#downloads" title="http://www.confusedbycode.com/curl/#downloads"> </a></span>

<span style="font-size: small">I am using the following</span>

<span style="font-size: small"><strong>curl version</strong>: <strong>7.54.0 - SSL enabled SSH enabled</strong>
<strong>URL</strong>: </span><a href="https://bintray.com/artifact/download/vszakats/generic/curl-7.54.0-win64-mingw.7z" title="https://bintray.com/artifact/download/vszakats/generic/curl-7.54.0-win64-mingw.7z"><span style="font-size: small">https://bintray.com/artifact/download/vszakats/generic/curl-7.54.0-win64-mingw.7z</span></a><span style="font-size: small"> </span>

<span style="font-size: small">Execute the following from command prompt</span>
<blockquote>
<table style="background-color: #e5e4e2" cellspacing="0" cellpadding="0" width="618" border="2">
<tbody>
<tr>
<td valign="top" width="614"><span style="background-color: #cccccc;color: #000000;font-family: 'Courier New';font-size: small"></span><span style="font-family: 'Courier New';font-size: small">curl –v https://&lt;hostname&gt; –k –cert clientcert.pem:&lt;password&gt;</span></td>
</tr>
<tr>
<td valign="top" width="614"><span style="font-size: small"><strong><span style="color: #000000;font-family: 'Courier New';font-size: small">Where,
</span><span style="font-size: small"><strong><span style="color: #000000;font-family: 'Courier New';font-size: small">     -v, --verbose       Make the operation more talkative
</span></strong></span><span style="font-size: small"><strong><span style="font-size: small"><strong><span style="color: #000000;font-family: 'Courier New';font-size: small">     </span></strong></span></strong></span><span style="color: #000000;font-family: 'Courier New';font-size: small">-k, --insecure      Allow connections to SSL sites without certs (H)
-E, --cert CERT[:PASSWD] Client certificate file and password (SSL)</span></strong></span></td>
</tr>
</tbody>
</table>
</blockquote>
<span style="font-size: small">Once the request has been issued via <strong>cURL</strong>. In the verbose output, search for TLS handshake message “<span style="background-color: #cccccc;font-family: 'Courier New'"><strong>Request CERT (13)</strong></span>” as highlighted in the below example.</span>
<table style="background-color: #2b1b17" border="2" width="600" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="796">
<pre style="background-color: #2b1b17;color: white;font-size: 13px">C:\&gt;curl -v https://azurevm.kaushal.co.in -k --cert ClientCert.pem:Password
* Rebuilt URL to: https://azurevm.kaushal.co.in/
* Adding handle: conn: 0x34a6540
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x34a6540) send_pipe: 1, recv_pipe: 0
* About to connect() to azurevm.kaushal.co.in port 443 (#0)
*   Trying 13.71.126.36...
* Connected to azurevm.kaushal.co.in (13.71.126.36) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Request CERT (13):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS handshake, CERT verify (15):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using AES256-SHA
* Server certificate:
*        subject: OU=Domain Control Validated; CN=*.kaushal.co.in
*        start date: 2017-05-10 09:05:00 GMT
*        expire date: 2018-05-10 09:05:00 GMT
*        issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
*        SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
&gt; GET / HTTP/1.1
&gt; User-Agent: curl/7.33.0
&gt; Host: azurevm.kaushal.co.in
&gt; Accept: */*
&gt;
&lt; HTTP/1.1 200 OK
&lt; Cache-Control: private
&lt; Content-Type: text/html; charset=utf-8 * Server Microsoft-IIS/8.5 is not blacklisted
&lt; Server: Microsoft-IIS/8.5 &lt; X-AspNetMvc-Version: 5.2
&lt; X-AspNet-Version: 4.0.30319
&lt; X-Powered-By: ASP.NET
&lt; Date: Fri, 09 Jun 2017 16:51:13 GMT
&lt; Content-Length: 5767
. . .</pre>
</td>
</tr>
</tbody>
</table>
<span style="font-size: small">
On Windows, in order to pass the client certificate via <strong>cURL</strong>, you will have to extract the<strong> .pem</strong> file out of the<strong> .pfx</strong>. Use the following </span><span style="font-size: small">command:</span>
<table style="background-color: #2b1b17" border="2" width="600" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="796">
<pre style="background-color: #2b1b17;color: white;font-size: 13px">openssl pkcs12 -in clientcertificate.pfx -out clientcertificate.pem –clcerts
Enter Import Password:
MAC verified OK
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:</pre>
</td>
</tr>
</tbody>
</table>
<span style="font-size: small">HTH,</span>

<span style="font-size: small">Kaushal</span>

<span style="font-size: small"></span>]]></content:encoded>
    </item>
    <item>
      <title>Azure App Service: Using Easy Auth to query Facebook information via Graph API</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/using-easy-auth-to-query-facebook-information-via-graph-api</link>
      <pubDate>Thu, 08 Jun 2017 03:12:32 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1845</guid>
      <description><![CDATA[On 8th August 2016, Facebook ended support FQL (Facebook Query Language). Here is a screenshot of...]]></description>
      <content:encoded><![CDATA[<span style="font-size: small">On 8th August 2016, Facebook ended support <strong>FQL</strong> (<em>Facebook Query Language</em>). Here is a screenshot of the messaging from their site </span><a href="https://developers.facebook.com/docs/reference/fql/" title="https://developers.facebook.com/docs/reference/fql/"><span style="font-size: small">Facebook Query Language (FQL) Reference</span></a>
<blockquote><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image192.png"><span style="font-size: small"><img title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb192.png" width="721" height="108" /></span></a></blockquote>
<h4><span style="font-size: small">So they are encouraging the developers to use the GraphAPI to query the information. In this post we will cover on how to do this.</span></h4>
<h4><span style="font-family: 'Segoe UI Semibold'">Pre-Requisites</span></h4>
<ul>
 	<li><span style="font-size: small">Create an Azure Web App and configure <strong>Facebook </strong>Authentication. This will require creating a “<strong>App ID</strong>” &amp; “<strong>App Secret</strong>”. Refer this </span><a href="https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-how-to-configure-facebook-authentication"><span style="font-size: small">link</span></a><span style="font-size: small"> on on how to do this.</span></li>
 	<li><span style="font-size: small">In the Azure Portal, under <strong>Facebook Authentication Settings </strong>select the <em>scopes </em>(or <em>permissions</em>) to access the required data.</span></li>
 	<li><span style="font-size: small">I created a ASP.NET MVC 5 application with default authentication set to <strong>Individual User Accounts</strong>.</span></li>
</ul>
<h3>Determining the scopes required to query the facebook data</h3>
<h3><span style="font-size: small">Facebook provides <a target="_blank" href="https://developers.facebook.com/tools/explorer/">Graph API Explorer</a>, which allows the users to test, create and debug their graph API calls. Using this the users can generate a <span style="font-weight: bold">accesstoken </span>with specific scope. Using this token, the users can call the Facebook GraphApi and review the results right there.</span></h3>
<h3><span style="font-size: small">Here is a screenshot of the UI:</span></h3>
<blockquote>
<h3><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image194.png"><img title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb194.png" width="909" height="527" /></a><span style="font-size: small"></span></h3>
<h3><span style="font-size: small">Once you have understood, the scopes and parameters you need to pass when calling the Facebook graph Api, we can start working on building the web application.</span></h3>
</blockquote>
<h3>Create a Function to call an external Endpoint</h3>
The below <strong><span style="background-color: #cccccc;font-family: 'Courier New'">RequestResponse()</span><span> </span></strong><span style="background-color: #cccccc;font-family: 'Courier New'"></span>method takes an URL as input. Using the <strong>HttpWebRequest </strong>method, we call the URL and return the response. <script src="https://gist.github.com/anonymous/afc91d16d2feaa7cbd48193f7266bcf5.js"></script>

<span style="font-size: small"></span>
<h3>Calling the Facebook Graph Api</h3>
The below <span style="background-color: #cccccc;font-family: 'Courier New'"><strong>CallFacebookGraphApi()</strong></span> method code takes 3 inputs, all of which are of type string.
<ol>
 	<li><strong>id </strong>– This is the path that will be called. For example “me/feed”</li>
 	<li><strong>fields </strong>– this is the query string parameters that needs to be provided with the <strong>id </strong>above.</li>
 	<li><strong>accesstoken </strong>– this is the value of the “<strong>X-MS-TOKEN-FACEBOOK-ACCESS-TOKEN</strong>” header, that gets generated upon successful user login. This is used to authorize the GraphAPI call.</li>
</ol>
using the above 3 parameters we create a URL and call the <strong><span style="background-color: #cccccc;font-family: 'Courier New'">RequestResponse()</span> </strong>method we created earlier.

<script src="https://gist.github.com/anonymous/b6aec07159d7755d21183a3c05e4de9d.js"></script>
<h3>Fetching results from Facebook</h3>
Here we have a <strong>ActionResult </strong>Facebook, where we pass the parameters to the <span style="background-color: #cccccc;font-family: 'Courier New'"><strong>CallFacebookGraphApi()</strong></span> method we created above.

<script src="https://gist.github.com/anonymous/23387707c57a85acb2d0457951942925.js"></script>
I have deployed a working version of the code on one of my web apps (<strong>Azure App Service</strong>). You can see the it working here: <a href="https://easyauthkaushal-staging.azurewebsites.net" title="https://easyauthkaushal-staging.azurewebsites.net">https://easyauthkaushal-staging.azurewebsites.net</a>

This code is published on Github. You may fork it here: <a href="https://github.com/kaushalp/Facebook-GraphApi-with-EasyAuth" title="https://github.com/kaushalp/Facebook-GraphApi-with-EasyAuth">https://github.com/kaushalp/Facebook-GraphApi-with-EasyAuth</a>

HTH,
Kaushal]]></content:encoded>
    </item>
    <item>
      <title>Azure App Service: Generating memory dumps on first chance exception using Procdump</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/azure-app-service-generating-memory-dumps-on-first-chance-exception-using-procdump</link>
      <pubDate>Mon, 08 May 2017 21:00:45 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1787</guid>
      <description><![CDATA[In one of my older posts, I have explained on how we can generate memory dumps on first chance...]]></description>
      <content:encoded><![CDATA[<p>In one of my older <a href="https://blogs.msdn.microsoft.com/kaushal/2012/05/09/using-debugdiag-to-capture-a-dump-on-first-chance-exception/">posts</a>, I have explained on how we can generate memory dumps on first chance exceptions using <strong><a href="https://www.microsoft.com/en-us/download/details.aspx?id=49924">Debug Diag</a></strong>. In certain scenarios where the users do not have permissions to install tools, users have to look for alternate options. For example, in <strong>Azure App Service</strong>, the users do not have permissions to install anything on the VM. </p> <p>However, Azure App Service provides the KUDU console, using which the users can use a command line utility like <a href="https://technet.microsoft.com/en-in/sysinternals/dd996900.aspx">procdump.exe</a> to generate memory dumps. We can also use procdump to generate memory dumps on <em><strong>first chance exception </strong></em>using the below command:</p> <blockquote> <table cellspacing="0" cellpadding="2" width="613" border="2"> <tbody> <tr> <td bgcolor="#003300" valign="top" width="609"> <p align="left"><font style="background-color: #cccccc" size="2" face="Courier New"></font><font color="#00ff00" size="2" face="Courier New">procdump.exe -accepteula -ma <strong>-e 1 -f</strong> "&lt;Exception Name&gt;" &lt;Process ID&gt;</font></p></td></tr> <tr> <td bgcolor="#003300" valign="top" width="609"> <p><font color="#ffffff" size="2">where,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>-ma</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write a dump file with all process memory. The default dump format only includes<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thread and handle information<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>-accepteula</strong>&nbsp;&nbsp; Use this switch to automatically accept the Sysinternals license agreement.</font></p> <p><font color="#ffffff"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>-e</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write a dump when the process encounters an unhandled exception. Include the&nbsp; <br></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>1</strong> to create dump on first chance exceptions.</font></font></p> <p><font color="#ffffff" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>-f</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Filter the first chance exceptions. Wildcards (*) are supported. To just display <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the names without dumping, use a blank ("") filter</font></p></td></tr></tbody></table></blockquote> <p><font size="2">Azure App Service instances include the sysinternals suite in the default image. They can be located here via the KUDU console: <font style="background-color: #cccccc" face="Courier New">D:\devtools\sysinternals</font></font>  <p><font size="2">The users may also download ProcDump from </font><a href="https://live.sysinternals.com/procdump.exe"><font size="2">here</font></a><font size="2"> and upload it a specific location such as <font style="background-color: #cccccc" face="Courier New">D:\home\Dumps</font> and use it. </font> <p><font size="2">You would need to determine the process ID of the process against which procdump would be executed. You can determine that by navigating to the Process explorer in the KUDU console as shown below: (<em>Note the PID of the w3wp process without the SCM tag</em>)</font>  <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image120.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb121.png" width="833" height="168"></a>  <p><font size="2">Here is an example<font face="Courier New">:</font></font>  <blockquote> <table cellspacing="0" cellpadding="2" width="700" bgcolor="#000000" border="2"> <tbody> <tr> <td bgcolor="#000000" valign="top" width="696"> <p><font color="#ffffff"><font face="Consolas"><font size="2">D:\home\Dumps&gt;<font color="#00ff00">procdump.exe -accepteula -ma -e 1 -f "System.UnauthorizedAccessException" 7808</font></font> </font></font> <p><font color="#ffffff" size="2" face="Consolas">ProcDump v8.2 - Sysinternals process dump utility<br></font><font color="#ffffff"><font face="Consolas"><font size="2">Copyright (C) 2009-2016 Mark Russinovich and Andrew Richards<br></font><font size="2">Sysinternals - </font></font></font><a href="http://www.sysinternals.com"><font color="#ffffff" size="2" face="Consolas">www.sysinternals.com</font></a><font color="#ffffff" face="Consolas"> </font> <p><font color="#ffffff" size="2" face="Consolas">Process:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w3wp.exe (7808)<br></font><font color="#ffffff" size="2" face="Consolas">Process image:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; D:\Windows\SysWOW64\inetsrv\w3wp.exe<br></font><font color="#ffffff" size="2" face="Consolas">CPU threshold:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n/a<br></font><font color="#ffffff" size="2" face="Consolas">Performance counter:&nbsp;&nbsp; n/a<br></font><font color="#ffffff" size="2" face="Consolas">Commit threshold:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n/a<br></font><font color="#ffffff" size="2" face="Consolas">Threshold seconds:&nbsp;&nbsp;&nbsp;&nbsp; n/a<br></font><font color="#ffffff" size="2" face="Consolas">Hung window check:&nbsp;&nbsp;&nbsp;&nbsp; Disabled<br></font><font color="#ffffff" size="2" face="Consolas">Log debug strings:&nbsp;&nbsp;&nbsp;&nbsp; Disabled<br></font><font color="#ffffff" size="2" face="Consolas">Exception monitor:&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">First Chance+Unhandled</font><br></font><font color="#ffffff" size="2" face="Consolas">Exception filter:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Includes]<br></font><font color="#ffffff" size="2" face="Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff0000">*System.UnauthorizedAccessException*</font><br></font><font color="#ffffff" size="2" face="Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [Excludes]<br></font><font color="#ffffff" size="2" face="Consolas">Terminate monitor:&nbsp;&nbsp;&nbsp;&nbsp; Disabled<br></font><font color="#ffffff" size="2" face="Consolas">Cloning type:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Disabled<br></font><font color="#ffffff" size="2" face="Consolas">Concurrent limit:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n/a<br></font><font color="#ffffff" size="2" face="Consolas">Avoid outage:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n/a<br></font><font color="#ffffff" size="2" face="Consolas">Number of dumps:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br></font><font color="#ffffff" size="2" face="Consolas">Dump folder:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; D:\home\Dumps\<br></font><font color="#ffffff" size="2" face="Consolas">Dump filename/mask:&nbsp;&nbsp;&nbsp; PROCESSNAME_YYMMDD_HHMMSS<br></font><font color="#ffffff" size="2" face="Consolas">Queue to WER:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Disabled<br></font><font color="#ffffff" size="2" face="Consolas">Kill after dump:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Disabled<br></font><font size="2"></font></p> <p><font color="#ffffff" size="2" face="Consolas">Press Ctrl-C to end monitoring without terminating the process.<br></font><font color="#ffffff" size="2" face="Consolas">CLR Version: v4.0.30319<br></font><font style="background-color: #ffff00" color="#c0504d"></font><font color="#ffc000" size="2" face="Consolas"><strong>[10:02:46] Exception: E0434F4D.System.Exception ("There was a problem processing this request")<br></strong></font><font color="#ffc000" size="2" face="Consolas"><strong>[10:02:47] Exception: E0434F4D.System.UnauthorizedAccessException ("Access is denied.")<br></strong></font><font color="#ffc000" size="2" face="Consolas"><strong>[10:02:47] Dump 1 initiated: D:\home\Dumps\w3wp.exe_170426_100247.dmp<br></strong></font><font size="2"><strong><font face="Consolas"><font color="#ffc000">[10:02:52] Dump 1 writing: Estimated dump file size is 306 MB.</font><br></font></strong></font><strong><font size="2"><font color="#ffc000" face="Consolas">[10:03:16] Dump 1 complete: 306 MB written in 29.8 seconds<br>[10:03:17] Dump count reached</font></font></strong><font style="background-color: #ffff00"><font color="#c0504d"><font size="2" face="Courier New"></font></font></font></p></td></tr></tbody></table></blockquote> <p>HTH! <img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none;border-left-style: none;border-bottom-style: none;border-right-style: none" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/2017/05/wlEmoticon-smile2.png"></p>]]></content:encoded>
    </item>
    <item>
      <title>Azure App Service: Manually collect memory dumps</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/azure-app-service-manually-collect-memory-dumps</link>
      <pubDate>Thu, 04 May 2017 17:05:25 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1555</guid>
      <description><![CDATA[While troubleshooting web application performance issues we are sometimes required to gather memory...]]></description>
      <content:encoded><![CDATA[<p><u></u></p> <p><font size="2">While troubleshooting web application performance issues we are sometimes required to gather memory dumps during the time of the issue.</font></p> <p><font size="2">In <font face="Segoe UI Semibold">Azure App Service</font>, we do not have RDP access to the machines. However, this doesn’t restrict us from gathering logs &amp; data for troubleshooting. I am listing out few methods using which we can generate memory dumps of the process during the time of the issue.</font></p> <h1><u>Method 1: Using ProcDump.exe </u></h1> <blockquote> <h5><font size="2"><u><font face="Segoe UI Semibold">Pre-Requisite</font>:</u> For this we need the sysinternals utility: </font><a href="https://live.sysinternals.com/procdump.exe" target="_blank"><font size="2">ProcDump.exe</font></a></h5></blockquote> <p><font size="2">Azure App Service instances include the sysinternals suite in the default image. They can be located here via the KUDU console: <font style="background-color: #cccccc" face="Consolas">D:\devtools\sysinternals</font></font></p> <p><font size="2">The users may also download ProcDump from </font><a href="https://live.sysinternals.com/procdump.exe" target="_blank"><font size="2">here</font></a><font size="2"> and upload it a specific location such as <font style="background-color: #cccccc" face="Consolas">D:\home\LogFiles\Dumps</font> and use it. </font></p> <ul> <li><font size="2">Browse to the KUDU console </font> <li><font size="2">Click on <strong>Process Explorer</strong> menu. </font> <li><font size="2">There will be 2 w3wp.exe processes, one for <strong>SCM </strong>(KUDU) and another for the application. </font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image121.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb122.png" width="798" height="171"></a></p></blockquote> <ul> <li><font size="2">Note the <strong>PID </strong>(Process ID) of the w3wp.exe corresponding to the application (see the image above) </font> <li><font size="2">Browse to <strong>Debug Console </strong>–&gt; <strong>CMD</strong> </font> <li><font size="2">In the command window, navigate to the <strong>dumps </strong>folder. </font> <li><font size="2">Execute the following command to generate a full memory dump of the process</font></li></ul> <blockquote> <table cellspacing="0" cellpadding="2" width="620" border="2"> <tbody> <tr> <td bgcolor="#e5f9ff" valign="top" width="616"><font size="2" face="Courier New">procdump.exe -accepteula –ma &lt;PID of the process&gt;</font></td></tr> <tr> <td bgcolor="#e5f9ff" valign="top" width="616"><font size="2">where, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -ma&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write a dump file with all process memory. The default dump format only includes <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; thread and handle information<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -accepteula&nbsp;&nbsp;&nbsp; Use this switch to automatically accept the Sysinternals license agreement.</font></td></tr></tbody></table></blockquote> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image630.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb547.png" width="804" height="506"></a></p></blockquote> <h1><u>Method 2: Using Diagnostics as a Service (DaaS) </u></h1> <h2><font size="4"><font face="Segoe UI"><u>Via Portal:</u></font></font></h2> <ul> <li><font size="2">Login to Azure portal. (</font><a href="https://portal.azure.com"><font size="2">https://portal.azure.com</font></a><font size="2">) </font> <li><font size="2">Select the Azure Web App that you intend to troubleshoot </font> <li><font size="2">Click on <strong>Diagnose and solve problems</strong>.</font> </li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image59.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb62.png" width="232" height="272"></a></p></blockquote> <ul> <li><font size="2">In the new blade click on <strong>Diagnostics as a Service</strong>. (<em>Bottom right side of the blade.</em>)</font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image60.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb63.png" width="258" height="311"></a></p></blockquote> <ul> <li>In the new blade, set the following:  <ul> <li><strong>Application Type </strong>– Depending on the type of application set the value to <strong>ASP.NET </strong>or <strong>PHP </strong>or <strong>Node.js</strong>.  <li><strong>Diagnosers </strong>– Since this post is about collecting memory dumps, ensure that the check box against <strong>Memory Dump </strong>is selected. If you need <strong>Event Viewer Logs </strong>&amp; <strong>Http Logs</strong> then you can enable them too.  <li><strong>Instances – </strong>If the App Service Plan is configured to use more than one instance, then you can configure this to collect the logs on either multiple instance or specific instances.</li></ul></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image61.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb64.png" width="561" height="310"></a></p></blockquote> <ul> <li>Click on Run to collect the logs. The blade will indicate the status of the operation and will also run analysis on the collected data. </li></ul> <ul> <li>This puts the data under <strong><font style="background-color: #cccccc" size="2" face="Consolas">D:\home\data\DaaS\Logs<font style="background-color: #ffffff"> </font></font></strong>folder.<!--EndFragment--> </li></ul> <p><font size="4"><font face="Segoe UI"><u>Via KUDU:</u></font></font></p> <p><font size="2">In scenarios, where the user may not have access to the portal, they can use <strong>Kudu </strong>to access <strong>DaaS</strong>. The option to select instances is not available here as KUDU by default connects to a specific instance. You can refer my previous post on this: </font><a title="https://blogs.msdn.microsoft.com/kaushal/2016/11/21/azure-app-service-how-to-connect-to-the-kudu-site-of-a-specific-instance/" href="https://blogs.msdn.microsoft.com/kaushal/2016/11/21/azure-app-service-how-to-connect-to-the-kudu-site-of-a-specific-instance/"><font size="2">How to connect to the Kudu site of a specific instance</font></a></p> <ul> <li><font size="2">Login to the <strong>KUDU</strong> console and append /<strong>daas</strong> to the path. (</font><a href="http://&lt;yoursitename&gt;.scm.azurewebsites.net/daas"><font size="2">http://&lt;yoursitename&gt;.scm.azurewebsites.net/daas</font></a><font size="2">) </font> <li><font size="2">This will launch the <strong>DaaS</strong> portal </font> <li><font size="2">Reproduce the issue </font> <li><font size="2">Click on <strong>Diagnose Now </strong>button as shown below:</font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image62.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb65.png" width="877" height="453"></a></p></blockquote> <ul> <li>This will initiate logs collect.  <li>You can click on Schedule Analysis to select the logs that will be collected and whether you want to run an analysis on that. </li></ul> <blockquote> <h4><font size="4"><u>More Information:</u></font></h4> <p><a title="https://azure.microsoft.com/en-in/blog/daas/" href="https://azure.microsoft.com/en-in/blog/daas/"><font size="2">DaaS – Diagnostics as a Service for Azure Web Sites</font></a></p> <p><a title="https://azure.microsoft.com/en-in/blog/new-updates-to-daas-diagnostics-as-a-service-for-azure-websites/" href="https://azure.microsoft.com/en-in/blog/new-updates-to-daas-diagnostics-as-a-service-for-azure-websites/"><font size="2">New Updates to DaaS - Diagnostics as a Service for Azure Websites</font></a><font size="2">&nbsp;</font></p> <p><a title="https://sunithamk.wordpress.com/2015/11/04/diagnose-and-mitigate-issues-with-azure-web-apps-support-portal/" href="https://sunithamk.wordpress.com/2015/11/04/diagnose-and-mitigate-issues-with-azure-web-apps-support-portal/"><font size="2">https://sunithamk.wordpress.com/2015/11/04/diagnose-and-mitigate-issues-with-azure-web-apps-support-portal/</font></a>&nbsp;</p></blockquote> <h1><u>Method 3: Using Process Explorer (KUDU) (<em>least favorable</em>)</u></h1> <p><font face="Segoe UI Semibold"><font size="2"><font style="background-color: #ffff00" color="#c0504d">This method is the least favorable as it generates the memory dump and the prompts the user to download it. If the download is interrupted due to some reason then the data is lost.</font> </font></font></p> <ul> <li>Login to the KUDU console. (<a href="http://%3cyoursitename%3e.scm.azurewebsites.net">http://&lt;yoursitename&gt;.scm.azurewebsites.net</a>)  <li>Click on <strong>Process Explorer</strong> menu  <li>There will be 2 w3wp.exe processes, one for <strong>SCM </strong>(KUDU) and another for the application.  <li>Reproduce the issue  <li>Right click the w3wp process (<em>without the <strong>scm </strong>tag</em>) and select <strong>Download memory dump</strong> –&gt; <strong>Full Dump</strong> as shown below:</li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/clip_image0012.jpg"><img title="clip_image001" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/2017/05/clip_image001_thumb1.jpg" width="1028" height="221"></a> </p></blockquote> <ul> <li><font size="2">Depending on the size of the process it will take couple of seconds or few minutes to generate the dump on the VM and prompt you to download the file</font></li></ul> <h3 align="center"><u><font color="#ff0000" size="4" face="Segoe UI Semibold">****IMPORTANT****</font></u></h3> <ul> <li> <div align="left"><font size="2">Using <strong>Daas </strong>via portal is the preferable method. When the web app is scaled out to run on more than one instance, then you can use DaaS to collect the memory dump from a specific instance. <strong>Method 2 &amp; 3 </strong>will generate memory dump on a specific instance and is not fool proof as the issue may or may not be occurring on the connected instance. You can however connect to the KUDU of a specific instance using my previous post here: <a title="https://blogs.msdn.microsoft.com/kaushal/2016/11/21/azure-app-service-how-to-connect-to-the-kudu-site-of-a-specific-instance/" href="https://blogs.msdn.microsoft.com/kaushal/2016/11/21/azure-app-service-how-to-connect-to-the-kudu-site-of-a-specific-instance/">How to connect to the Kudu site of a specific instance</a></font></div> <li> <div align="left"><font size="2">The downloading of the memory dump will contribute towards the outbound bandwidth of the App service plan. For more details refer: </font><a href="http://azure.microsoft.com/en-us/pricing/details/data-transfers/"><font size="2">http://azure.microsoft.com/en-us/pricing/details/data-transfers/</font></a></div> <li> <div align="left"><font size="2">When the memory dump is being written, the process remains in a frozen state for the entire duration of operation. So this impacts the application’s availability.</font></div> <li> <div align="left"><font size="2">You can compress the memory dump via <strong>7zip</strong> which is availably by default on Azure App Service instances. You can run the following command:</font></div></li></ul> <blockquote> <p align="left"><font style="background-color: #cccccc" size="2" face="Consolas">D:\home\Logfiles\Dumps&gt;D:\7zip\7za.exe a <strong>MemoryDumps</strong>.zip *.dmp</font></p> <p align="left"><font style="background-color: #cccccc" size="2">NOTE: Compression consumes CPU cycles, so you may want to re-consider when running this on a <strong>Small </strong>sized instance</font></p> <p align="left"><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image63.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb66.png" width="781" height="491"></a></p></blockquote>]]></content:encoded>
    </item>
    <item>
      <title>Azure App Service: How to read &amp; parse connection strings via PHP</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/azure-app-service-how-to-read-parse-connection-strings-via-php</link>
      <pubDate>Thu, 04 May 2017 13:20:52 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1595</guid>
      <description><![CDATA[On Azure App Service, developers have the ability to configure the connection strings as key-value...]]></description>
      <content:encoded><![CDATA[On <strong>Azure App Service</strong>, developers have the ability to configure the connection strings as key-value pair under <strong>App Settings</strong> section. Here is a sample screenshot:
<blockquote><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image49.png"><img title="image" style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb52.png" width="718" height="244" /></a></blockquote>
At runtime, <strong>Azure App Service</strong> retrieves this key-value pair for you and makes them available to your hosted application. These are provided to the web app as <strong>Environment Variables</strong>.

Here is a good article on how to these work internally: <a href="https://azure.microsoft.com/en-in/blog/windows-azure-web-sites-how-application-strings-and-connection-strings-work/" title="https://azure.microsoft.com/en-in/blog/windows-azure-web-sites-how-application-strings-and-connection-strings-work/">How Application Strings and Connection Strings Work</a>

Here is a sample code on how to read the app settings in PHP

<script src="https://gist.github.com/kaushalp/7a9249780f8d65fca7646edd02c7343b.js"></script>

<span style="font-size: medium"><strong>Summary</strong></span>

The sample code is a way to get started on how to retrieve the connection strings at runtime in PHP. I have used the above sample to read from a database and display it on a page. The project is hosted on GitHub. See here: <a href="https://github.com/kaushalp/Problematique/edit/master/ProblematicMvc/client.php" title="https://github.com/kaushalp/Problematique/edit/master/ProblematicMvc/client.php">https://github.com/kaushalp/Problematique/edit/master/ProblematicMvc/client.php</a>]]></content:encoded>
    </item>
    <item>
      <title>Azure App Service: Using cURL for deployment</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/azure-app-service-using-curl-for-deployment</link>
      <pubDate>Tue, 24 Jan 2017 10:56:48 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1495</guid>
      <description><![CDATA[cURL is a command line tool that can be used to send or receive files. cURL.exe supports numerous...]]></description>
      <content:encoded><![CDATA[<p><strong>cURL</strong> is a command line tool that can be used to send or receive files. <span style="font-size: small">cURL.exe supports numerous protocols like HTTP, HTTPS, FTP, FTPS, SFTP, LDAP, TELNET, SMTP, POP3 etc. For more information please refer the below links:</span></p> <blockquote> <p><a title="https://en.wikipedia.org/wiki/CURL" href="https://en.wikipedia.org/wiki/CURL"><span style="font-size: small">https://en.wikipedia.org/wiki/CURL</span></a><br><a title="https://curl.haxx.se/docs/" href="https://curl.haxx.se/docs/"><span style="font-size: small">https://curl.haxx.se/docs/</span></a></p></blockquote> <h2><span style="text-decoration: underline">Syntax</span></h2> <blockquote> <p><strong><span style="font-size: small;font-family: 'Courier New';background-color: #cccccc"> curl.exe -T &lt;path-to-file-that-needs-to-be-deployed&gt; -u "username:password" "FTP URL" </span></strong></p></blockquote> <p><span style="font-size: small">From curl documentation<br></span></p> <blockquote> <table cellspacing="0" cellpadding="2" width="476" border="2"> <tbody> <tr> <td bgcolor="#e0e0e0" valign="top" width="472"><span style="font-family: consolas"><span style="font-size: small">-<strong>T</strong>, --<strong>upload-file</strong> FILE Transfer FILE to destination</span><br></span><span style="font-family: consolas"><span style="font-size: small">--<strong>url</strong> URL URL to work with</span> </span><span style="font-family: consolas"><span style="font-size: small">-u, <strong>--user</strong> USER[:PASSWORD] Server user and password</span><br></span><span style="font-family: consolas"><span style="font-size: small">--<strong>tlsuser</strong> USER TLS username</span><br></span><span style="font-family: consolas"><span style="font-size: small">--<strong>tlspassword</strong> STRING TLS password</span><br></span><span style="font-size: small;font-family: consolas">--<strong>tlsauthtype</strong> STRING TLS authentication type (default SRP)</span></td></tr></tbody></table></blockquote> <h3><span style="text-decoration: underline"><font size="6" face="Segoe UI Semilight">Pre-Requisites:</font></span></h3> <ul> <li><span style="font-size: small">Deployment over <strong>FTPS</strong> will work only if the version of the curl is SSL aware. Download it from here:</span> </li></ul> <p><a href="https://curl.haxx.se/download.html"><span style="font-size: small">https://curl.haxx.se/download.html</span></a></p> <ul> <li><span style="font-size: small">FTP endpoint of the web app. You can get this from portal or from the publish profile of the web app (under FTP section search for publishURL)</span>  <li><span style="font-size: small">Username and password for authentication (Either deployment or publish profile credentials. See </span><a href="https://github.com/projectkudu/kudu/wiki/Deployment-credentials"><span style="font-size: small">this</span></a><span style="font-size: small">)</span>  <ul> <li><span style="font-size: small">With user-level credentials (User specific): sitename\username</span>  <li><span style="font-size: small">With site-level credentials (Site specific/publish profile) : sitename\$sitename</span> </li></ul></li></ul> <blockquote> <table cellspacing="0" cellpadding="2" width="731" border="2"> <tbody> <tr> <td bgcolor="#e0e0e0" valign="top" width="727"> <h4><span style="font-size: large;font-family: 'Segoe UI Semibold'">For FTPS<br></span></h4> <ul> <ul> <li><span style="font-size: small">Browse to the following location: </span><a href="http://curl.haxx.se/docs/caextract.html"><span style="font-size: small">http://curl.haxx.se/docs/caextract.html</span></a>  <li><span style="font-size: small">Right click and download the "cacert.pem" file and rename the file extension to ".crt" (Use Chrome)</span> </li></ul></ul></td></tr></tbody></table></blockquote> <h2><span style="text-decoration: underline"><span style="font-family: 'Segoe UI Semibold'"><font size="6" face="Segoe UI Semilight">Deploying via FTP</font></span></span></h2> <ul> <li><span style="font-size: small">Launch command prompt</span>  <li><span style="font-size: small">Browse to the folder location where curl was downloaded and execute the following command:</span> </li></ul> <blockquote> <table cellspacing="0" cellpadding="2" width="870" border="2"> <tbody> <tr> <td bgcolor="#a4a4a4" valign="top" width="907"><span style="font-size: small;font-family: consolas">C:\&gt;curl -T C:\sample.war -u "<span style="background-color: #00ff00">kaushalp\$kaushalp</span>:&lt;password&gt;" </span><a href="ftp://waws-prod-sg1-005.ftp.azurewebsites.windows.net/site/wwwroot/"><span style="font-size: small;font-family: consolas">ftp://waws-prod-sg1-005.ftp.azurewebsites.windows.net/site/wwwroot/</span></a><span style="font-family: consolas"> </span></td></tr></tbody></table></blockquote> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image603.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb521.png" width="876" height="161"></a></p></blockquote> <h2><span style="text-decoration: underline"><span style="font-family: 'Segoe UI Semibold'"><font size="6" face="Segoe UI Semilight">Deploying via FTPS</font></span></span></h2> <p><span style="font-size: small">While using <strong>cURL </strong>via FTPS (FTP over SSL), the following error may be encountered when trying to connect over HTTP.</span></p> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image604.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb522.png" width="790" height="365"></a></p></blockquote> <p><span style="font-size: small">The following error is seen because curl will try to verify the certificate received in the Server Hello and it fails as it couldn’t verify the CA who issued the certificate.</span></p> <p><span style="font-size: small">This problem can be addressed by using an additional parameter either <strong><span style="background-color: #ffff00">--cacert </span></strong>or <strong><span style="background-color: #ffff00">-k</span> </strong>can be specified.</span></p> <blockquote> <table cellspacing="0" cellpadding="2" width="798" border="2"> <tbody> <tr> <td bgcolor="#a4a4a4" valign="top" width="794"><span style="font-family: consolas"><span style="font-size: small">C:\&gt;curl -T C:\sample.war -u "<span style="background-color: #00ff00">kaushalp\$kaushalp</span>:&lt;password&gt;" ftps://waws-prod-sg1-005.ftp.azurewebsites.windows.net/site/wwwroot/ <span style="background-color: #ffff00">-k</span></span> </span></td></tr></tbody></table></blockquote> <p><span style="font-size: small"><strong><span style="background-color: #ffff00">-k, --insecure</span></strong> Allow connections to SSL sites without certs (H)</span></p> <blockquote> <table cellspacing="0" cellpadding="2" width="794" border="2"> <tbody> <tr> <td bgcolor="#a4a4a4" valign="top" width="790"><span style="font-family: consolas"><span style="font-size: small">C:\&gt;curl -T C:\sample.war -u "<span style="background-color: #00ff00">kaushalp\$kaushalp</span>:&lt;password&gt;" ftps://waws-prod-sg1-005.ftp.azurewebsites.windows.net/site/wwwroot/ <span style="background-color: #ffff00">--cacert e:\tools\kaushal-bundle.crt</span></span> </span></td></tr></tbody></table></blockquote> <p><span style="font-size: small"><strong><span style="background-color: #ffff00">--cacert</span></strong> FILE CA certificate to verify peer against (SSL)</span></p> <h1 align="center"><span style="text-decoration: underline"><span style="font-family: 'Segoe UI Semibold'"><font size="6" face="Segoe UI Semilight">TROUBLESHOOTING</font></span></span></h1> <p style="padding-left: 30px"><span style="font-size: small">Error: "<span style="color: #ff0000">curl: (25) Failed FTP upload: 550</span>"<br><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image605.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb523.png" width="903" height="149"><br></a>This error is seen when the FTP URL does not contain a trailing slash "/".</span></p> <h2><span style="text-decoration: underline"><span style="font-size: large">More Information:</span></span></h2> <p><span style="font-size: small">Here is the default list of CA's that are supported by curl: </span><a href="https://curl.haxx.se/ca/cacert.pem"><span style="font-size: small">https://curl.haxx.se/ca/cacert.pem</span></a><span style="font-size: small"> (This was the file that was downloaded under pre-requisites)</span></p> <p><span style="font-size: small">Users can generate their own crt file and pass it to CURL. </span></p> <p><span style="font-size: small"></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Azure App Service: How to connect to the Kudu site of a specific instance</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/azure-app-service-how-to-connect-to-the-kudu-site-of-a-specific-instance</link>
      <pubDate>Mon, 21 Nov 2016 12:21:00 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1405</guid>
      <description><![CDATA[Every Azure Web App has an associated 'scm' service site, which runs Kudu and other Site Extensions....]]></description>
      <content:encoded><![CDATA[<p><font size="2">Every Azure Web App has an associated 'scm' service site, which runs Kudu and other </font><a href="https://github.com/projectkudu/kudu/wiki/Azure-Site-Extensions"><font size="2">Site Extensions</font></a><font size="2">. </font> <div><font size="2"><font size="4"><font face="Segoe UI Semibold"><u>OVERVIEW</u></font>:</font> </font></div> <ul> <li><font size="2">Kudu site can be accessed using either of these credentials</font>  <ul> <li><font size="2">Single Sign-on</font>  <li><font size="2">User-level credentials (aka Deployment Credentials)</font>  <li><font size="2">Site-level credentials&nbsp; (aka Publish Profile Credentials)</font></li></ul> <li><font size="2">Kudu site always connect to a single instance. E.g. If the site is hosted in an App Service plan which is scaled out to 3 instances, then at any time the KUDU will always connect to one instance only.</font></li></ul> <p>Here is a simple request flow of an Azure Web App  <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/11/image503.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/11/image_thumb418.png" width="616" height="340"></a></p></blockquote> <p><font size="2">The front-end uses <b>ARRAffinity</b> cookie to affinitize the request to specific instances. This cookie can be disabled if needed. Refer </font><a href="https://azure.microsoft.com/en-in/blog/disabling-arrs-instance-affinity-in-windows-azure-web-sites/"><font size="2">this</font></a><font size="2"> on how disable ARR Affinity. </font> <div><font size="2">The <b>ARRAffinity</b> cookie is unique and corresponds to an instance. If there are multiple instances, then there will be <b>ARRAffinity</b> cookie corresponding to those many instances.</font> <font size="2">So we can modify the <b>ARRAffinity</b> cookie in the HTTP response and force KUDU to connect to a specific instance. </font></div> <div>&nbsp;</div> <div><font size="2"><font size="4"><font face="Segoe UI Semibold"><u>PRE-REQUISITES</u></font>:</font> </font></div> <ul> <li><font size="2"><strong>Browser</strong>: Chrome/Firefox/Opera or any other browser which has extensions that allows you to edit cookies.</font>  <li><font size="2"><strong>Extension</strong>: <a href="https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg?hl=en">EditThisCookie (Chrome)</a> | <a title="https://addons.opera.com/en/extensions/details/edit-this-cookie/" href="https://addons.opera.com/en/extensions/details/edit-this-cookie/">EditThisCookie (Opera)</a></font></li></ul> <p><u><font size="4" face="Segoe UI Semibold">DETERMINE THE ARRAFFINITY COOKIE OF AN INSTANCE</font> </u> <ul> <li><font size="2">Browse to </font><a href="https://resources.azure.com/"><font size="2">https://resources.azure.com/</font></a><font size="2"> (Azure Resource Explorer) </font> <li><font size="2">In the search window enter the name of the web app. See the following screenshot for reference:</font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/11/image504.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/11/image_thumb419.png" width="1028" height="487"></a></p></blockquote> <ul> <li><font size="2">If there are other Azure resources with similar names, select the resource of type “<b>Microsoft.Web/sites</b>” </font> <li><font size="2">In the left side panel, expand “<b>instances</b>” and this would load all the instances on which the web app is hosted. The instance name displayed is also the value of the <strong>ARRAffinity</strong> cookie. </font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/11/image505.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/11/image_thumb420.png" width="1026" height="498"></a></p></blockquote> <p><font size="2">In the above image the site kaushalp is scaled out to 2 instances. So we have 2 instance id’s which are beginning with:</font></p> <ol> <li><font size="2">bac64d </font> <li><font size="2">c2a879</font></li></ol> <p><u><font size="4" face="Segoe WP Semibold">CONNECT TO THE KUDU CONSOLE OF A SPECIFIC INSTANCE</font></u>  <ul> <li><font size="2">For this we need to have a tool which allows us to modify the cookies </font> <li><font size="2">There are multiple ways to do this. </font> <li><font size="2">I am using <b>EditThisCookie</b> extension in chrome browser. Here is the link to install this: </font><a href="https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg?hl=en"><font size="2">Install EditThisCookie</font></a><font size="2"> </font> <li><font size="2">Now, browse to the KUDU site of your web app: </font><a href="https://%3csitename%3e.scm.azurewebsites.net"><font size="2">https://&lt;sitename&gt;.scm.azurewebsites.net</font></a><font size="2"> (<i>replace &lt;sitename&gt; with name of the web app</i>) </font> <li><font size="2">Click on <strong>Environment</strong>. </font> <li><font size="2">Under <b>System info</b>, the “<b>instance id</b>” value determines the instance to which the KUDU is connected. In the screenshot below, the kudu site is connected to the instance whose <strong>short instance id</strong> is <strong>bac64d</strong>.</font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/11/image506.png"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2016/11/image507.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/11/image_thumb421.png" width="679" height="258"></a></font></a></p></blockquote> <ul> <li><font size="2">We can use one of the instances value we obtained via <b>ARM explorer</b> to force KUDU to connect to a specific site. <br>(Here we are connecting to the instance with the id beginning with “<b>bac64d</b>” ) </font> <li><font size="2">In the browser window click on <b>EditThisCookie </b><b><a href="https://msdnshared.blob.core.windows.net/media/2016/11/clip_image005.gif"><img title="clip_image005" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image005" src="https://msdnshared.blob.core.windows.net/media/2016/11/clip_image005_thumb.gif" width="19" height="19"></a></b>&nbsp; icon (next to the <b>Address bar)</b>. </font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/11/clip_image00617.jpg"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2016/11/clip_image00618.jpg"><img title="clip_image006" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image006" src="https://msdnshared.blob.core.windows.net/media/2016/11/clip_image006_thumb14.jpg" width="621" height="103"></a></font></a></p></blockquote> <ul> <li><font size="2">In the pop-up, click on <strong>ARRAffinity</strong> </font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/11/clip_image0071.jpg"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2016/11/clip_image0072.jpg"><img title="clip_image007" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="clip_image007" src="https://msdnshared.blob.core.windows.net/media/2016/11/clip_image007_thumb1.jpg" width="620" height="226"></a></font></a></p></blockquote> <ul> <li><font size="2">Replace the value with the instance id that you need to connect to</font></li></ul> <blockquote> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/11/image508.png"><font size="2"><a href="https://msdnshared.blob.core.windows.net/media/2016/11/image509.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/11/image_thumb422.png" width="591" height="525"></a></font></a></p></blockquote> <ul> <li><font size="2">Click on the<strong> tick mark</strong> to save the cookie and then refresh the page. </font></li></ul> <p><font size="2">It should have connected to other instance. To confirm, browse to <strong>Environment </strong>and under <strong>System Info </strong>the value of Instance id should match the value that was entered earlier.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Azure Web Apps: How to retrieve user email in the claim when using Microsoft Account as a provider in Easy Auth</title>
      <link>https://docs.microsoft.com/archive/blogs/kaushal/azure-web-apps-how-to-retrieve-user-email-in-the-claim-when-using-microsoft-account-as-a-provider-in-easy-auth</link>
      <pubDate>Fri, 01 Apr 2016 16:03:13 GMT</pubDate>
      <dc:creator><![CDATA[Kaushal Kumar Panday]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/kaushal/?p=1021</guid>
      <description><![CDATA[App Service Authentication/Authorization also known as Easy Auth is one of the widely used feature...]]></description>
      <content:encoded><![CDATA[<span style="font-family: segoe ui"><span style="font-size: small"><a href="https://docs.microsoft.com/en-in/azure/app-service/app-service-authentication-overview?toc=%2fazure%2fapp-service-web%2ftoc.json"><strong>App Service Authentication/Authorization </strong></a>also known as<strong> Easy Auth</strong> is one of the widely used feature in <strong>Azure App Service</strong>. It reduces the burden on the developers and provides a way for the application to sign in users without changing code. It is implemented as a module and is injected at runtime within the app. It automates a lot of configuration which usually is a tedious task. It is a one time process where the users have to configure the web app to use one or more of the identity providers. Following is a list of providers currently supported with this module:
</span></span>
<ul>
 	<li><span style="font-family: segoe ui"><span style="font-size: small"><strong>Azure Active Directory (AAD)</strong> </span></span></li>
 	<li><span style="font-family: segoe ui"><span style="font-size: small"><strong>Facebook</strong> </span></span></li>
 	<li><span style="font-family: segoe ui"><span style="font-size: small"><strong>Google</strong> </span></span></li>
 	<li><span style="font-family: segoe ui"><span style="font-size: small"><strong>Twitter</strong> </span></span></li>
 	<li><span style="font-family: segoe ui"><span style="font-size: small"><strong>Microsoft Account (microsoftaccount)</strong> </span></span></li>
</ul>
<span style="font-size: small;font-family: segoe ui">Refer the following article to configure your web application to use Microsoft account as the auth provider.
</span>
<p style="padding-left: 30px"><a href="https://docs.microsoft.com/en-in/azure/app-service-mobile/app-service-mobile-how-to-configure-microsoft-authentication?toc=%2fazure%2fapp-service-web%2ftoc.json" title="https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-how-to-configure-microsoft-authentication/"><span style="font-size: small;font-family: segoe ui">How to configure your App Service application to use Microsoft Account login</span></a><span style="font-size: small;font-family: segoe ui"> </span></p>
<span style="font-size: small;font-family: segoe ui">Multiple providers can be configured for a single web app. For this, in portal set the</span>

<span style="font-size: small;font-family: segoe ui">"<strong>Action to take when request is not authenticated</strong>"<strong> </strong>= “<strong>Allow request (no action)</strong>”. </span>

<span style="font-size: small;font-family: segoe ui">This is also known as <strong>deferred authentication</strong>. In this case the providers from the app have to be called explicitly and the application will consume it based on the obtained claim. The following table illustrates the api endpoint which is used to invoke certain calls.  </span>
<table style="height: 110px;margin-left: 50px;background-color: #00bdff;border-style: solid;border-color: #0775BD" width="597" cellspacing="0" cellpadding="0" border="3">
<tbody>
<tr>
<td width="128" valign="top"><span style="font-size: small;font-family: segoe ui"><strong><span style="color: #ffffff"> <span style="color: #000000">Login End Point</span></span></strong></span></td>
<td width="465">  <span style="font-size: small;font-family: consolas;color: #0000ff;background-color: #ffffff"><span style="color: #000000">/.auth/login/</span><span style="color: #c0504d">&lt;provider&gt;<span style="font-family: Consolas;font-size: small"> </span></span></span></td>
</tr>
<tr>
<td width="132" valign="top"></td>
<td width="472" valign="top"><span style="font-size: small;font-family: segoe ui">  <span style="font-family: consolas;color: #0000ff;background-color: #ffffff"><span style="color: #000000">/.auth/login/</span><span style="color: #c0504d">&lt;provider<span style="color: #000000">&gt;</span></span><span style="color: #000000">?post_login_redirect_uri=</span><span style="color: #c0504d">&lt;url-path&gt;<span style="font-family: Consolas;font-size: small"> </span></span></span></span></td>
</tr>
<tr>
<td width="133" valign="top"><span style="font-size: small;font-family: segoe ui"><strong><span style="color: #ffffff"> <span style="color: #000000">Logout End point</span></span></strong></span></td>
<td width="473" valign="top">  <span style="color: #000000;font-family: consolas;font-size: small;background-color: #ffffff">/.auth/logout<span style="font-family: Consolas;font-size: small"> </span></span></td>
</tr>
<tr>
<td width="134" valign="top"></td>
<td width="473" valign="top"><span style="font-size: small;font-family: segoe ui">  <span style="font-family: consolas;color: #0000ff;background-color: #ffffff"><span style="color: #000000">/.auth/logout?post_logout_redirect_uri</span><span style="color: #c0504d"><span style="color: #000000">=</span>&lt;url-path&gt;<span style="font-family: Consolas;font-size: small"> </span></span></span></span></td>
</tr>
<tr>
<td width="134" valign="top"><strong><span style="color: #ffffff;font-family: Segoe UI;font-size: small"> <span style="color: #000000">Token Access</span></span></strong></td>
<td width="473" valign="top">  <span style="color: #000000;font-family: consolas;font-size: small;background-color: #ffffff">/.auth/me<span style="font-family: Consolas;font-size: small"> </span></span></td>
</tr>
</tbody>
</table>
<p style="padding-left: 30px"><span style="font-size: small;font-family: segoe ui"><strong><span style="font-family: consolas;color: #0000ff;background-color: #cccccc">&lt;providers&gt;</span></strong> can be set to <strong>aad</strong>, <strong>facebook</strong>, <strong>google</strong>, <strong>twitter </strong>&amp; <strong>microsoftaccount</strong>. Here is an example:</span></p>
<p style="padding-left: 30px"><a href="https://easyauth.kaushalz.com/.auth/login/microsoftaccount?post_login_redirect_url=/" title="https://easyauth.kaushalz.com/.auth/login/microsoftaccount?post_login_redirect_url=/"><span style="font-family: segoe ui"><span style="font-size: small">https://easyauth.kaushalz.com/.auth/login/<span style="background-color: #ffff00">microsoftaccount</span>?<span style="background-color: #ffff00">post_login_redirect_url=/</span></span></span></a></p>

<table style="height: 55px;margin-left: 50px" width="610" cellspacing="0" cellpadding="0" border="3">
<tbody>
<tr>
<td width="529" valign="top"><span style="font-size: small;font-family: segoe ui"><span style="font-family: segoe ui"><span style="font-size: small"><strong>NOTE</strong></span></span>:<em> The query string parameter</em> <span style="font-size: small;font-family: segoe ui"><span style="font-family: consolas;color: #0000ff;background-color: #cccccc">post_login_redirect_uri</span></span> <em>redirects the user request to the value specified in url path. </em></span><span style="font-size: small;font-family: segoe ui"><em>In the above example url, post successful authentication, the users will be redirected to the root of the application</em>.
</span></td>
</tr>
</tbody>
</table>
<h1>Adding users email address to the Claim<span style="font-family: segoe ui"></span></h1>
<span style="font-size: small;font-family: segoe ui">By default, the claim which is obtained from <strong>Microsoft Account</strong> provider doesn’t contain the users email address. Here is a how the default user claims obtained from MSA looks like</span>
<p style="padding-left: 60px"><a href="https://msdnshared.blob.core.windows.net/media/2016/04/image37.png"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" title="image" src="https://msdnshared.blob.core.windows.net/media/2016/04/image_thumb36.png" alt="image" width="605" border="0" height="583" /></a></p>
<span style="font-size: small;font-family: segoe ui">To add the email address as part of the claim the following scopes have to be enabled:</span>
<ul>
 	<li><strong><span style="font-size: small;font-family: segoe ui">wl.basic </span></strong></li>
 	<li><span style="font-family: segoe ui"><span style="font-size: small"><strong>wl.emails</strong> </span></span></li>
</ul>
<table style="height: 29px;margin-left: 50px" width="610" cellspacing="0" cellpadding="0" border="3">
<tbody>
<tr>
<td width="494" valign="top"><span style="font-family: segoe ui"><span style="font-size: small"><strong>NOTE</strong>: The token can be obtain by calling the following endpoint <span style="font-family: consolas;color: #0000ff;background-color: #cccccc">/.auth/me</span></span></span></td>
</tr>
</tbody>
</table>
<span style="font-size: small;font-family: segoe ui">Refer the following steps on how to configure this via the Azure portal
</span>
<ul>
 	<li><span style="font-size: small;font-family: segoe ui">Log-in to Azure portal: </span><a href="https://portal.azure.com"><span style="font-size: small;font-family: segoe ui">https://portal.azure.com</span></a><span style="font-size: small;font-family: segoe ui"> </span></li>
 	<li><span style="font-size: small;font-family: segoe ui">Click on <strong>App Service</strong> &amp; select the web app
</span></li>
 	<li><span style="font-size: small;font-family: segoe ui">Under <strong>Settings</strong> blade, click on <strong>Authentication/Authorization</strong> (This will launch another blade for this feature</span></li>
 	<li><span style="font-size: small;font-family: segoe ui">In here, configure the following
</span>
<ol>
 	<li><span style="font-size: small;font-family: segoe ui">Set App Service Authentication to <strong>On</strong></span></li>
 	<li><span style="font-size: small;font-family: segoe ui">Under Authentication providers, click on <strong>Microsoft Account</strong>.</span></li>
 	<li><span style="font-size: small;font-family: segoe ui">Click on <strong> <span style="color: #0000ff"><span style="font-family: consolas;background-color: #cccccc">wl.basic</span></span> &amp; <span style="color: #0000ff"><span style="font-family: consolas;background-color: #cccccc">wl.emails</span></span></strong> to enable them </span><span style="font-size: small;font-family: segoe ui">(Refer the following screenshot)</span></li>
</ol>
</li>
</ul>
<p style="padding-left: 60px"><a href="https://msdnshared.blob.core.windows.net/media/2016/04/image38.png"><span style="font-size: small;font-family: segoe ui"><img style="padding-top: 0px;padding-left: 0px;margin: 1px;padding-right: 0px;border-width: 0px" title="image" src="https://msdnshared.blob.core.windows.net/media/2016/04/image_thumb37.png" alt="image" width="1020" border="0" height="847" /></span></a></p>

<ul>
 	<li><span style="font-size: small;font-family: segoe ui">Click on <strong>OK</strong> and then click on <strong>Save</strong>. </span></li>
</ul>
<span style="font-size: small;font-family: segoe ui">When the users try to login again, the application will notify the user that it needs permissions so that the application can retrieve users email address. This happens for the first time.
</span>
<p style="padding-left: 60px"><a href="https://msdnshared.blob.core.windows.net/media/2016/04/image40.png"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" title="image" src="https://msdnshared.blob.core.windows.net/media/2016/04/image_thumb39.png" alt="image" width="415" border="0" height="446" /></a></p>
<span style="font-size: small;font-family: segoe ui">Upon giving permissions to the application, the <strong>users email address</strong> becomes part of the <strong>user_claims</strong>. Below is a screenshot for reference:</span>
<p style="padding-left: 60px"><a href="https://msdnshared.blob.core.windows.net/media/2016/04/image39.png"><span style="font-size: small;font-family: segoe ui"><img style="padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px" title="image" src="https://msdnshared.blob.core.windows.net/media/2016/04/image_thumb38.png" alt="image" width="681" border="0" height="796" /></span></a></p>

<table style="height: 24px;margin-left: 50px" width="610" cellspacing="0" cellpadding="0" border="3">
<tbody>
<tr>
<td width="494" valign="top"><span style="font-family: segoe ui"><span style="font-size: small"><strong>NOTE</strong>: I used Chrome browser with the <strong>JSON Formatter </strong>extension installed to see the claim </span></span></td>
</tr>
</tbody>
</table>
&nbsp;

<span style="text-decoration: underline"><strong><span style="font-size: small;font-family: segoe ui">MORE INFORMATION:</span></strong></span>

<span style="font-size: small;font-family: segoe ui">In case the application is not hosted on Azure App Service, please refer the following thread on Stackoverflow on how to do this for your application.</span>

<span style="font-size: small;font-family: segoe ui"><a href="http://stackoverflow.com/questions/17168353/getting-email-from-oauth-authentication-microsoft?lq=1">http://stackoverflow.com/questions/17168353/getting-email-from-oauth-authentication-microsoft?lq=1</a><strong>
</strong></span>

<span style="font-size: small;font-family: segoe ui"> </span>]]></content:encoded>
    </item>
  </channel>
</rss>