<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>CollabWire</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/israelo/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/israelo/feed.xml</link>
    <description>Thoughts on cloud computing and enterprise collaboration</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:31:11 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Streaming IoT Telemetry to Azure Event Hub:Part 3</title>
      <link>https://docs.microsoft.com/archive/blogs/israelo/streaming-iot-telemetry-to-azure-event-hubpart-3</link>
      <pubDate>Tue, 05 Jan 2016 03:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Israel Ogbole]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/israelo/2016/01/05/streaming-iot-telemetry-to-azure-event-hubpart-3/</guid>
      <description><![CDATA[This blog post is a continuation of Streaming IoT Telemetry to Azure Event Hub:Part 2. This is the...]]></description>
      <content:encoded><![CDATA[<span style="font-size: medium;font-family: 'courier new', courier">This blog post is a continuation of <a title="Streaming IoT Telemetry to Azure Event Hub:Part 2" href="https://blogs.technet.microsoft.com/israelo/2016/01/05/streaming-iot-telemetry-to-azure-event-hubpart-2/" target="_blank">Streaming IoT Telemetry to Azure Event Hub:Part 2</a>. This is the <a title="Streaming IoT Telemetry to Azure Event Hub : Part 1" href="https://blogs.technet.microsoft.com/israelo/2016/01/04/streaming-iot-telemetry-to-azure-event-hub-part-1/" target="_blank">link</a> to part 1 of the series. </span>
<h3><strong><span style="font-family: 'courier new', courier;font-size: large">The IoT Gateway</span></strong></h3>
<span style="font-family: 'courier new', courier;font-size: medium">Making reference to the project flow one last time,</span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/8867.IOTFlow.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/8867.IOTFlow.png" alt=" " width="596" height="215" border="0" /></a>

<span style="font-family: 'courier new', courier;font-size: medium">The implementation of the IOT Gateway is based on the Azure Event Hubs REST API's "Send Event" endpoint.  </span>

<span style="font-family: 'courier new', courier;font-size: medium">The endpoint is in this format: </span>
<pre><span style="font-family: 'courier new', courier;font-size: 9"><code style="color: #000000"> https://{serviceNamespace}.servicebus.windows.net/{eventHubPath}/publishers/{deviceName}/messages  
</code></span></pre>
<span style="font-family: 'courier new', courier;font-size: medium">In my case:</span>
<pre><span style="font-size: 9;font-family: 'courier new', courier"><code style="color: #000000"> https://ioteh-ns.servicebus.windows.net/ioteh/publishers/dhtxx/messages   
</code></span></pre>
<div><span style="font-size: medium;font-family: 'courier new', courier">The deviseName (dhtxx) can literally be anything, it can't be left null though. </span></div>
<span style="font-family: 'courier new', courier;font-size: medium">Further, the send event endpoint accepts JSON-encoded string. The POST request should have the following headers: </span>
<ul>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Timeout : This can be set to 2 sec or 3 sec -  depending on what works best for you </span></li>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Content-Type : application/json</span></li>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Authorization : The generated </span><span style="font-family: 'courier new', courier;font-size: medium">SharedAccessSignature token value. </span></li>
</ul>

<h3><strong><span style="font-size: medium;font-family: 'courier new', courier">Generating Event Hubs SharedAccessSignature </span></strong></h3>

<span style="font-family: 'courier new', courier;font-size: medium">If you recall from the previous blog, we created a Shared Access policy called <a title="Sender Policy " href="/b/israelo/archive/2015/12/29/streaming-iot-telemetry-to-azure-event-hub-part-2.aspx#send" target="_blank">DHTsender</a> in the Event Hub configuration tab: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6305.DHTSender.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6305.DHTSender.png" alt=" " width="778" height="433" border="0" /></a> </span>

<span style="font-family: 'courier new', courier;font-size: medium">Copy the key to somewhere safe. </span>

<span style="font-family: 'courier new', courier;font-size: medium">Next,download Sandrino's <a title="Signature Generator" href="https://github.com/sandrinodimattia/RedDog/releases/tag/0.2.0.1" target="_blank">RedDog Signature Generator</a>, then follow the steps to generate a SharedAccessSignature signature: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Event_Hubs_-_Signature_Generator_and_Service_Bus_-_Microsoft_Azure.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Event_Hubs_-_Signature_Generator_and_Service_Bus_-_Microsoft_Azure.png" alt=" " width="576" height="242" border="0" /></a>
</span>

<span style="font-size: medium;font-family: 'courier new', courier">I used 5 years TTL because I don't want to regenerate this signature any time sooner; your mileage may differ. </span>
<h3><strong><span style="font-size: medium;font-family: 'courier new', courier">The Implementation </span></strong></h3>
<span style="font-size: medium;font-family: 'courier new', courier">First, this is the pseudocode so you can easily translate it to any programming language of choice:</span>

<!-- HTML generated using hilite.me -->
<div style="background: #ffffff;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em;font-size: medium">
<pre style="margin: 0;line-height: 125%"><span style="color: #aaaaaa;font-style: italic">// main method </span>
<span style="color: #0000aa">int</span> send_event () { 
SERVICE_NAMESPACE = <span style="color: #aa5500">'ioteh-ns'</span>
EVENT_HUB_NAME = <span style="color: #aa5500">'ioteh'</span>
PUBLISHER_NAME = <span style="color: #aa5500">'dhtxx'</span> 
EVENT_HUB_SIGNATURE = <span style="color: #aa5500">'change_me'</span>
API_ENDPOINT = <span style="color: #aa5500">"https://#{SERVICE_NAMESPACE}.servicebus.windows.net/#{EVENT_HUB_NAME}/publishers/#{PUBLISHER_NAME}/messages"</span>

<span style="color: #aaaaaa;font-style: italic">// define headers </span>
HTTP.Headers.ConnectionTimeout = <span style="color: #009999">60</span>
HTTP.Headers.Content-Type =  <span style="color: #aa5500">'application/json'</span>
HTTP.Headers.Authorization = #{EVENT_HUB_SIGNATURE}

<span style="color: #aaaaaa;font-style: italic">//body of message </span>
HTTP.body = telemetry_data 
<span style="color: #aaaaaa;font-style: italic">//Send it </span>
HTTP.POST (API_ENDPOINT) 

If HTTP.RESPONSE.StatusCode == <span style="color: #009999">201</span>
<span style="color: #aaaaaa;font-style: italic">// successfully sent event to Azure Event Hubs </span>
Else 
<span style="color: #aaaaaa;font-style: italic">// print HTTP.RESPONSE.StatusCode  </span>
<span style="color: #aaaaaa;font-style: italic">// print HTTP.RESPONSE.Body </span>
<span style="color: #0000aa">return</span> HTTP.RESPONSE.StatusCode 
} 

<span style="color: #aaaaaa;font-style: italic">// method  </span>
<span style="color: #00aaaa">String</span> telemetry_data() {
<span style="color: #aaaaaa;font-style: italic">//this method receives telemetry  data from IOT</span>
<span style="color: #aaaaaa;font-style: italic">// you will need to convert telemetry to json if you're not sending it in json format from IoT </span>
<span style="color: #aaaaaa;font-style: italic">// sample data: https://gist.github.com/iogbole/8af14091e801d6352cf2</span>

<span style="color: #0000aa">return</span> telemetry_json_format 
} 
</pre>
</div>
<!--end -->

<span style="font-family: 'courier new', courier;font-size: medium">I did my implementation in ruby on rails. This is the <a href="https://github.com/iogbole/iot_gateway" target="_blank">GitHub repo</a> and the main classes are <a href="https://github.com/iogbole/iot_gateway/blob/master/lib/azure_envent_hub_service.rb" target="_blank">azure_envent_hub_service.rb</a> and <a href="https://github.com/iogbole/iot_gateway/blob/master/app/controllers/dhts_controller.rb#L36" target="_blank">dhts_controller.rb</a> respectively. </span>
<h3><span style="font-family: 'courier new', courier;font-size: medium"><strong>Deploying the IoT Gateway</strong>
</span></h3>
<span style="font-family: 'courier new', courier;font-size: medium">I deployed the rails app to a CentOS server running on Azure VM. I opened up port 3000 (because I reserved port 80 for something else). To address the HTTP ONLY security concern, I configured <a href="https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-set-up-endpoints/" target="_blank">ACL</a> to only permit traffic from my home network IP address, that way no one outside my home network can read/send garbage from/to my application.</span><span style="font-family: 'courier new', courier;font-size: medium"> </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Virtual_machines_-_Microsoft_Azure.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Virtual_machines_-_Microsoft_Azure.png" alt=" " width="826" height="349" border="0" /></a>
</span>

<span style="font-size: medium;font-family: 'courier new', courier">The disadvantage with the ACL rule approach is, my router's public IP may change if restarted. </span>

<span style="font-size: medium;font-family: 'courier new', courier">Also, note the "/32" in the remote subnet; it is a hack (if you like) to comply with CIDR format if using a single IP address.</span>
<h3><strong style="font-size: small"><span style="font-family: 'courier new', courier"><span style="font-size: large">Analytics!</span> </span></strong></h3>
<span style="font-family: 'courier new', courier;font-size: medium">It's finally time to do some interesting analytics!</span>

<span style="font-family: 'courier new', courier;font-size: medium">To do this, we'd need to create a second stream analytics job called <em><strong>DHTAnalytics</strong></em> with two outputs - first out goes to SQL database and the second goes to PowerBI. </span>

<span style="font-family: 'courier new', courier;font-size: medium">DHTAnalytics job: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/5621.1.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/5621.1.png" alt=" " width="906" height="479" border="0" /></a>
</span>

<span style="font-family: 'courier new', courier;font-size: medium">Once created, add an Input by navigating to Input -&gt; Add Input -&gt; Data Stream -&gt; Event Hub; use <em>DHTStreamAnalytics</em> as the alias. </span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/5710.4.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/5710.4.png" alt=" " width="833" height="689" border="0" /></a>

<span style="font-family: 'courier new', courier;font-size: medium">Next, add an SQL Database OUTPUT; use </span><span style="font-family: 'courier new', courier;font-size: medium"><em>DHTAnalyticsDBOutput</em> as the alias and <em>DHTAnalytics</em> as the table name. </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4705.12.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4705.12.png" alt=" " width="747" height="651" border="0" /></a> </span>

<span style="font-family: 'courier new', courier;font-size: medium">Next,create a Power BI Output; Add Output -&gt; Select Power BI. Once authenticated, use </span><span style="font-family: 'courier new', courier;font-size: medium">DhtPowerBIOutput as the alias and whatever you like for the dataset name and table name: </span>

<span style="font-family: 'courier new', courier;font-size: medium">In all, your setup should look like: </span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/13.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/13.png" alt=" " width="621" height="164" border="0" /></a>

<span style="font-family: 'courier new', courier;font-size: medium">Finally, copy/paste this query into the QUERY text area. </span>

<!-- HTML generated using hilite.me -->
<div style="background: #ffffff;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em">
<pre style="margin: 0;line-height: 125%"><span style="color: #0000aa">SELECT</span>
    DateAdd(<span style="color: #0000aa">second</span>,-<span style="color: #009999">15</span>,<span style="color: #0000aa">System</span>.<span style="color: #0000aa">TimeStamp</span>) <span style="color: #0000aa">as</span> startTime,
    <span style="color: #0000aa">system</span>.<span style="color: #0000aa">TimeStamp</span> <span style="color: #0000aa">as</span> endTime,
    chipid,
    <span style="color: #0000aa">Avg</span>(heat_index) <span style="color: #0000aa">as</span> avgHeatIndex,
    <span style="color: #0000aa">Avg</span>(temperature) <span style="color: #0000aa">as</span> avgTemperature,
    <span style="color: #0000aa">Avg</span>(humidity) <span style="color: #0000aa">as</span> avgHumidity,
    <span style="color: #0000aa">Count</span>(*) <span style="color: #0000aa">as</span> totalCount
 <span style="color: #0000aa">INTO</span> dhtanalyticsdboutput
<span style="color: #0000aa">FROM</span> DHTStreamAnalytics
<span style="color: #0000aa">GROUP</span> <span style="color: #0000aa">BY</span> TumblingWindow(hour, <span style="color: #009999">1</span>), chipid

<span style="color: #0000aa">SELECT</span>
    DateAdd(<span style="color: #0000aa">second</span>,-<span style="color: #009999">15</span>,<span style="color: #0000aa">System</span>.<span style="color: #0000aa">TimeStamp</span>) <span style="color: #0000aa">as</span> startTime,
    <span style="color: #0000aa">system</span>.<span style="color: #0000aa">TimeStamp</span> <span style="color: #0000aa">as</span> endTime,
    chipid,
    <span style="color: #0000aa">Avg</span>(heat_index) <span style="color: #0000aa">as</span> avgHeatIndex,
    <span style="color: #0000aa">Avg</span>(temperature) <span style="color: #0000aa">as</span> avgTemperature,
    <span style="color: #0000aa">Avg</span>(humidity) <span style="color: #0000aa">as</span> avgHumidity,
    <span style="color: #0000aa">Count</span>(*) <span style="color: #0000aa">as</span> totalCount
<span style="color: #0000aa">INTO</span> dhtpowerbioutput
<span style="color: #0000aa">FROM</span> DHTStreamAnalytics
<span style="color: #0000aa">GROUP</span> <span style="color: #0000aa">BY</span> TumblingWindow(hour, <span style="color: #009999">1</span>), chipid
</pre>
</div>
<!--end -->

<span style="font-size: medium;font-family: 'courier new', courier">Note that the <a href="https://msdn.microsoft.com/en-us/library/azure/dn949330.aspx" target="_blank">INTO clause</a> is used to direct output to the DB and PowerBI outputs respectively. Directing outputs with a query is basically what you'd need to do if you have multiple outputs for one stream analytics job. Admittedly, it took me a while to figure that out. </span>

<span style="font-size: medium;font-family: 'courier new', courier">Also, note that I am using a Tumbling Window of 1 hour, so I'd expect IoT to send ≈6 readings in a window. </span>

<span style="font-size: medium;font-family: 'courier new', courier">Start the Job! </span>
<h3><span style="font-size: large"><strong style="font-family: 'courier new', courier;font-size: medium">The Result</strong><span style="font-family: 'courier new', courier"> </span></span></h3>
<span style="font-family: 'courier new', courier;font-size: medium">Connect Arduino VIN pin to a 5.5v power supply and watch your hard work pay off! </span>

<span style="font-family: 'courier new', courier;font-size: large"><strong>PowerBI Output</strong></span>

<strong><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Screen%20Shot%202016-01-05%20at%2010.52.42.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Screen%20Shot%202016-01-05%20at%2010.52.42.png" alt=" " width="585" height="594" border="0" /></a></strong>

<span style="font-family: 'courier new', courier;font-size: medium">and</span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Screen%20Shot%202016-01-05%20at%2011.00.30.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Screen%20Shot%202016-01-05%20at%2011.00.30.png" alt=" " width="585" height="425" border="0" /></a>

<span style="font-size: medium;font-family: 'courier new', courier">Clearly, I have high humidity problem. </span>

<span style="font-size: large"><strong><span style="font-family: 'courier new', courier">SQL Output </span></strong></span>

<!-- HTML generated using hilite.me -->
<div style="background: #ffffff;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em">
<pre style="margin: 0;line-height: 125%"><span style="color: #0000aa">select</span> * <span style="color: #0000aa">from</span> DHTAnalytics <span style="color: #0000aa">order</span> <span style="color: #0000aa">by</span> endTime <span style="color: #0000aa">DESC</span> ;
<span style="color: #0000aa">select</span> * <span style="color: #0000aa">from</span> DHTReadings <span style="color: #0000aa">order</span> <span style="color: #0000aa">by</span> created_at <span style="color: #0000aa">DESC</span>;
</pre>
</div>
<!--end -->

<span style="font-size: large"><strong><span style="font-family: 'courier new', courier"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/DB%20output.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/DB%20output.png" alt=" " width="577" height="366" border="0" /></a> </span></strong></span>

<span style="font-size: large"><strong><span style="font-family: 'courier new', courier">Arduino Output <span style="font-size: small">(before unplugging it from USB)</span>: </span></strong></span>

<span style="font-size: large"><strong><span style="font-family: 'courier new', courier"> <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/_dev_cu_wchusbserial1410_and_DHTSerial_7___Arduino_1_6_6.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/_dev_cu_wchusbserial1410_and_DHTSerial_7___Arduino_1_6_6.png" alt=" " width="529" height="439" border="0" /></a></span></strong></span><span style="font-family: 'courier new', courier;font-size: medium"> </span>

<span style="font-family: 'courier new', courier;font-size: medium">The end :) </span>

<span style="font-family: 'courier new', courier;font-size: medium"><strong>What's next?</strong> </span>

<span style="font-family: 'courier new', courier;font-size: medium">I ordered 2 of this <a title="Relay Module" href="https://www.aliexpress.com/item/1-Channel-5V-Relay-Module-Low-level-for-SCM-Household-Appliance-Control-FREE-SHIPPING-For-Arduino/32264904823.html" target="_blank">Relay Module</a>. Once they arrive I will hook it up to an extension box so I can control our De/Humidifier depending on the sensor readings. That is, if average humidity readings over X period of time is greater than %Y or lower than %Z turn it ON. Another idea is to be able to turn our heater ON/OFF from my mobile using one of those relay modules.  </span>

<strong style="font-size: small"><span style="font-family: 'courier new', courier">References :</span></strong>
<ul>
	<li><span style="font-size: small"><span style="font-family: 'courier new', courier"><a href="https://msdn.microsoft.com/en-us/library/azure/dn790664.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/azure/dn790664.aspx</a> </span><span style="font-family: 'courier new', courier"> </span></span></li>
	<li><a href="https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-set-up-endpoints/" target="_blank"><span style="font-size: small"><span style="font-family: 'courier new', courier">https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-set-up-endpoints/</span></span></a></li>
	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/stream-analytics-define-outputs/" target="_blank"><span style="font-size: small"><span style="font-family: 'courier new', courier">https://azure.microsoft.com/en-us/documentation/articles/stream-analytics-define-outputs/</span></span></a></li>
	<li><a href="https://msdn.microsoft.com/en-us/library/azure/dn949330.aspx" target="_blank"><span style="font-size: small"><span style="font-family: 'courier new', courier">https://msdn.microsoft.com/en-us/library/azure/dn949330.aspx</span></span></a></li>
</ul>


<p style="padding-left: 330px"><a href="https://twitter.com/intent/tweet?screen_name=israel_ogbole" class="twitter-mention-button">Tweet to @israel_ogbole</a><script src="//platform.twitter.com/widgets.js"></script></p>
[bing_translator]]]></content:encoded>
    </item>
    <item>
      <title>Streaming IoT Telemetry to Azure Event Hub:Part 2</title>
      <link>https://docs.microsoft.com/archive/blogs/israelo/streaming-iot-telemetry-to-azure-event-hubpart-2</link>
      <pubDate>Tue, 05 Jan 2016 01:52:00 GMT</pubDate>
      <dc:creator><![CDATA[Israel Ogbole]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/israelo/2016/01/05/streaming-iot-telemetry-to-azure-event-hubpart-2/</guid>
      <description><![CDATA[This blog post is a continuation of Streaming IoT Telemetry to Azure Event Hub : Part 1. 
Event...]]></description>
      <content:encoded><![CDATA[<span style="font-family: 'courier new', courier;font-size: medium">This blog post is a continuation of <a title="Streaming IoT Telemetry to Azure Event Hub : Part 1" href="https://blogs.technet.microsoft.com/israelo/2016/01/04/streaming-iot-telemetry-to-azure-event-hub-part-1/" target="_blank">Streaming IoT Telemetry to Azure Event Hub : Part 1</a>.</span><span style="font-family: 'courier new', courier;font-size: medium"> </span>
<h3><span style="font-size: large"><strong><span style="font-family: 'courier new', courier">Event Hubs and Stream Analytics</span></strong></span></h3>
<span style="font-family: 'courier new', courier;font-size: medium">Please refer to these <a title="https://azure.microsoft.com/en-gb/documentation/videos/azure-service-bus-event-hubs-101-with-dan-rosanova/" href="https://azure.microsoft.com/en-gb/documentation/videos/azure-service-bus-event-hubs-101-with-dan-rosanova/" target="_blank">tutorials</a> if you're completely new to Event Hubs. In a nutshell, Event Hub (EH) is a Microsoft Azure service that can accept millions of telemetry data from multiple devices per second. Once the data is in the hub, you can then store it and/or transubstantiate it using any real time analytics service, such as Azure Stream Analytics. </span>

<span style="font-family: 'courier new', courier;font-size: medium">Referring to the <a title="Part 1" href="/b/israelo/archive/2015/12/26/sending-iot-telemetries-to-azure-eventhub-for-dummies.aspx#p" target="_blank">problem statement</a> in part 1 of this blog series, I explained why we'd need an IoT Gateway to mediate between the IoT component (or event generators if you like) and Event Hub.</span>

<span style="font-family: 'courier new', courier;font-size: medium">This post focuses on how to set up Event Hub and how to use Stream Analytics to analyse the data in the hub at real time. The next blog demonstrates how you can send events from any application to Event Hubs using its APIs. Please take screenshots whilst you are creating the EH service because you're going to need the names of your services for the programming bit in the next blog.  </span>
<h3><strong><span style="font-family: 'courier new', courier;font-size: large">Create an Azure Database </span></strong></h3>
<span style="font-family: 'courier new', courier;font-size: medium">First, you'd need to create a Database from Azure Management portal</span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6685.1.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6685.1.png" alt=" " width="730" height="378" border="0" /></a>
</span>

<span style="font-family: 'courier new', courier;font-size: medium">Once the database has been created, you can either use the Visual Studio integration or any other DB management application. I am using DbVisualizer. I found that the integrated "Manage" feature doesn't always work well. To use DbVisualizer, you'd need to add your machine's IP address to DB's firewall rule; Dashboard -&gt; Manage Allowed IP addresses -&gt; </span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6683.2.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6683.2.png" alt=" " width="723" height="479" border="0" /></a>

<span style="font-family: 'courier new', courier;font-size: medium">Also, you'd need to download the SQL server</span><span style="font-family: 'courier new', courier"> </span><span style="font-family: 'courier new', courier"><a style="font-size: medium" href="https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;id=11774" target="_blank">JDBC connector</a> <span style="font-size: medium">and follow the instructions in DbVisualizer to complete the setup. </span></span>

<span style="font-size: medium;font-family: 'courier new', courier">Create the DHTReadings and DHTAnalytics tables with their respective clustered indexes:</span>

<!-- HTML generated using hilite.me -->
<div style="background: #ffffff;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em">
<pre style="margin: 0;line-height: 125%"><span style="color: #0000aa">CREATE</span> <span style="color: #0000aa">TABLE</span> DHTAnalytics (chipid <span style="color: #00aaaa">INT</span> <span style="color: #0000aa">NOT</span> <span style="color: #0000aa">NULL</span>, startTime DATETIME, endTime DATETIME,
 avgTemperature <span style="color: #00aaaa">FLOAT</span>(<span style="color: #009999">53</span>), avgHumidity <span style="color: #00aaaa">FLOAT</span>(<span style="color: #009999">53</span>), avgHeatIndex <span style="color: #00aaaa">FLOAT</span>(<span style="color: #009999">53</span>), totalCount <span style="color: #00aaaa">BIGINT</span>);
 
<span style="color: #0000aa">CREATE</span> CLUSTERED <span style="color: #0000aa">INDEX</span> chipid <span style="color: #0000aa">ON</span> DHTAnalytics (chipid); 

<span style="color: #0000aa">CREATE</span> <span style="color: #0000aa">TABLE</span> DHTReadings (chipid <span style="color: #00aaaa">INT</span> <span style="color: #0000aa">NOT</span> <span style="color: #0000aa">NULL</span>, <span style="color: #0000aa">location</span> <span style="color: #00aaaa">VARCHAR</span>(<span style="color: #009999">50</span>), description <span style="color: #00aaaa">VARCHAR</span>(<span style="color: #0000aa">MAX</span>),temperature <span style="color: #00aaaa">FLOAT</span>(<span style="color: #009999">53</span>) <span style="color: #0000aa">NOT</span> <span style="color: #0000aa">NULL</span>,
humidity <span style="color: #00aaaa">FLOAT</span>(<span style="color: #009999">53</span>) <span style="color: #0000aa">NOT</span> <span style="color: #0000aa">NULL</span>, heat_index <span style="color: #00aaaa">FLOAT</span>(<span style="color: #009999">53</span>), created_at DATETIME <span style="color: #0000aa">DEFAULT</span> getdate() <span style="color: #0000aa">NOT</span> <span style="color: #0000aa">NULL</span>);

<span style="color: #0000aa">CREATE</span> CLUSTERED <span style="color: #0000aa">INDEX</span> chipid <span style="color: #0000aa">ON</span> DHTReadings (chipid); 
</pre>
</div>
<!--end-->

<span style="font-family: 'courier new', courier;font-size: medium">DbVisualizer buffer execution output: </span>

<span style="font-size: medium"><strong><span style="font-family: 'courier new', courier"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/5123.DbVisualizer_Free_9_2_13.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/5123.DbVisualizer_Free_9_2_13.png" alt=" " width="785" height="308" border="0" /></a>
</span></strong></span>

<strong><span style="font-family: 'courier new', courier;font-size: large">Create and Configure an Event Hub:   </span></strong>

<span style="font-family: 'courier new', courier;font-size: medium">Creating an Event Hub from Azure management portal is also pretty straight forward. </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7215.Service_Bus_-_Microsoft_Azure_1.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7215.Service_Bus_-_Microsoft_Azure_1.png" alt=" " width="803" height="422" border="0" /></a>
</span>

<span style="font-family: 'courier new', courier;font-size: medium">Once created, go ahead and click on Configure, then create two policies with <a id="send"></a>send and full permissions as shown below: </span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/8880.Service_Bus_-_Microsoft_Azure_3.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/8880.Service_Bus_-_Microsoft_Azure_3.png" alt=" " width="824" height="663" border="0" /></a>

<strong><span style="font-family: 'courier new', courier;font-size: large">Create a Stream Analytics Job</span></strong>

<span style="font-family: 'courier new', courier;font-size: medium">From Azure management portal: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Stream_Analytics_-_Microsoft_Azure_1.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Stream_Analytics_-_Microsoft_Azure_1.png" alt=" " width="802" height="428" border="0" /></a></span>

<span style="font-size: medium;font-family: 'courier new', courier">Once it's been created, add an input to your job by clicking on Add Input -&gt; Data Stream -&gt; Event Hub -&gt;  </span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7612.Stream_Analytics_-_Microsoft_Azure_2.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7612.Stream_Analytics_-_Microsoft_Azure_2.png" alt=" " width="800" height="652" border="0" /></a>

<span style="font-family: 'courier new', courier;font-size: medium">Stream Analytics will now do some self checks to ensure it can connect to your Event Hub. Ensure you get a success before continuing! </span>

<span style="font-family: 'courier new', courier;font-size: medium">Next, add an output to your job, this is where telemetry data will be stored, the DHTReadings table. </span>
<p class="p1"><span class="s1" style="font-family: 'courier new', courier;font-size: medium">Navigate to OUTPUTS - &gt; Add Output -&gt; SQL Database - &gt; </span></p>
<p class="p1"><span class="s1"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Stream_Analytics_4.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Stream_Analytics_4.png" alt=" " width="824" height="726" border="0" /></a></span></p>
<span style="font-family: 'courier new', courier;font-size: medium">Finally, create a QUERY to select input fields from Stream Analytics input job, DHTEventHubConsumer; these are the fields in the DHTReadings table. </span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6646.Stream_Analytics_-_Microsoft_Azure_3.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6646.Stream_Analytics_-_Microsoft_Azure_3.png" alt=" " width="789" height="569" border="0" /></a>

<span style="font-size: medium;font-family: 'courier new', courier"> </span>

<span style="font-size: medium;font-family: 'courier new', courier">You may now go ahead and test what you've done so far with this test Data - <a href="https://gist.github.com/iogbole/8af14091e801d6352cf2" target="_blank">DHTReadings.json</a></span>

<span style="font-size: medium;font-family: 'courier new', courier">Click Test, upload the json file and it should display a nice output like this if your setup is correct:</span>

<span style="font-size: medium;font-family: 'courier new', courier"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Stream_Analytics_-_Microsoft_Azure_and_Downloads.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/Stream_Analytics_-_Microsoft_Azure_and_Downloads.png" alt=" " width="752" height="545" border="0" /></a></span><span style="font-family: 'courier new', courier;font-size: medium"> </span>

<span style="font-family: 'courier new', courier;font-size: medium">Congrats for coming this far, in the next blog we'll send data from IoT Gateway to Event Hub, query the DHTReadings table and we'll cap the project by doing some analytics with Power BI.  </span>

<span style="font-family: 'courier new', courier;font-size: medium">Next -&gt; <a title="Streaming IoT Telemetry to Azure Event Hub:Part 3" href="https://blogs.technet.microsoft.com/israelo/2016/01/05/streaming-iot-telemetry-to-azure-event-hubpart-3/">The IoT Gateway</a> </span>
<h1><span style="font-family: 'courier new', courier;font-size: medium">References: </span></h1>
<ul>
	<li><a href="https://azure.microsoft.com/en-gb/documentation/articles/event-hubs-csharp-ephcs-getstarted/ " target="_blank"><span style="font-family: 'courier new', courier;font-size: small">https://azure.microsoft.com/en-gb/documentation/articles/event-hubs-csharp-ephcs-getstarted/ </span></a></li>
	<li><a href="https://azure.microsoft.com/en-us/documentation/articles/stream-analytics-get-started/" target="_blank"><span style="font-family: 'courier new', courier;font-size: small">https://azure.microsoft.com/en-us/documentation/articles/stream-analytics-get-started/</span></a></li>
</ul>
<script src="https://c64.assets-yammer.com/assets/platform_social_buttons.min.js" type="text/javascript"></script>
<script type="text/javascript">// </script>


<p style="padding-left: 330px"><a href="https://twitter.com/intent/tweet?screen_name=israel_ogbole" class="twitter-mention-button">Tweet to @israel_ogbole</a><script src="//platform.twitter.com/widgets.js"></script></p>
[bing_translator]]]></content:encoded>
    </item>
    <item>
      <title>Streaming IoT Telemetry to Azure Event Hub : Part 1</title>
      <link>https://docs.microsoft.com/archive/blogs/israelo/streaming-iot-telemetry-to-azure-event-hub-part-1</link>
      <pubDate>Mon, 04 Jan 2016 12:55:00 GMT</pubDate>
      <dc:creator><![CDATA[Israel Ogbole]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/israelo/2016/01/04/streaming-iot-telemetry-to-azure-event-hub-part-1/</guid>
      <description><![CDATA[I had a need to remotely monitor temperature and humidity from my kid's room. I looked on ebay and...]]></description>
      <content:encoded><![CDATA[<span style="font-family: 'courier new', courier;font-size: medium">I had a need to remotely monitor temperature and humidity from my kid's room. I looked on ebay and amazon and I didn't find any suitable device that can read both temperature and humidity and send the data to the cloud(for analytics etc) at a reasonable price, so I decided to build one for £11.   </span>

<span style="font-family: 'courier new', courier;font-size: medium">This blog documents/describes the process of building a temperature and humidity sensor component, how to stream the sensor data to Microsoft Azure Event Hub, perform some analytics operations and react upon the data with respect to certain pre-defined thresholds. </span>

<span style="font-family: 'courier new', courier;font-size: medium">It was fun! </span>

<span style="font-family: 'courier new', courier;font-size: medium">This blog post is in three series: </span>
<ul>
 	<li><span style="font-family: 'courier new', courier;font-size: medium"><a target="_blank" href="https://blogs.technet.microsoft.com/israelo/2016/01/04/streaming-iot-telemetry-to-azure-event-hub-part-1/" title="Streaming IoT Telemetry to Azure Event Hub : Part 1">The project schematic and Arduino sketch </a> </span></li>
 	<li><span style="font-family: 'courier new', courier;font-size: medium"><a target="_blank" href="https://blogs.technet.microsoft.com/israelo/2016/01/05/streaming-iot-telemetry-to-azure-event-hubpart-2/" title="Streaming IoT Telemetry to Azure Event Hub:Part 2">Setting up Azure Event Hub to process telemetry </a> </span></li>
 	<li><span style="font-family: 'courier new', courier;font-size: medium"><a target="_blank" href="https://blogs.technet.microsoft.com/israelo/2016/01/05/streaming-iot-telemetry-to-azure-event-hubpart-3/" title="Streaming IoT Telemetry to Azure Event Hub:Part 3">Developing/Coding the IoT Gateway &amp; Result Analysis with PowerBI</a>
</span></li>
</ul>
<h3><strong><span style="font-family: 'courier new', courier;font-size: large"><a id="schematic"></a>The Schematic</span></strong></h3>
<span style="font-size: medium"><span style="font-family: 'courier new', courier">We'd need the following components: </span>
</span>
<ul>
 	<li><span style="font-family: 'courier new', courier;font-size: medium">Breadboard and jumper cables</span></li>
 	<li><span style="font-family: 'courier new', courier;font-size: medium">3.3V and 5V breadboard power supply unit</span></li>
</ul>
<p style="margin-left: 30px"><span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/12.JPG"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/12.JPG" alt=" " width="320" height="287" border="0" /></a>
</span></p>

<ul>
 	<li><span style="font-family: 'courier new', courier;font-size: medium">10KΩ resistor </span></li>
 	<li><span style="font-family: 'courier new', courier;font-size: medium">100µF capacitor </span></li>
 	<li><span style="font-family: 'courier new', courier;font-size: medium">ESP8266 Wifi Module</span></li>
</ul>
<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/ESP.jpg"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/ESP.jpg" alt=" " width="319" height="270" border="0" /></a>
</span>
<ul>
 	<li><span style="font-family: 'courier new', courier;font-size: medium">Arduino Uno Micro controller</span></li>
</ul>
<p style="margin-left: 30px"><span style="font-family: 'courier new', courier"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/uno.jpg"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/uno.jpg" alt=" " width="356" height="249" border="0" /></a></span></p>

<ul>
 	<li><span style="font-family: 'courier new', courier;font-size: medium">DHT22 Sensor </span></li>
</ul>
<p style="margin-left: 30px"><span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/DHT22.jpg"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/DHT22.jpg" alt=" " width="175" height="159" border="0" /></a></span></p>
<span style="font-family: 'courier new', courier;font-size: medium">I sourced all these components from <a target="_blank" href="https://www.aliexpress.com">aliexpress</a>. I waited for about 3 to 4 weeks for them to be delivered, the wait was worth it because my core objective was to complete this project on a tight budget.
</span>
<h4><strong><span style="font-family: 'courier new', courier;font-size: medium">Connecting the DOTS!</span></strong></h4>
<span style="font-family: 'courier new', courier;font-size: medium">This is a picture of my prototype connection</span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/DSCN0684.JPG"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/DSCN0684.JPG" alt=" " width="465" height="369" border="0" /></a>

<span style="font-family: 'courier new', courier;font-size: medium">and I made a </span><span style="font-family: 'courier new', courier;font-size: medium">schematic diagram of how I connected all the components for a clearer representation: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/ioFRIT_bb.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/ioFRIT_bb.png" alt=" " width="623" height="407" border="0" /></a></span>
<h3><strong style="font-size: 1.17em">The Arduino Sketch </strong></h3>
<span style="font-family: 'courier new', courier;font-size: medium">A <strong>sketch </strong>is the name that Arduino uses for its <strong>programs</strong>. </span>

<span style="font-family: 'courier new', courier;font-size: medium">First thing you may need to do is to flash your ESP8266 module with the latest AT firmware, I recommend using <a target="_blank" href="https://github.com/nodemcu/nodemcu-firmware">NodeMCU flasher</a>. </span>

<span style="font-family: 'courier new', courier;font-size: medium">Download and install the latest </span><a target="_blank" href="https://www.arduino.cc/en/Main/Software">Arduino IDE</a><span style="font-family: 'courier new', courier;font-size: medium"> if you have't done so. Then go to Tools -&gt; Boards and select "Arduino/Genuino Uno" and the port you're connected to. Once that's done, upload this sketch onto the micro controller to ensure your ESP and Uno can talk to each other. </span>

<!-- HTML generated using hilite.me -->
<div style="background: #ffffff;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em">
<pre style="margin: 0;line-height: 125%"><span style="color: #4c8317">#include &lt;SoftwareSerial.h&gt;</span>

SoftwareSerial <span style="color: #00aa00">wifiPort</span>(<span style="color: #009999">2</span>, <span style="color: #009999">3</span>);  <span style="color: #aaaaaa;font-style: italic">//Connect ESP Tx to Uno Pin 2, ESP Rx to Uno Pin 3</span>

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">setup</span>()  
{
  Serial.begin(<span style="color: #009999">9600</span>);
  <span style="color: #0000aa">while</span> (!Serial) {
  }
  wifiPort.begin(<span style="color: #009999">9600</span>); <span style="color: #aaaaaa;font-style: italic">// Most modern ESP-01 communicate at 9600 bps, change it if needed</span>

<span style="color: #00aaaa">void</span> loop() 
{

  wifiPort.listen();
  <span style="color: #0000aa">if</span> (wifiPort.available() ) {
    Serial.write(wifiPort.read());
  }
  <span style="color: #0000aa">if</span> (Serial.available() ){
    wifiPort.write(Serial.read());
  }
  delay(<span style="color: #009999">10</span>);
}
</pre>
</div>
<span style="font-family: 'courier new', courier;font-size: medium">You may test this out with these <a target="_blank" href="https://www.pridopia.co.uk/pi-doc/ESP8266ATCommandsSet.pdf">AT Commands</a>. Ensure you get this right before continuing! </span>

<span style="font-family: 'courier new', courier;font-size: medium">Let's advance our sketch a little bit. Go to thingspeak.com and create a channel &amp; two fields. Note your channel key. Then upload this sketch onto your micro controller - after updating the SSID, PASS and channel key values respectively.  </span>

<!-- HTML generated using hilite.me -->
<div style="background: #ffffff;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em">
<pre style="margin: 0;line-height: 125%"><span style="color: #4c8317">#include &lt;SoftwareSerial.h&gt;</span>
<span style="color: #4c8317">#define SSID "changeme"</span>
<span style="color: #4c8317">#define PASS "changeme"</span>
<span style="color: #4c8317">#define IP "184.106.153.149" </span><span style="color: #aaaaaa;font-style: italic">// thingspeak.com</span>
String GET = <span style="color: #aa5500">"GET /update?key=paste_channel_key_here&amp;field1="</span>;

SoftwareSerial <span style="color: #00aa00">wifiPort</span>(<span style="color: #009999">2</span>, <span style="color: #009999">3</span>); 

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">setup</span>()  
{
  Serial.begin(<span style="color: #009999">9600</span>);
  <span style="color: #0000aa">while</span> (!Serial) {
  }
  
  wifiPort.begin(<span style="color: #009999">9600</span>);
   connectToWiFi();
}

boolean <span style="color: #00aa00">connectToWiFi</span>(){
  Serial.println(<span style="color: #aa5500">"AT+CWMODE=3"</span>);
  delay(<span style="color: #009999">2000</span>);
  String cmd=<span style="color: #aa5500">"AT+CWJAP=\""</span>;
  cmd+=SSID;
  cmd+=<span style="color: #aa5500">"\",\""</span>;
  cmd+=PASS;
  cmd+=<span style="color: #aa5500">"\""</span>;
  wifiPort.println(cmd);  
  delay(<span style="color: #009999">5000</span>);
  <span style="color: #0000aa">if</span>(wifiPort.find(<span style="color: #aa5500">"OK"</span>)){
    Serial.print(<span style="color: #aa5500">"Connected, IP address:  "</span>);
    delay(<span style="color: #009999">2000</span>);
    wifiPort.println(<span style="color: #aa5500">"AT+CIFSR"</span>);
  delay(<span style="color: #009999">2000</span>);
   Serial.println(<span style="color: #aa5500">"All good!"</span>);
  wifiPort.println(<span style="color: #aa5500">"AT+CIPMUX=1"</span>);
    <span style="color: #0000aa">return</span> <span style="color: #00aaaa">true</span>;
  }<span style="color: #0000aa">else</span>{
    Serial.println(<span style="color: #aa5500">"Not good!"</span>);
    <span style="color: #0000aa">return</span> <span style="color: #00aaaa">false</span>;
  }
}

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">sendTelemetry</span>(<span style="color: #00aaaa">float</span> tempF, <span style="color: #00aaaa">float</span> humP){
  String cmd = <span style="color: #aa5500">"AT+CIPSTART=4,\"TCP\",\""</span>;
  <span style="color: #aaaaaa;font-style: italic">//AT+CIPSTART=4,"TCP","bing.com",80 </span>
  cmd += IP;
  cmd += <span style="color: #aa5500">"\",80"</span>;
  Serial.println(cmd);
  wifiPort.println(cmd);
  delay(<span style="color: #009999">2000</span>);
  <span style="color: #0000aa">if</span>(wifiPort.find(<span style="color: #aa5500">"Error"</span>)){
    Serial.println(<span style="color: #aa5500">"Not good!"</span>);
    <span style="color: #0000aa">return</span>;
  }
  cmd = GET;
  cmd += tempF;
  cmd += <span style="color: #aa5500">"&amp;field2="</span>;
  cmd += humP;
  cmd += <span style="color: #aa5500">"\r\n"</span>;
  wifiPort.print(<span style="color: #aa5500">"AT+CIPSEND=4,"</span>);
  wifiPort.println(cmd.length());
  delay(<span style="color: #009999">3000</span>);
  <span style="color: #0000aa">if</span>(wifiPort.find(<span style="color: #aa5500">"&gt;"</span>)){
      Serial.println(<span style="color: #aa5500">"sending command... "</span>);
    wifiPort.print(cmd);
  }<span style="color: #0000aa">else</span>{
   Serial.println(<span style="color: #aa5500">"closing"</span>);
    wifiPort.println(<span style="color: #aa5500">"AT+CIPCLOSE"</span>);
  }
}

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">loop</span>() 
{

  wifiPort.listen();
  <span style="color: #0000aa">if</span> (wifiPort.available() ) {
    Serial.write(wifiPort.read());
  }
  <span style="color: #0000aa">if</span> (Serial.available() ){
    wifiPort.write(Serial.read());
  }
  delay(<span style="color: #009999">10</span>);

   sendTelemetry(<span style="color: #009999">28.7</span>,<span style="color: #009999">13.8</span>);
}
</pre>
</div>
<span style="font-family: 'courier new', courier;font-size: medium">The above sketch does two major things - i) it connects to your wifi network and ii)it sends static values to your thingspeak channel. </span><span style="font-family: 'courier new', courier;font-size: medium"> </span>

<span style="font-family: 'courier new', courier;font-size: medium">Next, download and install Adafruit's <a target="_blank" href="https://github.com/adafruit/DHT-sensor-library">DHT library</a>. You may need to modify and run the DHT test sketch to ensure your DHT22 sensor is working. </span>

<span style="font-family: 'courier new', courier;font-size: medium">Also, you could modify the above sketch to send the sensor data to your thingspeak channel as well. Here is a screenshot of what my Arduino output looks like at this stage:  </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/dhtReading.jpg"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/dhtReading.jpg" alt=" " width="660" height="414" border="0" /></a>
</span>

<span style="font-family: 'courier new', courier;font-size: medium">And this is what my thingspeak channel looks like - <a target="_blank" href="https://thingspeak.com/channels/67466">https://thingspeak.com/channels/67466</a> </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4118.IOweatherStation_-_ThingSpeak.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4118.IOweatherStation_-_ThingSpeak.png" alt=" " width="706" height="544" border="0" /></a>
</span>

<span style="font-family: 'courier new', courier;font-size: medium">Well done for coming this far. The ESP module needs and deserves lots of patience! </span>

<span style="font-size: large"><strong><span style="font-family: 'courier new', courier"><a id="p"></a>Problem Statement</span></strong></span>

<span style="font-family: 'courier new', courier;font-size: medium">At the time of writing this blog, the AT firmware on ESP-01 wifi module does not have the ability to bind to HTTPS-only sites because it does not support SSL encryption. This is due to certain limiting factors such as certificate size and protocol support (TLS v1.2). There's a hack firmware <a href="https://bbs.espressif.com/viewtopic.php?t=377">here</a> that claims to have it working on port 443, but it didn't work for me. </span>

<span style="font-family: 'courier new', courier;font-size: medium"> Unlike thingspeak.com, Microsoft Azure Event Hub does not allow HTTP connection. In other words, all connection must be done via SSL on port 443. To work around this (ESP01) problem, we'd need a service to mediate between the ESP component and Microsoft Azure Event Hub. That way, we can send telemetry data via ESP to the service on HTTP, then have the service forward the information to Azure Event Hub over SSL connection. Let's call this intermediary service the IoTGateway.                                       </span>

<span style="font-family: 'courier new', courier;font-size: medium">The IoTGateway has an API endpoint that </span><span style="font-family: 'courier new', courier;font-size: medium">receives JSON and/or forms data, stores it (for data redundancy purpose), then forward the data to Azure Event Hub. The diagram below depicts a high level design of the project.    </span>

<span style="font-family: 'courier new', courier;font-size: medium"><img class=" wp-image-191 aligncenter" src="https://msdnshared.blob.core.windows.net/media/2016/01/IOTFlow_pptx_-_Microsoft_PowerPoint_Online.png" alt="IOTFlow_pptx_-_Microsoft_PowerPoint_Online" width="655" height="225" /></span>

<span style="font-family: 'courier new', courier;font-size: medium">Further, the Arduino sketch that sends telemetry data via ESP to the IoTGateway is shown below. In comparison to the previous sketch, I did some refactoring and reduced the number of serial prints to optimise memory utilisation - since they won't be needed in deployment mode:  </span>

<!-- HTML generated using hilite.me -->
<div style="background: #ffffff;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em">
<pre style="margin: 0;line-height: 125%"><span style="color: #4c8317">#include "DHT.h"</span>
<span style="color: #4c8317">#include &lt;SoftwareSerial.h&gt;</span>
<span style="color: #4c8317">#define SSID "change_me"</span>
<span style="color: #4c8317">#define PASS "change_me"</span>
<span style="color: #4c8317">#define GATEWAY_ADDRESS "icent.nut.cc" </span><span style="color: #aaaaaa;font-style: italic">// iotGateway address https://icent.nut.cc:3000. Locked down to specific IP range</span>
<span style="color: #4c8317">#define GATEWAY_PORT 3000</span>
<span style="color: #4c8317">#define chipId "101"</span>
<span style="color: #4c8317">#define initReqData "POST /dhts.json HTTP/1.1\r\nHost:"</span>
<span style="color: #4c8317">#define DHTPIN 4 </span><span style="color: #aaaaaa;font-style: italic">// the uno digital pin I'm connected to</span>
<span style="color: #4c8317">#define DHTTYPE DHT22 </span><span style="color: #aaaaaa;font-style: italic">// DHT 22  </span>

<span style="color: #00aaaa">unsigned</span> <span style="color: #00aaaa">long</span> previousMillis = <span style="color: #009999">0</span>; <span style="color: #aaaaaa;font-style: italic">// will store last time DHT was acccessed </span>
<span style="color: #0000aa">const</span> <span style="color: #00aaaa">long</span> readInterval = <span style="color: #009999">600000</span>;   <span style="color: #aaaaaa;font-style: italic">// read temperature,humidity and send readings to iotgateway every 10 minutes </span>

SoftwareSerial <span style="color: #00aa00">wifiPort</span>(<span style="color: #009999">2</span>, <span style="color: #009999">3</span>); <span style="color: #aaaaaa;font-style: italic">//Connect ESP Tx to Uno Pin 2, ESP Rx to Uno Pin 3</span>
<span style="color: #aaaaaa;font-style: italic">// Initialize DHT sensor.</span>
DHT <span style="color: #00aa00">dht</span>(DHTPIN, DHTTYPE);

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">setup</span>() {
    Serial.begin(<span style="color: #009999">9600</span>);
    wifiPort.begin(<span style="color: #009999">9600</span>); <span style="color: #aaaaaa;font-style: italic">//  ESP baudrate</span>
   
    <span style="color: #aaaaaa;font-style: italic">//initalize the wifi module </span>
    prepareWifiModule();

    <span style="color: #aaaaaa;font-style: italic">//Connect ESP module to home/office wifi </span>
    connectToWiFi();
}

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">prepareWifiModule</span>() {
    sendCommand(<span style="color: #aa5500">"AT\r\n"</span>);
    sendCommand(<span style="color: #aa5500">"AT+RST\r\n"</span>);
    sendCommand(<span style="color: #aa5500">"AT+CWMODE=3\r\n"</span>);
    sendCommand(<span style="color: #aa5500">"AT+CIPMUX=1\r\n"</span>);
    delay(<span style="color: #009999">2000</span>);
}

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">connectToWiFi</span>() {
    <span style="color: #aaaaaa;font-style: italic">// Serial.println("Connecting to the internet...");</span>
    String cmd = <span style="color: #aa5500">"AT+CWJAP=\""</span>;
    cmd += SSID;
    cmd += <span style="color: #aa5500">"\",\""</span>;
    cmd += PASS;
    cmd += <span style="color: #aa5500">"\""</span>;
    cmd += <span style="color: #aa5500">"\r\n"</span>;
    sendCommand(cmd);
    delay(<span style="color: #009999">2000</span>);
}

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">loop</span>() {
    <span style="color: #00aaaa">unsigned</span> <span style="color: #00aaaa">long</span> currentMillis = millis();
    
    <span style="color: #0000aa">if</span>(currentMillis - previousMillis &gt; readInterval) {
    <span style="color: #aaaaaa;font-style: italic">//save the next readInterval.</span>
    previousMillis = currentMillis;
    
    <span style="color: #aaaaaa;font-style: italic">// Read temperature as Celsius (the default)</span>
    <span style="color: #00aaaa">float</span> hum = dht.readHumidity();
    
    <span style="color: #aaaaaa;font-style: italic">// Read temperature as Celsius</span>
    <span style="color: #00aaaa">float</span> tem = dht.readTemperature();
    
    <span style="color: #aaaaaa;font-style: italic">// Read temperature as Fahrenheit (isFahrenheit = true)</span>
    <span style="color: #aaaaaa;font-style: italic">//float temF = dht.readTemperature(true);</span>
    
    <span style="color: #aaaaaa;font-style: italic">// Check if any reads failed and exit early (to try again).</span>
    <span style="color: #0000aa">if</span> (isnan(hum) || isnan(tem)) {
        Serial.println(<span style="color: #aa5500">"Failed to read from DHT sensor!"</span>);
        <span style="color: #0000aa">return</span>;
    }
    
    <span style="color: #00aaaa">float</span> hic = dht.computeHeatIndex(tem, hum, <span style="color: #00aaaa">false</span>);
    
    Serial.print(<span style="color: #aa5500">"Humidity: "</span>);
    Serial.print(hum);
    Serial.print(<span style="color: #aa5500">" %\t"</span>);
    Serial.print(<span style="color: #aa5500">"Temperature: "</span>);
    Serial.print(tem);
    Serial.print(<span style="color: #aa5500">" *C\t "</span>);
    Serial.print(<span style="color: #aa5500">"Heat index: "</span>);
    Serial.print(hic);
    Serial.print(<span style="color: #aa5500">" *C "</span>);
    Serial.print(<span style="color: #aa5500">'\n'</span>);
    
    sendTelemetry(tem, hum, hic);
    
    } 
}

<span style="color: #00aaaa">void</span> <span style="color: #00aa00">sendTelemetry</span>(<span style="color: #00aaaa">float</span> t, <span style="color: #00aaaa">float</span> h, <span style="color: #00aaaa">float</span> hi) {
    <span style="color: #00aaaa">char</span> buff[<span style="color: #009999">10</span>];
    String temperature_string;
    String humidity_string;
    String heatIndex_string;
    
    <span style="color: #aaaaaa;font-style: italic">//convert floats to strings</span>
    temperature_string = dtostrf(t, <span style="color: #009999">2</span>, <span style="color: #009999">2</span>, buff);
    humidity_string = dtostrf(h, <span style="color: #009999">2</span>, <span style="color: #009999">2</span>, buff);
    heatIndex_string = dtostrf(hi, <span style="color: #009999">2</span>, <span style="color: #009999">2</span>, buff);

   <span style="color: #aaaaaa;font-style: italic">//Generate telemetry in json format </span>
    String telemetry = <span style="color: #aa5500">"{"</span>;
    telemetry += <span style="color: #aa5500">"\"chipid\":\""</span>;
    telemetry += chipId;
    telemetry +=  <span style="color: #aa5500">"\",\"location\":\"GBRG6\",\"description\":\"B4Z1\",\"temperature\":"</span>;
    telemetry += temperature_string;
    telemetry += <span style="color: #aa5500">"\",\"humidity\":\""</span>;
    telemetry += humidity_string;
    telemetry += <span style="color: #aa5500">"\",\"heat_index\":\""</span>;
    telemetry += heatIndex_string;
    telemetry += <span style="color: #aa5500">"\"}"</span>;

    <span style="color: #aaaaaa;font-style: italic">// Or parameterize telemetery in post request..</span>
    <span style="color: #aaaaaa;font-style: italic">//Note that the dht[...] is a ruby on rails thing.</span>
    
<span style="color: #aaaaaa;font-style: italic">//    String telemetry = "dht[chipid]=";</span>
<span style="color: #aaaaaa;font-style: italic">//    telemetry += chipId;</span>
<span style="color: #aaaaaa;font-style: italic">//    telemetry += "&amp;dht[location]=GBRG6&amp;dht[description]=B4Z1&amp;dht[temperature]=";</span>
<span style="color: #aaaaaa;font-style: italic">//    telemetry += temperature_string;</span>
<span style="color: #aaaaaa;font-style: italic">//    telemetry += "&amp;dht[humidity]=";</span>
<span style="color: #aaaaaa;font-style: italic">//    telemetry += humidity_string;</span>
<span style="color: #aaaaaa;font-style: italic">//    telemetry += "&amp;dht[heat_index]=";</span>
<span style="color: #aaaaaa;font-style: italic">//    telemetry += heatIndex_string;</span>

    telemetry.trim(); <span style="color: #aaaaaa;font-style: italic">//remove trailing whitespaces.. </span>

    delay(<span style="color: #009999">1000</span>); <span style="color: #aaaaaa;font-style: italic">//let the buffer load </span>

    String requestHeader = GATEWAY_ADDRESS;
    requestHeader += <span style="color: #aa5500">"\r\n"</span>;
  <span style="color: #aaaaaa;font-style: italic">//requestHeader += "Content-Type:application/x-www-form-urlencoded\r\nContent-Length:";  //if using post forms instead of JSON. </span>
    requestHeader += <span style="color: #aa5500">"Content-Type:application/json\r\nContent-Length:"</span>;
    requestHeader += telemetry.length();
    requestHeader += <span style="color: #aa5500">" \r\n\r\n"</span>;

    delay(<span style="color: #009999">1000</span>); <span style="color: #aaaaaa;font-style: italic">//let the buffer load </span>

    String http_request = initReqData;
    http_request += requestHeader;
    http_request += telemetry;
    http_request += <span style="color: #aa5500">"\r\n\r\n"</span>;

    delay(<span style="color: #009999">1000</span>);
   
    <span style="color: #aaaaaa;font-style: italic">//connect to gateway</span>
    String cipStart = <span style="color: #aa5500">"AT+CIPSTART=4,\"TCP\",\""</span>;
    cipStart += GATEWAY_ADDRESS;
    cipStart += <span style="color: #aa5500">"\","</span>;
    cipStart += GATEWAY_PORT;
    cipStart += <span style="color: #aa5500">"\r\n"</span>;
    sendCommand(cipStart);
    
    delay(<span style="color: #009999">1000</span>);
    
    <span style="color: #aaaaaa;font-style: italic">//Serial.println(wifiPort.readString());</span>
    <span style="color: #0000aa">if</span> (Serial.find(<span style="color: #aa5500">"ERROR"</span>) || Serial.find(<span style="color: #aa5500">"Error"</span>)  || Serial.find(<span style="color: #aa5500">"Unlink"</span>) || Serial.find(<span style="color: #aa5500">"link is not"</span>)) {
        Serial.println(<span style="color: #aa5500">"Could not connect to IOTgateway, retrying module initialization..."</span>);
        prepareWifiModule();
    }

    String cipSend = <span style="color: #aa5500">"AT+CIPSEND=4"</span>;
    cipSend += <span style="color: #aa5500">","</span>;
    cipSend += http_request.length();
    cipSend += <span style="color: #aa5500">"\r\n"</span>;
    
    sendCommand(cipSend);
    delay(<span style="color: #009999">1000</span>);
    
    sendCommand(http_request);
    delay(<span style="color: #009999">3000</span>);

    <span style="color: #aaaaaa;font-style: italic">//close the TCP connection </span>
    sendCommand(<span style="color: #aa5500">"AT+CIPCLOSE=4\r\n"</span>);
}

String <span style="color: #00aa00">sendCommand</span>(String command) {
    String response = <span style="color: #aa5500">""</span>;
    <span style="color: #0000aa">const</span> <span style="color: #00aaaa">int</span> timeout = <span style="color: #009999">1000</span>;
    boolean debug = <span style="color: #00aaaa">true</span>;

    wifiPort.print(command); <span style="color: #aaaaaa;font-style: italic">// send the read character to the esp8266</span>

    <span style="color: #00aaaa">long</span> <span style="color: #00aaaa">int</span> time = millis();

    <span style="color: #0000aa">while</span> ((time + timeout) &gt; millis()) {
        <span style="color: #0000aa">while</span> (wifiPort.available()) {
            <span style="color: #aaaaaa;font-style: italic">// The esp has data so display its output to the serial window </span>
            <span style="color: #00aaaa">char</span> c = wifiPort.read(); <span style="color: #aaaaaa;font-style: italic">// read the next character.</span>
            response += c;
        }
    }

    <span style="color: #0000aa">if</span> (debug) {
        Serial.print(response);
    }

    <span style="color: #0000aa">return</span> response;
}</pre>
</div>
<span style="font-family: 'courier new', courier;font-size: medium">Please refer to this <a target="_blank" href="https://github.com/iogbole/esp_dht_sensor" title="GitHub repo">GitHub repo</a> for an updated version of the above sketch (if any). </span>

<span style="font-family: 'courier new', courier;font-size: medium">Next - &gt; </span><span style="font-family: 'courier new', courier;font-size: medium"><a target="_blank" href="https://blogs.technet.microsoft.com/israelo/2016/01/05/streaming-iot-telemetry-to-azure-event-hubpart-2/" title="Part 2">Setting up Azure Event Hub to process telemetries</a> </span>

<strong><span style="font-family: 'courier new', courier;font-size: medium">References: </span></strong>
<ul>
 	<li><a href="//www.electrodragon.com/w/ESP8266_firmware_flasher"><span style="font-family: 'courier new', courier;font-size: medium">https://www.electrodragon.com/w/ESP8266_firmware_flasher </span></a></li>
 	<li><a href="https://learn.adafruit.com/dht"><span style="font-family: 'courier new', courier;font-size: medium">https://learn.adafruit.com/dht</span></a></li>
 	<li><a href="https://github.com/adafruit/DHT-sensor-library "><span style="font-family: 'courier new', courier;font-size: medium">https://github.com/adafruit/DHT-sensor-library </span></a></li>
 	<li><a href="https://allaboutee.com"><span style="font-family: 'courier new', courier;font-size: medium">https://allaboutee.com</span></a></li>
</ul>
<p style="padding-left: 330px"><a href="https://twitter.com/intent/tweet?screen_name=israel_ogbole" class="twitter-mention-button">Tweet to @israel_ogbole</a><script src="//platform.twitter.com/widgets.js"></script></p>
[bing_translator]]]></content:encoded>
    </item>
    <item>
      <title>Yammer REST API: How to bulk-add members to a yammer group</title>
      <link>https://docs.microsoft.com/archive/blogs/israelo/yammer-rest-api-how-to-bulk-add-members-to-a-yammer-group</link>
      <pubDate>Fri, 31 Jul 2015 07:44:00 GMT</pubDate>
      <dc:creator><![CDATA[Israel Ogbole]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/israelo/2015/07/31/yammer-rest-api-how-to-bulk-add-members-to-a-yammer-group/</guid>
      <description><![CDATA[So you want to add multiple users to a yammer group via the API?&nbsp;
This question comes up quite...]]></description>
      <content:encoded><![CDATA[<p><span>So you want to add multiple users to a yammer group via the API?&nbsp;</span></p>
<p><span>This question comes up quite often partly because there is no yammer documented/supported api on how to add members to a group in bulk. Most users, out of&nbsp;desperation end up hacking endpoints and and their respective parameters by capturing fiddler trace, inspecting browser elements, etc, but these get them into an unsupported state as undocumented&nbsp;APIs could change and/or break at any time&nbsp;without prior notice.</span></p>
<p><span>In this blog post, I will share my&nbsp;experience&nbsp;on how I worked with some clients to bulk add users to yammer group programatically - using yammer supported/documented API endpoints.</span></p>
<p><strong>Prerequisites</strong><span><br /></span></p>
<ul>
<li><span style="font-size:large"><span>Register&nbsp;</span><span>an app in Yammer as discussed in &quot;<a href="/b/israelo/archive/2014/10/21/yammer-js-sdk-for-dummies.aspx">Yammer REST API for Dummies</a>&quot;&nbsp;</span></span></li>
<li><span>Note the client ID and secret of the created app&nbsp;</span></li>
<li><span>Create a service account in Yammer and grant verified admin&nbsp;privilege&nbsp;to the service account.&nbsp;</span></li>
<li><span>Obtain OAuth token of the service account as discussed in &quot;<a href="/b/israelo/archive/2015/02/24/consuming-yammer-restful-api-with-angularjs-for-dummies.aspx" title="Consuming Yammer RESTful API with AngularJS for Dummies" target="_blank">Consuming Yammer RESTful API with AngularJS for Dummies</a>&quot;&nbsp;</span></li>
<li><span>Obtain User IDs of the users you&#039;d like to add to a group. These User IDs can be obtained by performing&nbsp;<a href="https://support.office.com/en-ca/article/Monitoring-your-Yammer-data-Yammer-admin-guide-8c4651fa-12c2-4ced-b4ea-2200c0a630ed" title="data export" target="_blank">user data export</a></span></li>
</ul>
<p><span style="font-size:x-large"><strong><span>The Pseudo-code&nbsp;</span></strong></span></p>
<p><span>This implementation is represented in pseudo-code so as to make it easier for you or your developers to translate this information into any programming language of choice.&nbsp;</span></p>
<pre><span style="font-size:large"><code style="color:#000000"> #Declare variables and constants  
 Array temp = Read userIDs from csv  
 constant group_id = 123  
 constant client_id = c456 
 var userid = 0;  
 ImpersonationURL = https://api.yammer.com/api/v1/oauth/tokens.json?user_id=$userid&amp;consumer_key=$client_id
 GroupURL = https://api.yammer.com/api/v1/group_memberships.json?group_id=$group_id  
 while temp contains value {  
 userid = temp  
 #Impersonate the user with the VA&#039;s OAuth token   
 json_response = HTTP.GET (ImpersonationURL, userid).Authorization.Header(Bearer verified_admin_token)  
 #Consume the impersonated user&#039;s token from the JSON response  
 if json_response == null   
   exit and/or catch NullPointerException
 else  
#Parse the response to type json and read the token value  
user_token = JSON.Parse(json_response).token  
#Now, add the impersonated user to the group  
response = HTTP.POST (GroupURL, group_id).Authorization.Header(Bearer user_token)  
 if (response.status == 201) {  
   render SUCCESS or write userid into success.log  
 } else {  
   Read JSON response and render appropriate message OR write userid with the corresponding http response into failed.log  
 }  
 #Do not exceed yammer api rate limit - https: //developer.yammer.com/docs/rest-api-rate-limits. So sleep 
 sleep(2 sec)  
 increment++  
 }  
</code></span></pre>
<p></p>
<p><span>In plain&nbsp;English, what we have done so far are:</span></p>
<ul>
<li><span>Read userIDs from the csv that was obtained from data export&nbsp;</span></li>
<li><span>Iterate through the user list&nbsp;</span></li>
<li><span>Impersonate each user so as to get a pre-authorized&nbsp;token&nbsp;</span></li>
<li><span>Make the user add him/herself to the group. Yah!</span></li>
</ul>
<p><span>I think this is needless to mention, but due to some questions that came up recently, I would like to note that it is not possible to impersonate a pending user. Impersonation only applies to active yammer accounts.&nbsp;</span></p>
<h1><span>References&nbsp;</span></h1>
<ul>
<li><span><a href="https://developer.yammer.com/v1.0/docs/impersonation">https://developer.yammer.com/v1.0/docs/impersonation</a></span></li>
<li><span><a href="https://developer.yammer.com/v1.0/docs/group_membershipsjsongroup_idid">https://developer.yammer.com/v1.0/docs/group_membershipsjsongroup_idid</a></span></li>
<li><span><a href="https://developer.yammer.com/docs/rest-api-rate-limits" title="https://developer.yammer.com/docs/rest-api-rate-limits">https://developer.yammer.com/docs/rest-api-rate-limits</a></span></li>
</ul>
<p><span>&nbsp;</span></p>
<p><span>Was this information helpful? Please leave a feedback.&nbsp;</span></p>
<script type="text/javascript" src="https://c64.assets-yammer.com/assets/platform_social_buttons.min.js"></script>
<script type="text/javascript">// </script>


<p style="padding-left: 330px"><a href="https://twitter.com/intent/tweet?screen_name=israel_ogbole" class="twitter-mention-button">Tweet to @israel_ogbole</a><script src="//platform.twitter.com/widgets.js"></script></p>
[bing_translator]]]></content:encoded>
    </item>
    <item>
      <title>Restricting Access to Yammer Using ADFS Claims Transformation Rule</title>
      <link>https://docs.microsoft.com/archive/blogs/israelo/restricting-access-to-yammer-using-adfs-claims-transformation-rule</link>
      <pubDate>Fri, 27 Mar 2015 09:04:00 GMT</pubDate>
      <dc:creator><![CDATA[Israel Ogbole]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/israelo/2015/03/27/restricting-access-to-yammer-using-adfs-claims-transformation-rule/</guid>
      <description><![CDATA[Assuming you have created the Yammer Relying Party Trust and SSO is now working with the default...]]></description>
      <content:encoded><![CDATA[<span style="font-family: 'courier new', courier;font-size: medium">Assuming you have </span><a style="font-family: 'courier new', courier;font-size: medium" title=" created the Yammer relying party trust " href="/b/israelo/archive/2014/08/08/creating-yammer-relying-party-trust-in-adfs.aspx" target="_blank">created the Yammer Relying Party Trust</a><span style="font-family: 'courier new', courier;font-size: medium"> and SSO is now working with the default configuration, a need may arise to prevent some users from logging into Yammer. This will require writing a custom claims transformation rule. The first step to achieving this goal is to create an active directory security group and add the "allowed users" as members of the security group. Feel free to skip this step if you already have a security group. </span>
<h2><strong style="font-size: 1.5em"><span style="font-family: 'courier new', courier;font-size: large">Creating an AD Security Group </span></strong></h2>
<ul>
	<li style="text-align: left"><span style="font-family: 'courier new', courier;font-size: medium">Click Start, point to, point to Programs, Administrative Tools, and then click Active Directory Users and Computers</span></li>
	<li style="text-align: left"><span style="font-family: 'courier new', courier;font-size: medium">In Active Directory Users and Computers window, expand </span><span class="label" style="font-family: 'courier new', courier;font-size: medium">&lt;</span><span class="parameter" style="font-family: 'courier new', courier;font-size: medium">domain name</span><span class="label" style="font-family: 'courier new', courier;font-size: medium">&gt;.com</span></li>
	<li class="_mce_tagged_br" style="text-align: left"><span style="font-family: 'courier new', courier;font-size: medium">In the console tree, right-click the folder in which you want to add a new group.</span></li>
	<li class="_mce_tagged_br" style="text-align: left"><span style="font-family: 'courier new', courier;font-size: medium">Click New and then click Group.</span></li>
</ul>
<p style="margin-left: 30px"><span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/1.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/1.png" alt=" " width="612" height="336" border="0" /></a></span></p>

<ul>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Type the name of the new group. You may want to use a name that you can easily associate with the role you are creating.</span></li>
	<li>
<p class="_mce_tagged_br"><span style="font-family: 'courier new', courier;font-size: medium">In the New Object - Group dialogue box, do the following:</span></p>

<ul>
	<li><span style="font-family: 'courier new', courier;font-size: medium">In Group scope, select Global scope.</span></li>
	<li><span style="font-family: 'courier new', courier;font-size: medium">In Group type, select Security</span></li>
</ul>
</li>
</ul>
<p style="margin-left: 30px"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/2.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/2.png" alt=" " width="496" height="460" border="0" /></a></p>

<ul>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Click OK</span></li>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Now double click on the group you just created and follow the direction of the arrows to add a member to the group: </span><span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/3515.3.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/3515.3.png" alt=" " width="541" height="279" border="0" /></a></span></li>
</ul>
<h2><strong><span style="font-family: 'courier new', courier;font-size: large">Get SID of the Security Group</span></strong></h2>
<span style="font-family: 'courier new', courier;font-size: medium">Now that we have a security group, we will need the ObjectSID of the group. This value can be found in the Attribute Editor pane of the group's properties: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4.png" alt=" " border="0" /></a></span>

<span style="font-family: 'courier new', courier;font-size: medium">The ObjectSID value cannot be easily copied from the Editor pane so we're going to have to use Powershell commands to retrieve the value. Open the PowerShell command prompt on the Active Directory server and run this two liner commands - remember to change GROUP-NAME-GOES-HERE to the name of the security group; YammerUsers in my case. </span>
<pre><code style="color: #000000"> $name = “GROUP-NAME-GOES-HERE”  
 (New-Object System.Security.Principal.NTAccount($name)).Translate([System.Security.Principal.SecurityIdentifier]).value  
</code></pre>
<span style="font-family: 'courier new', courier;font-size: medium">The above commands should then output the ObjectSID: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7752.52E00.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7752.52E00.png" alt=" " width="735" height="81" border="0" /></a>
</span>

<span style="font-family: 'courier new', courier;font-size: medium">Copy the SID value into notepad.</span>
<h2><span style="font-family: 'courier new', courier;font-size: medium"><strong><span style="font-size: large">Update the Yammer Relying Party Trust</span></strong> </span></h2>
<ul>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Open ADFS Management Snap-in and navigate to Relying Party Trust</span></li>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Right click the already existing Yammer Trust and click Edit Claim Rules</span></li>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Go to the "Issuance Authorization Rules" tab at the top</span></li>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Click Add Rule and select "Send Claims Using A Custom Rule" from the drop down.</span></li>
</ul>
<ul>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Copy/Paste this rule into the Custom rule text box:</span></li>
</ul>
<pre><code style="color: #000000"> NOT exists([Type == "https://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid", Value =~ "\bSID-GOES-HERE\b"])  
  =&gt; issue(Type = "https://schemas.microsoft.com/authorization/claims/deny", Value = "true");  
</code></pre>
<ul>
	<li><span style="font-family: 'courier new', courier;font-size: medium">Replace <em><strong>SID-GOES-HERE</strong></em> with the ObjectSID value of the security Group: </span></li>
</ul>
<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6.png" alt=" " width="822" height="619" border="0" /></a>
</span>

<span style="font-family: 'courier new', courier;font-size: medium">Once that is done, move the new Yammer Custom Rule to the top, that way, it takes priority over the "Permit all" rule. Do not remove the Permit all rule. In all, it should look like this: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7.png" alt=" " border="0" /></a>
</span>

<span style="font-family: 'courier new', courier;font-size: medium">Click Apply, OK and get ready to TEST! </span>
<h2><span style="font-family: 'courier new', courier;font-size: large"><strong>Testing Yammer SSO with Custom Claim Rule</strong> </span></h2>
<span style="font-family: 'courier new', courier;font-size: medium">Let's test this out. Open an Inprivate browsing session or Incognito if you're using Chrome, navigate to yammer.com/your-domain.com. </span>

<span style="font-family: 'courier new', courier;font-size: medium">You should be redirected to your company's login page. Enter an active directory credential of a user who <strong>IS NOT</strong> a member of the security group and it should result to an error on successful authentication: </span>

<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/8.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/8.png" alt=" " width="827" height="308" border="0" /></a>

<span style="font-family: 'courier new', courier;font-size: medium">The above error is because your ADFS server sent a Request-Denied SAMLResponse to Yammer: </span>

<span style="font-family: 'courier new', courier;font-size: medium"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/0247.9.png"><img class="" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/0247.9.png" alt=" " width="707" height="204" border="0" /></a></span>

<span style="font-family: 'courier new', courier;font-size: medium">It is not possible to customize the error in Yammer at this time. However, you may configure ADFS to not redirect unauthorised users to yammer, and to display a user friendly message. Use the following Windows Powershell cmdlet and syntax to customize the relying party error message: </span>
<pre><code style="color: #000000"> Set-AdfsRelyingPartyWebContent -Name fedpassive -ErrorPageAuthorizationErrorMessage "&lt;br&gt;&lt;p&gt; You need to be a member of the Yammer Users Security group to access this Yammer network. Click &lt;A href='https://requestyammeraccess/'&gt;here&lt;/a&gt; for more information or contact jetlee@contoso.com&lt;/p&gt;“  </code></pre>
<span style="font-family: 'courier new', courier;font-size: medium">Finally, test this out with a user who is a member of the security group to be sure you haven't locked everybody out.</span>

<span style="font-family: 'courier new', courier;font-size: medium"> </span>

<em><strong><span style="font-family: 'courier new', courier;font-size: medium">Disclaimer: </span></strong></em>

<em><span style="font-family: 'courier new', courier;font-size: medium">I tested this out on a non-production ADFS 3.0 server. Your mileage may differ so take extreme care before applying any changes to your production server and you may use the information in this blog at your discretion. </span></em>


<p style="padding-left: 330px"><a href="https://twitter.com/intent/tweet?screen_name=israel_ogbole" class="twitter-mention-button">Tweet to @israel_ogbole</a><script src="//platform.twitter.com/widgets.js"></script></p>
[bing_translator]]]></content:encoded>
    </item>
    <item>
      <title>Consuming Yammer RESTful API with AngularJS for Dummies</title>
      <link>https://docs.microsoft.com/archive/blogs/israelo/consuming-yammer-restful-api-with-angularjs-for-dummies</link>
      <pubDate>Mon, 23 Feb 2015 18:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Israel Ogbole]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/israelo/2015/02/23/consuming-yammer-restful-api-with-angularjs-for-dummies/</guid>
      <description><![CDATA[This blog is a continuation of the Yammer RESTful API for dummies series. We are going to write a...]]></description>
      <content:encoded><![CDATA[<p><span>This blog is a continuation of the <a href="/b/israelo/archive/2014/10/21/yammer-js-sdk-for-dummies.aspx" target="_blank">Yammer RESTful API for dummies</a> series. We are going to write a simple <a href="https://angularjs.org/" target="_blank">AngularJS</a> client that consumes the Yammer <strong>users.json</strong>&nbsp;RESTful API endpoint.&nbsp;</span></p>
<p><span style="font-size:medium"><span>The AngularJS client will be accessed by opening the users.html&nbsp;</span><span>file in your browser, and will consume the Yammer api service accepting requests at:</span></span></p>
<pre><span style="font-size:large"><code style="color:#000000"> https://api.yammer.com/api/v1/users.json  
</code></span></pre>
<p><span style="font-size:medium"><span>Note that the </span><a href="https://developer.yammer.com/v1.0/docs/rest-api-rate-limits">Yammer REST API documentation</a><span>&nbsp;uses https://www.yammer.com as the API endpoint host;&nbsp;</span><span class="definition-url ng-binding">you should always remember to change it to https://api.yammer.com.</span></span></p>
<p><span style="font-size:medium"><span class="definition-url ng-binding"></span></span><span>The users.json API endpoint will respond with a JSON representation of all the users in the Yammer network.</span></p>
<h3><span>Create an AngularJS Controller</span></h3>
<p><span>First, let&#039;s create a very simple AngularJS controller that will consume the REST service. This can be done with and without user authentication prompt. &nbsp;</span></p>
<p><span>Yammer support often get advisory questions from customers wanting to pull generic non-user specific yammer feeds into their (intranet) websites without authentication. Now, yammer does not support anonymity or public data so a user must be authenticated in one way or the other to be able to get and/or post yammer contents. To achieve this goal, you&#039;d need to create a service account and obtain an access token using the instructions in this <a href="https://developer.yammer.com/docs/test-token" title="Generate token" target="_blank">documentation</a>.</span></p>
<p><span>Considering this is a newbie guide and if the documented process of obtaining yammer token is too complicated for you, you may try the following steps:&nbsp;</span></p>
<ul>
<li><span>Login to Yammer using the service account</span></li>
<li><span>Inspect the elements on the page</span></li>
<li><span>Navigate to the network tab </span></li>
<li><span>Reload the page if necessary</span></li>
<li><span>Locate any line containing <strong>.json</strong> originating from www.yammer.com. See screenshot below</span></li>
<li><span>Click the Request Header section</span></li>
<li><span>Look out for the line starting with &quot;Authorization: Bearer &quot;</span></li>
<li><span>Copy the token into a secure place</span></li>
</ul>
<p><span>The above process is an alternative way of obtaining a user access token and it should look like this in Firefox:</span></p>
<p><span><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/yam_angular.jpg"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/yam_angular.jpg" border="0" alt=" " width="673" height="250" /></a><br /></span></p>
<p><span>The caveat is, tokens that are generated (or copied from browser elements) this way may be short lived or rendered invalid when the user logs out of the browser session. So I&#039;d recommend you generate a token from a <a href="https://developer.yammer.com/docs/test-token" target="_blank">registered app</a>&nbsp;for production purpose as they are long lived. &nbsp;</span></p>
<p><span></span><span>Next, create a controller.js file then copy and paste this code into it:&nbsp;</span></p>
<pre><code style="color:#000000"> function YammerGetUserCtrl($scope, $http ) {  
 $http.get(&#039;https://api.yammer.com/api/v1/users.json&#039;, {headers: {&#039;Authorization&#039;: &#039;Bearer TOKEN_VALUE&#039;}}).  
      success(function(data) {  
       $scope.users = data;  
      console.log($scope.users)  
     });  
 }  
</code></pre>
<p><span>Once that&#039;s done, replace TOKEN_VALUE with the access token you obtained. &nbsp;</span></p>
<p><span> This controller module is represented as a simple JavaScript function that is given AngularJS&rsquo;s $scope and $http components. It uses the $http component to consume the REST service at &quot;/api/v1/users.json&quot;. The $http component sends a GET request to the API endpoint with a pre-defined Authorization header; this is one way of consuming Yammer feeds without prompting for authentication.&nbsp;</span></p>
<p><span>If the GET request is successful, it will assign the JSON returned back from the service to $scope.users, effectively setting a model object named &quot;users&quot;. By setting that model object, AngularJS can bind it to the application page&rsquo;s DOM, rendering it for the end user to see. Bear in mind that this could be a lot better but slightly more complex, and I am seriously trying to keep the above implementation as simple as it possibly can because this tutorial is meant for you - newbie. &nbsp;</span></p>
<h3><span>Create the HTML Page</span></h3>
<p><span>Now that you have an AngularJS controller, let&#039;s create the HTML page that will load the controller into the user&rsquo;s web browser. Let&#039;s give it users.html as the file name.&nbsp;</span></p>
<pre><code style="color:#000000"> &lt;!DOCTYPE HTML&gt;  
 &lt;html ng-app&gt;  
   &lt;head&gt;  
    &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js&quot;&gt;&lt;/script&gt;  
    &lt;script src=&quot;controller.js&quot;&gt;&lt;/script&gt;  
   &lt;/head&gt;  
   &lt;body&gt;  
    &lt;hr&gt;  
    &lt;p&gt;&lt;/p&gt;  
    &lt;h3&gt; Yammer Users&lt;/h3&gt;  
    &lt;div ng-controller=&quot;YammerGetUserCtrl&quot;&gt;  
      &lt;div align=&quot;left&quot;&gt; Filter users : &lt;input type=&quot;text&quot; ng-model=&quot;yamUser&quot;&gt; &amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;br&gt; &lt;/div&gt;  
      &lt;p ng-show=&#039;yamUser.length&gt;0&#039;&gt; ({{yamUser.length}}) &lt;/p&gt;  
       &lt;table&gt;  
         &lt;thead valign=&quot;top&quot;&gt;  
          &lt;tr&gt;  
            &lt;th&gt;userID&lt;/th&gt;  
            &lt;th&gt;Full Name&lt;/th&gt;  
            &lt;th&gt;NetworkID&lt;/th&gt;  
            &lt;th&gt;Activation Date&lt;/th&gt;  
            &lt;th&gt;Face&lt;/th&gt;  
          &lt;/tr&gt;  
         &lt;/thead&gt;  
         &lt;tbody&gt;  
          &lt;tr ng-repeat =&quot;user in users | filter:yamUser&quot; ng-class-even=&quot;&#039;alt&#039;&quot;&gt;  
            &lt;td&gt; {{ user.id}}&lt;/td&gt;  
            &lt;td&gt; {{ user.full_name }}&lt;/td&gt;  
            &lt;td&gt; {{ user.network_id }}&lt;/td&gt;  
            &lt;td&gt; {{ user.activated_at}}&lt;/td&gt;  
            &lt;td&gt; &lt;img src= &quot;{{ user.mugshot_url}}&quot;/&gt;&lt;/td&gt;  
          &lt;/tr&gt;  
          &lt;tr ng-if&quot;users.length==0&quot; colspan=&quot;4&quot;&gt; No matching results for {{yamUser}} {{user.length}} &lt;/tr&gt;  
         &lt;/tbody&gt;  
       &lt;/table&gt;  
    &lt;/div&gt;  
   &lt;/body&gt;  
 &lt;/html&gt;  
</code></pre>
<p><span><span><span>Note the following two script tags within the&nbsp;</span><code>head</code><span>&nbsp;section.</span></span></span></p>
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px"><code style="color:#000000"> &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js&quot;&gt;&lt;/script&gt;   
 &lt;script src=&quot;controller.js&quot;&gt;&lt;/script&gt;   
</code></pre>
<p><span><span></span></span><span>The first script tag loads the minified AngularJS library (</span><span>angular.min.js</span><span>) from a content delivery network (CDN) so that you don&rsquo;t have to download AngularJS and place it in your project. It also loads the controller code (</span><span>controller.js</span><span>) from the application&rsquo;s path.</span></p>
<p><span>The AngularJS library enables several custom attributes for use with standard HTML tags. In users.html, four such attributes are in play:</span></p>
<ul>
<li><span>The &lt;html&gt; tag has the <strong>ng-app</strong> attribute to indicate that this page is an AngularJS application.</span></li>
<li><span><span>The &lt;div&gt; tag has the <strong>ng-controller&nbsp;</strong>attribute set to reference YammerGetUserCtrl, the controller module.&nbsp;</span></span></li>
<li><span>The &lt;tr&gt; tag has the <strong>ng-repeat </strong>directive and it&nbsp;is used&nbsp;</span><span></span><span>to iterate over each element in the users&#039; collection.</span></li>
<li><span>The same &lt;tr&gt; tag also contains the <strong>filter</strong> directive and it used to search/filter by the properties of the users.</span></li>
</ul>
<p><span>Also note the five &lt;td&gt; tags which use placeholders (identified by double-curly-braces).</span></p>
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px"><code style="color:#000000"> &lt;td&gt; {{ user.id}}&lt;/td&gt;  
 &lt;td&gt; {{ user.full_name }}&lt;/td&gt;  
 &lt;td&gt; {{ user.network_id }}&lt;/td&gt;  
 &lt;td&gt; {{ user.activated_at}}&lt;/td&gt;  
 &lt;td&gt; &lt;img src= &quot;{{ user.mugshot_url}}&quot;/&gt;&lt;/td&gt;  
</code></pre>
<p><span></span><span>The placeholders reference the properties of the JSON objects which will be set upon successfully consuming the REST service. You can easily&nbsp;identify&nbsp;the property names by copying the returned JSON into a JSON viewer - https://jsonviewer.stack.hu/</span></p>
<h3><span>Running your code</span></h3>
<p><span>Update the Javascript origin with the host name of your application if you haven&#039;t done so to avoid CORS error, something like:</span></p>
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px"><code style="color:#000000"> XMLHttpRequest cannot load https://api.yammer.com/api/v1/users.json. No &#039;Access-Control-Allow-Origin&#039; header is present on the requested resource. Origin....  
</code></pre>
<p><span></span><span>Lunch your app and navigate to the users.html page. This is how mine looks like - I added some css styles.</span></p>
<p><span><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/yammer-export.jpg"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/yammer-export.jpg" border="0" alt=" " width="596" height="191" /></a><br /></span></p>
<h3><span>Summary</span></h3>
<p><span>Congratulations! You&rsquo;ve just developed an AngularJS client that consumes a Yammer RESTful web service. </span></p>
<p><span>One important security advice is to never use the access token the way it was described above in a public website. Anyone could&nbsp;impersonate&nbsp;the service-account user if the access token is compromised. You may explore other ideas of storing the access token in a database, or at least try to scramble it using any javascript&nbsp;obfuscation&nbsp;tool. A typical example is <a href="https://www.javascriptobfuscator.com/Javascript-Obfuscator.aspx" title="javascriptobfuscator.com" target="_blank">javascriptobfuscator.com</a>.&nbsp;</span></p>
<p><span>Lastly, you&#039;d need to take each user through the authentication flow if you require user specific feed and if the&nbsp;<a href="https://developer.yammer.com/v1.0/docs/embed" title="yammer embed feed feature" target="_blank">yammer embed feed feature</a>&nbsp;does not meet your requirement.&nbsp;</span><span>See a sample implementation&nbsp;</span><a href="https://codio.com/iogbole/oauthDance/tree/oauthdance" title="here" target="_blank">here</a><span>.&nbsp;</span></p>
<p><span>Feel free to download and re-use the source of the implementation that is described in this blog from <a href="https://github.com/iogbole/yam_ng" title="https://github.com/iogbole/yam_ng" target="_blank">GitHub</a>.&nbsp;</span></p>
<script type="text/javascript" src="https://c64.assets-yammer.com/assets/platform_social_buttons.min.js"></script>
<script type="text/javascript">// </script>


<p style="padding-left: 330px"><a href="https://twitter.com/intent/tweet?screen_name=israel_ogbole" class="twitter-mention-button">Tweet to @israel_ogbole</a><script src="//platform.twitter.com/widgets.js"></script></p>
[bing_translator]]]></content:encoded>
    </item>
    <item>
      <title>Yammer REST API for Dummies</title>
      <link>https://docs.microsoft.com/archive/blogs/israelo/yammer-rest-api-for-dummies</link>
      <pubDate>Tue, 21 Oct 2014 03:14:00 GMT</pubDate>
      <dc:creator><![CDATA[Israel Ogbole]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/israelo/2014/10/21/yammer-rest-api-for-dummies/</guid>
      <description><![CDATA[So you are about to start developing with the Yammer REST API? You probably have a lot of questions...]]></description>
      <content:encoded><![CDATA[<p><span>So you are about to start developing with the Yammer REST API? You probably have a lot of questions and that is totally expected, I had loads of questions myself when I started off. The aim of this blog post is to get you up and running with minimal effort by providing practical sample codes and hopefully, answer most of your newbie questions.&nbsp;If you are able to post a message to Yammer in 27 minutes using the <strong>Yammer Javascript SDK</strong>, then this blog post has served its purpose. Let&#039;s get started.&nbsp;</span></p>
<p><span>The first thing you want to do is to <a href="https://developer.yammer.com/docs/app-registration" target="_blank">register an app</a> in your Yammer network. Note down your Client ID (a.k.a App ID) and Client Secret values because you&#039;re going to need them.&nbsp;</span></p>
<h2>Post message to a yammer group</h2>
<p><span>Next, you&#039;d need to create a&nbsp;basic HTML page and include the JS SDK resource with the data-app-id definition as shown below:</span></p>
<pre><code style="color:#000000">
   &lt;script type=&quot;text/javascript&quot; data-app-id=&quot;PASTE_YOUR_CLIENT_ID_HERE&quot; src=&quot;https://c64.assets-yammer.com/assets/platform_js_sdk.js&quot;&gt;&lt;/script&gt;  
 
</code></pre>
<p><span>Once that&#039;s done, write the PostMessage function: &nbsp;&nbsp;</span></p>
<pre><code style="color:#000000"> function postMessage() {  
     yam.getLoginStatus( function(response) {  
       if (response.authResponse) {  
        //call the yamPostRequest function if the user is logged in
       yamPostRequest(this);  
       } else {  <br />        //redirect the user to log in
        alert(&quot;not logged in&quot;)  
         yam.login( function (response) {  <br />        //re-check if the user is now logged in, then call the yamPostRequest function
          if (!response.authResponse) {  
           yamPostRequest(this);  
          }  
         });  
       }  
     });  
   }  
</code></pre>
<p><span>The postMessage function checks if there is a valid yammer oauth token in the user&#039;s browser and if the app is verified by the user. If the user is not logged in, &quot;yam.login&quot; is used to pop up the yammer login screen. You&#039;d need to enable popups from *yammer.com in your browser for this work. Once the code verifies that the user is logged in, it will then invoke the yamPostRequest function shown below:&nbsp;</span></p>
<pre><code style="color:#000000"> function yamPostRequest(val) {  
   var msg_value = document.getElementById(&#039;msg_body&#039;).value;  
   var groupID = document.getElementById(&#039;group_id&#039;).value;  
    if(msg_value ==&quot;&quot;){  
     alert (&quot;Message body cannot be empty!&quot;);  
     return false;  
    }  
    if(groupID==&quot;&quot;){  
    var conf = confirm(&quot;Group ID is empty, message will be posted to All Company&quot;) ;<br />    if(conf==false){return false;}
    }  
 yam.platform.request(  
   {   
    url: &quot;https://api.yammer.com/api/v1/messages.json&quot;  
    , method: &quot;POST&quot;  
    , data: {  
     &quot;body&quot; : msg_value,  
     &quot;group_id&quot; : groupID  
    }  
    , success: function (msg) { alert(&quot;Post was Successful!&quot;); }  
    , error: function (msg) { alert(&quot;Post was Unsuccessful&quot;); }  
    }  
    )  
 }  
</code></pre>
<p><span>The yamPostRequest function accept message body and group ID as form inputs, validate the inputs and POST the request to Yammer&#039;s messages REST endpoint.&nbsp;</span></p>
<p><span>Next, create the HTML form:</span></p>
<pre><code style="color:#000000">  &lt;form name=&quot;myForm&quot; method=&quot;get&quot; action=&quot;&quot;&gt;  
  &lt;table cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;0&quot;&gt;  
   &lt;tr&gt;  
   &lt;td align=&quot;right&quot;&gt;GroupID&lt;/td&gt;  
   &lt;td&gt;  
   &lt;input type=&quot;text&quot; name=&quot;group_id&quot; id=&quot;group_id&quot; /&gt;   
  &lt;/td&gt;  
  &lt;/tr&gt;  
  &lt;tr&gt;  
   &lt;td align=&quot;right&quot;&gt;Body&lt;/td&gt;  
   &lt;td&gt;  
   &lt;textarea rows=&quot;4&quot; cols=&quot;50&quot; name=&quot;msg_body&quot; id=&quot;msg_body&quot;&gt;&lt;/textarea&gt;  
  &lt;/td&gt;  
  &lt;/tr&gt;  
 &lt;tr&gt;  
  &lt;td align=&quot;right&quot;&gt;&lt;/td&gt;  
  &lt;td&gt;&lt;input type=&quot;button&quot; value=&quot;Post Message&quot; onclick =&quot;postMessage();&quot; /&gt;&lt;/td&gt;  
  &lt;/tr&gt;  
  &lt;/table&gt;  
 &lt;/form&gt;  
</code></pre>
<p><span>In all, your project layout should look like this -&nbsp;<a href="https://codio.com/iogbole/yam-jssdk-101" target="_blank">https://codio.com/iogbole/yam-jssdk-101</a><a href="https://codio.com/iogbole/yam-jssdk-101"><br /></a></span></p>
<p><span>That&#039;s all about the coding aspect, but an attempt to run your code will result to <span class="st"><em>Cross Origin Resource Sharing</em></span>&nbsp;(<a href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing" target="_blank">CORS</a>) error; so the next and final step is to open the registered app in Yammer and add the host name of your web server to the app&#039;s Javascript Origins:&nbsp;</span></p>
<p><span><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/jsorgin.png"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/jsorgin.png" border="0" alt=" " /></a><br /></span></p>
<p><span>&nbsp;</span></p>
<p><span>&nbsp;</span></p>
<p><span>Feel free to download the code from <a href="https://github.com/iogbole/yam_jssdk_101" target="_blank">github</a>, change the data-app-id value in script.js and Yammer-ON.&nbsp;</span></p>
<p><em><span>The next part of this blog will demonstrate how to GET contents from yammer using the Javascript SDK and AngularJS</span></em></p>
<p><span><a href="/b/israelo/archive/2015/02/24/consuming-yammer-restful-api-with-angularjs-for-dummies.aspx" title="Next -&amp;gt; Consuming Yammer RESTful API using AngularJS" target="_blank">Next -&gt; Consuming Yammer RESTful APIs using AngularJS</a>&nbsp;</span></p>


<p style="padding-left: 330px"><a href="https://twitter.com/intent/tweet?screen_name=israel_ogbole" class="twitter-mention-button">Tweet to @israel_ogbole</a><script src="//platform.twitter.com/widgets.js"></script></p>
[bing_translator]]]></content:encoded>
    </item>
    <item>
      <title>Creating Yammer Relying Party Trust in ADFS</title>
      <link>https://docs.microsoft.com/archive/blogs/israelo/creating-yammer-relying-party-trust-in-adfs</link>
      <pubDate>Fri, 08 Aug 2014 05:16:00 GMT</pubDate>
      <dc:creator><![CDATA[Israel Ogbole]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/israelo/2014/08/08/creating-yammer-relying-party-trust-in-adfs/</guid>
      <description><![CDATA[Yammer supports any SAML 2.0 compliant Identity Provider (IdP). These include ADF 2.0 &amp;...]]></description>
      <content:encoded><![CDATA[<p style="text-align:left"></p>
<p style="text-align:left"><span style="font-family:courier new,courier;font-size:medium">Yammer supports any SAML 2.0 compliant Identity Provider (IdP). These include ADF 2.0 &amp; 3.0,&nbsp; Windows Azure AD, Shibboleth,&nbsp;OneLogin,&nbsp;PingFed, Okta&nbsp;etc. The first step to implementing Single Sign-On (SSO) with Yammer is to open a yammer SSO service request. </span><span style="font-family:courier new,courier;font-size:medium">You will be asked to provide your IdP metadata and token signing certificate so you may want to speed up the&nbsp;data collection phase by providing the required files as soon as you open the service request. In the case of ADFS IdP, the metadata can be downloaded from&nbsp;- &nbsp;<a style="text-indent:0px;letter-spacing:normal" href="https://server/FederationMetadata/2007-06/FederationMetadata.xml"><span lang="EN-US">https://your-server-URL/FederationMetadata/2007-06/FederationMetadata.xml</span></a> and you may use this&nbsp;<a href="https://technet.microsoft.com/en-us/library/cc737522(v=WS.10).aspx" target="_blank">instruction</a> to extract the token signing certificate. You should zip the token signing certificate before sending it to&nbsp;the Yammer support rep. because <strong><em>.cer</em></strong> files are quarantined by Microsoft IT. </span><span style="font-family:courier new,courier;font-size:medium"><br /></span></p>
<p style="text-align:left"><span style="font-family:courier new,courier;font-size:medium"><br /></span><span style="font-family:courier new,courier;font-size:medium">Once you&rsquo;ve provided the required files,&nbsp;Yammer support will create the connection and respond back with the Yammer&nbsp;Service Provider (SP)&nbsp;metadata. At this point, the connection is&nbsp;inactive and&nbsp;there will be no impact on users&#039; experience.&nbsp;Download the metadata file and start the process of creating the relying party trust and claims rule as described below. </span></p>
<h4 style="text-align:justify"><strong><span style="font-family:courier new,courier;font-size:large">Add Relying Party Trust</span><span style="font-family:courier new,courier;font-size:large"><br /></span></strong></h4>
<ul>
<li style="text-align:left"><span style="font-family:courier new,courier;font-size:medium">In ADFS Management Console, navigate to Trust Relationships -&gt;Replying Party Trusts </span><span style="font-family:courier new,courier;font-size:medium"><br /></span></li>
</ul>
<p style="text-align:justify">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7462.1%20ADFS.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7462.1%20ADFS.png" border="0" /></a><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/1%20ADFS.png"></a></p>
<p style="text-align:justify"></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">Right Click Relying Party Trusts and click Add Relying Party Trust</span></li>
</ul>
<p style="text-align:justify">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"> <a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/2%20ADFS.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/2%20ADFS.png" border="0" /></a><br /></span><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><br /></span></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">Click Start</span></li>
</ul>
<p style="text-align:justify;margin-left:30px"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/3%20ADFS.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/3%20ADFS.png" border="0" /></a><br /></span></p>
<p style="text-align:justify"></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">Select &quot;Import data about the relying party from a file&quot;, browse to the metadata file&nbsp;that was provided by Yammer Support and click Next.</span></li>
</ul>
<p style="text-align:justify;margin-left:30px"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4%20ADFS.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4%20ADFS.png" border="0" /></a><br /></span></p>
<p style="text-align:justify"></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">Add a Display name (and Notes if necessary) and click Next</span></li>
</ul>
<p style="text-align:justify;margin-left:30px"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/5%20ADFS.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/5%20ADFS.png" border="0" /></a><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><br /></span></p>
<p style="text-align:justify"></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">Multi-factor authentication&nbsp;is not required, click&nbsp;Next&nbsp;</span></li>
</ul>
<p style="text-align:justify;margin-left:30px"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6%20ADFS.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/6%20ADFS.png" border="0" /></a><br /></span></p>
<p style="text-align:justify"></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">Permit all users to access this relying party, Next. </span></li>
</ul>
<p style="text-align:justify;margin-left:30px"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7%20ADFS.png"><img width="551" height="442" style="width:554px;height:442px" alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/7%20ADFS.png" border="0" /></a></span></p>
<p style="text-align:justify"></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">Check the Edit Claim Rules box</span><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><span style="font-family:courier new,courier;font-size:large"><br /></span></span></li>
</ul>
<p style="text-align:justify;margin-left:30px"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><span style="font-family:courier new,courier;font-size:large"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/8%20ADFS.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/8%20ADFS.png" border="0" /></a><br /></span></span></p>
<p style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><span style="font-family:courier new,courier;font-size:large">&nbsp;</span></span></p>
<h4 style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><span style="font-family:courier new,courier;font-size:large"></span></span><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><span style="font-family:courier new,courier;font-size:large"><strong>Edit Claim Rules for Relying Party Trust</strong><br /></span></span></h4>
<p style="text-align:justify"></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">In the Issuance Transform Rules tab, click Add Rule</span></li>
</ul>
<p style="text-align:justify;margin-left:30px"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/1%20Edit.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/1%20Edit.png" border="0" /></a></p>
<p style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">&nbsp;</span></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">In the Select Rule Template, leave &quot;Send LDAP Attributes as Claims&quot; selected</span></li>
</ul>
<p style="text-align:justify;margin-left:30px"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/2%20Edit.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/2%20Edit.png" border="0" /></a><span style="color:#000000;font-family:courier new,courier;font-size:medium"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none"><br /></span></span></p>
<p style="text-align:justify;margin-left:30px"></p>
<ul>
<li style="text-align:justify"><span style="text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;float:none">In the Configure Claim Rule page, enter <strong><em>Get attributes</em></strong> in the Claim rule name box</span></li>
</ul>
<ul>
<li style="font-size:11pt"><span style="color:#000000;font-family:Calibri"><span style="font-size:11pt"><span style="font-family:courier new,courier;font-size:medium">In the Attribute store list, select <em><strong>Active Directory</strong></em></span></span></span></li>
</ul>
<ul>
<li style="font-size:11pt"><span style="color:#000000;font-family:Calibri"><span style="font-size:11pt"><span style="font-family:courier new,courier;font-size:medium"><span style="color:#000000;font-family:Calibri"><span style="font-size:11pt"><span style="font-family:courier new,courier;font-size:medium">In the Mapping of LDAP attributes create the following mappings: </span><em><strong><span style="font-family:courier new,courier;font-size:medium">E-mail-Addresses - SAML_SUBJECT</span></strong></em><br class="_mce_tagged_br" /></span></span></span></span></span></li>
</ul>
<ul>
<li style="font-size:11pt"><span style="color:#000000;font-family:Calibri"><span style="font-size:11pt"><span style="font-family:courier new,courier;font-size:medium"><span style="color:#000000;font-family:Calibri"><span style="font-size:11pt"><span style="font-family:courier new,courier;font-size:medium">Click Finish<br /></span></span></span></span></span></span></li>
</ul>
<p style="margin-left:30px"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/3%20Edit.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/3%20Edit.png" border="0" /></a></p>
<div><span style="color:#000000;text-indent:0px;letter-spacing:normal;font-size:medium;float:none"><span style="font-family:courier new,courier">The outgoing claim type value (SAML_SUBJECT)&nbsp;is not listed in the drop down so it will need to be typed in and it is case-sensitive.&nbsp;</span> </span></div>
<h4><strong><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;font-style:normal;float:none"><br /></span><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:large;font-style:normal;float:none">Testing your&nbsp;Single Sign-On Connection</span></strong></h4>
<div><span style="color:#000000;text-indent:0px;letter-spacing:normal;font-size:medium;float:none"><span style="font-family:courier new,courier"> The concept of UAT environment does not exist in Yammer so you&#039;d need to test your SSO connection in your production network. Next steps are, d</span><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;float:none"><span style="font-family:courier new,courier">ecide on a suitable off-peak period to test SSO, give a heads up to your users by posting a yammer announcement. Plan your SSO test-case and then respond to Yammer support with&nbsp;the decided&nbsp;date and time. The test should last no more than 45mins if everything goes well</span> .&nbsp;</span> </span></div>
<div style="text-align:justify"><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;font-style:normal;float:none">&nbsp;</span></div>
<div style="margin-left:30px"><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;font-style:normal;float:none"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4%20Edit.png"><img width="551" height="361" style="width:596px;height:361px" alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/03/07/4%20Edit.png" border="0" /></a><br /></span></div>
<div><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;font-style:normal;float:none">&nbsp;</span></div>
<div><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;font-style:normal;float:none">&nbsp;</span></div>
<div><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;font-style:normal;float:none"><span style="font-family:Courier New;font-size:medium">At the end of the test, you may ask the Support representative to disable SSO connection to allow you to plan for a Go-Live date. Switching between SSO and non-SSO connection does not affect users&#039;&nbsp;contents and/or credentials. </span></span></div>
<p style="text-align:justify"><span style="color:#000000;line-height:normal;text-indent:0px;letter-spacing:normal;font-family:courier new,courier;font-size:medium;font-style:normal;float:none">Lastly, if you want to restrict yammer access to a subset of users, which is the main reason most customers use Yammer SSO instead of <a href="https://support.office.com/en-us/article/Office-365-sign-in-for-Yammer-b1745e3c-d4d7-4e20-a155-ebf85106b998?omkt=en-us&amp;ui=en-US&amp;rs=en-US&amp;ad=US" title="Office 365 sign-in for yammer" target="_blank">Office 365 sign-in for Yammer</a>, please refer to this <a href="/b/israelo/archive/2015/03/27/restricting-access-to-yammer-using-adfs-claims-transformation-rule.aspx" title="blog" target="_blank">blog</a>.&nbsp;</span></p>


<p style="padding-left: 330px"><a href="https://twitter.com/intent/tweet?screen_name=israel_ogbole" class="twitter-mention-button">Tweet to @israel_ogbole</a><script src="//platform.twitter.com/widgets.js"></script></p>
[bing_translator]]]></content:encoded>
    </item>
  </channel>
</rss>