<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Dr. Z's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/zxue/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/zxue/feed.xml</link>
    <description>Bits and Bytes that Matter to Developers</description>
    <lastBuildDate>Thu, 24 Jan 2019 19:23:06 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to Add a New Visual Studio Solution to an Existing VSTS Repository</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/how-to-add-a-new-visual-studio-solution-to-an-existing-vsts-repository</link>
      <pubDate>Mon, 30 Apr 2018 20:03:23 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=11395</guid>
      <description><![CDATA[You can follow instructions outlined in two articles below to create a new Git repo and run basic...]]></description>
      <content:encoded><![CDATA[<p>You can follow instructions outlined in two articles below to create a new Git repo and run basic Git commands.</p> <p>Create a new Git repo in your project<br><a href="https://docs.microsoft.com/en-us/vsts/git/create-new-repo?view=vsts">https://docs.microsoft.com/en-us/vsts/git/create-new-repo?view=vsts</a></p> <p>Get started with Git from the command line<br><a href="https://docs.microsoft.com/en-us/vsts/git/share-your-code-in-git-cmdline?view=vsts">https://docs.microsoft.com/en-us/vsts/git/share-your-code-in-git-cmdline?view=vsts</a> </p> <p>To add a new Visual Studio solution to an existing repository of <a href="https://www.visualstudio.com/vso/" target="_blank">Visual Studio Team Services</a> (VSTS, aka Visual Studio Online), you can use the <a href="https://docs.microsoft.com/en-us/vsts/git/gitquickstart?view=vsts&amp;tabs=visual-studio" target="_blank">Git add-on to Visual Studio</a>. </p> <p>Or, you can run the command lines as shown below. Note that I tested the command lines on my Windows 10 PC and Visual Studio 2017. Also, there is only one team project in the repository. </p> <p>&nbsp;</p> <p>Step 1 – Create and complete a new Visual Studio project</p> <p>For this blog post, I created a sample project called Ninja Care Twilio in Visual Studio 2017.</p> <p>&nbsp;</p> <p>Step 2 – Locate your VSTS repository and team&nbsp; project and download/create a local repo</p> <p>Navigate to the location where you’d like to add the local repo for the team project, e.g. c:\users\zxue\source\repos</p> <p><strong><font color="#000000">git clone </font></strong><a href="https://&lt;reponame&gt;.visualstudio.com/_git/&lt;projectname"><strong><font color="#000000">https://&lt;reponame&gt;.visualstudio.com/_git/&lt;projectname</font></strong></a><strong><font color="#000000">&gt;</font></strong></p> <p>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/04/image440.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb377.png" width="599" height="349"></a></p> <p>&nbsp;</p> <p>Step 3 – Add the new VS solution to the new local repo and make git aware of the changes to the local repo.</p> <p>Copy the new VS solution to the local repo with Windows Explorer or command line. </p> <p>In Git CMD, navigate to the local repo and check git status. You will notice the VS solution listed as “Untracked files.” The add the VS solution to the local repo and commit the changes. Note that you don’t need to run “git init .” because you have already initialized the local repo through the “git clone” command.</p> <p><strong>git status</strong></p> <p><strong>git add --all <br>git commit -m "add a new VS solution"</strong></p> <p><strong>git status</strong></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/04/image441.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb378.png" width="606" height="353"></a></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/04/image442.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb379.png" width="603" height="351"></a></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/04/image443.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb380.png" width="600" height="350"></a></p> <p>&nbsp;</p> <p>Step 4 – Sync up the changes to the team project in VSTS</p> <p><strong>git push origin master</strong></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/04/image444.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/04/image_thumb381.png" width="604" height="352"></a></p> <p>You should be all set. You can browse the VSTS portal to see that the new VS solution has been added to the team project.</p> <p>&nbsp;</p> <p>if you are not sure if you have set up the remote origin, you can run the command below.</p> <p><strong>git remote –v</strong></p> <p>If necessary, you can add a remote origin by running the command below. Replace the repository and team project name with yours. </p> <p><strong>git remote add origin </strong><a href="https://fabrikops2.visualstudio.com/DefaultCollection/Fabrikam/_git/FabrikamApp"><strong>https://fabrikops2.visualstudio.com/DefaultCollection/Fabrikam/_git/FabrikamApp</strong></a></p>]]></content:encoded>
    </item>
    <item>
      <title>How to Connect Your Bot App with Microsoft Cortana</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/how-to-connect-your-bot-app-with-microsoft-cortana</link>
      <pubDate>Fri, 09 Mar 2018 04:58:00 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=11285</guid>
      <description><![CDATA[You can create and deploy a Bot app, connect it to Cortana, and test the app with Cortana all...]]></description>
      <content:encoded><![CDATA[<p>You can create and deploy a Bot app, connect it to Cortana, and test the app with Cortana all through the Azure portal and your Windows 10 PC. No software or tool install required. Check out the steps outlined in “<a href="https://docs.microsoft.com/en-us/cortana/skills/get-started" target="_blank">Create your first skill</a>”.</p> <p>For .NET developers using Visual Studio, you can develop a Bot app by following instructions outlined in “<a href="https://docs.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-quickstart" target="_blank">Create a bot with the Bot Builder SDK for .NET</a>” and&nbsp; “<a href="https://docs.microsoft.com/en-us/bot-framework/bot-builder-overview-getstarted" target="_blank">Develop bots with Bot Builder</a>”. With “Bot Builder SDK v4”, which is being actively developed, developers can create bots in other popular programming languages like <a href="https://github.com/Microsoft/botbuilder-js">JavaScript</a>, <a href="https://github.com/Microsoft/botbuilder-python">Python</a>, and <a href="https://github.com/Microsoft/botbuilder-java">Java</a>.</p> <p>Once you’ve done testing the app with the botframework-Emulator running locally, you will need to publish the Bot app to Azure, create a Web App Bot or Bot Channels Registration, and then Connect to Cortana or other channels.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image104.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb92.png" width="774" height="437"></a></p> <p><strong></strong>&nbsp;</p> <p><strong>Publish your Bot to Azure</strong></p> <p>With Visual Studio 2017, you can publish your Bot directly to your Azure portal. You can either create a new Azure App Service or deploy over an existing one.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image105.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb93.png" width="779" height="440"></a></p> <p>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image106.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb94.png" width="776" height="438"></a></p> <p>&nbsp;</p> <p><strong>Create Bot Channels Registration</strong></p> <p>On the Azure portal, search on “Bot” and select Bot Channels Registration. Make sure that you enter the Messaging endpoint. Note: If you haven’t published the app to the portal yet, you can leave it blank and complete it later on.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image107.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb95.png" width="777" height="432"></a></p> <p>&nbsp;</p> <p><strong>Update your Visual Studio Bot project with Microsoft App ID and Password</strong></p> <p>Select the Bot Channel Registration (listed under Type in the resource group of your Azure portal), and select Settings as shown below. If you create the web app bot directly from the Azure portal, the service is listed under “Web App Bot” type. </p> <p>From the Setting page, you can update the Messaging endpoint. Also, you can see the Microsoft App ID here.</p> <p>To find the Microsoft App Password for the Bot, click on Manage. This opens the application registration portal, which is a separate portal but works seamlessly with the Azure portal now.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image108.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb96.png" width="774" height="411"></a></p> <p>&nbsp;</p> <p>Because the password is partially hidden, you will need to create a new one, make a note of it, and delete the old one.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image109.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb97.png" width="769" height="396"></a></p> <p>Now, go back to your Visual Studio, update the App ID and Password values in the web.config file. Then re-publish the app to the Azure portal.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image110.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb98.png" width="775" height="437"></a></p> <p>&nbsp;</p> <p><strong>Connect your Bot app to Cortana</strong></p> <p>Test your bot app with web chat, and fix any issue you find.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image111.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb99.png" width="771" height="372"></a></p> <p>Then, select Channels, and select Cortana, and click on register it with the organization you previously created in the knowledge store.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image112.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb100.png" width="772" height="420"></a></p> <p>If this is the first time you are using the knowledge store portal, you can create an organization there. Also, you can review the Cortana channels you have created.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image113.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb101.png" width="769" height="445"></a></p> <p><strong><br>Test your Bot with Cortana on your PC or Harmon Kardon Invoke device</strong></p> <p>You can either speak to Cortana or type in something like “Ask BenjaminChat” to initiate your Bot app. From there, you can speak or type in your questions and commands that your Bot app knows how to process. </p> <p><a href="https://msdnshared.blob.core.windows.net/media/2018/03/image114.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2018/03/image_thumb102.png" width="156" height="244"></a></p> <p>That’s all. It’s fun!</p>]]></content:encoded>
    </item>
    <item>
      <title>How to Fix It When Your Edge Browser or Office Apps Won’t Start Normally</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/how-to-fix-it-when-your-edge-browser-or-office-apps-wont-start-normally</link>
      <pubDate>Tue, 01 Aug 2017 16:39:14 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=11045</guid>
      <description><![CDATA[I noticed lately that the Edge browser or any Office app would occasionally try to start but end up...]]></description>
      <content:encoded><![CDATA[<p><font size="3">I noticed lately that the Edge browser or any Office app would occasionally try to start but end up with hanging there on my Windows 10 computer. Most of the times I would re-boot the machine to make the problem go away. But the trick didn’t work this time, and I had to find a resolution to the hanging issues.</font></p><p><font size="3">Initially I tried to stop the Edge app or Office app like Outlook or Word using Task Manager. But that didn’t help. Every time when I re-started Edge, it kept trying to refresh a web page at the below url but never could finish it. </font></p><p><font size="3"><a title="ms-appx-web://microsoft.microsoftedge/assets/errorpages/startfresh.html" href="//microsoft.microsoftedge/assets/errorpages/startfresh.html">ms-appx-web://microsoft.microsoftedge/assets/errorpages/startfresh.html</a></font></p><p><font size="3">After a few rounds of troubleshooting without success, it occurred to me that the Edge browser might be the culprit for the app hanging issue. In other words, if I could fix the Edge issue, my Office apps might just work fine. It turned out to be true in my case.</font></p><p><font size="3">The fix was rather simple: delete Edge cache and re-boot the machine.</font></p><p><font size="3">You can find the Edge cache at the location below, as mentioned in the discussion <a href="\Users\****\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\#!001\MicrosoftEdge\Cache" target="_blank">here</a>. Delete all subfolders in the folder. I had several of them.</font></p><p><font size="3"><font size="2">C:\Users\username\AppData\Local\Packages\Microsoft.MicrosoftEdge_somerandomecodehere\AC\#!001\MicrosoftEdge\Cache</font> </font></p><p><a href="https://msdnshared.blob.core.windows.net/media/2017/08/image91.png"><img width="774" height="517" title="image" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/08/image_thumb83.png" border="0"></a></p><p><font size="3">After rebooting my PC, the Edge browser and Office apps started normally, to my delight. </font></p><p><font size="3">I won’t guarantee that this simple fix will resolve any similar issue but it’s certainly one option you have. <font size="3">Please note that y</font><font size="3">ou may lose browser history by deleting Edge cache but you should still have your favorites and download history.</font></font></p><p><font size="3"><br></font></p>]]></content:encoded>
    </item>
    <item>
      <title>Azure Cosmos DB: Build a .NET application using the Table API</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/azure-cosmos-db-build-a-net-application-using-the-table-api</link>
      <pubDate>Thu, 01 Jun 2017 00:04:17 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=11035</guid>
      <description><![CDATA[You can follow the instructions here to get started. If you see something like “The remote server...]]></description>
      <content:encoded><![CDATA[<p><font size="3">You can follow the instructions <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/create-table-dotnet" target="_blank">here</a> to get started. If you see something like “The remote server returned an error. (400) Bad request.” you can fix it by choosing one of the two options below.</font></p> <p><font size="3"></font>&nbsp;</p> <p>Microsoft.WindowsAzure.Storage.StorageException occurred<br>&nbsp; HResult=0x80131500<br>&nbsp; Message=The remote server returned an error: (400) Bad Request.<br>&nbsp; Source=Microsoft.WindowsAzure.Storage<br>&nbsp; StackTrace:<br>&nbsp;&nbsp; at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)<br>&nbsp;&nbsp; at Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext)<br>&nbsp;&nbsp; at Microsoft.WindowsAzure.Storage.Table.CloudTable.Create(TableRequestOptions requestOptions, OperationContext operationContext)<br>&nbsp;&nbsp; at Microsoft.WindowsAzure.Storage.Table.CloudTable.CreateIfNotExists(TableRequestOptions requestOptions, OperationContext operationContext)<br>&nbsp;&nbsp; at TableSBS.Program.Run(CloudTableClient tableClient, Int32 numIterations) in C:\Users\zxue\Downloads\azure-cosmosdb\PremiumTableGetStarted\Program.cs:line 70<br>&nbsp;&nbsp; at TableSBS.Program.Main(String[] args) in C:\Users\zxue\Downloads\azure-cosmosdb\PremiumTableGetStarted\Program.cs:line 51</p> <p><font size="1">Inner Exception 1:<br>WebException: The remote server returned an error: (400) Bad Request.</font></p> <p><font size="1"></font>&nbsp;</p> <p><font size="3">1) Go to the Azure portal, create the “People” table and download the sample .NET app. It should just work because the app has the right connection string in the app.config file already.</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image.png"><font size="3"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb.png" width="662" height="443"></font></a></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">2) Open “Manage NuGet Packages” window, remove WindowsAzure.Storage-PremiumTable and re-install it.</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/06/image1.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/06/image_thumb1.png" width="658" height="440"></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Build Bot Applications to Improve Patient Services in Healthcare</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/build-bot-applications-to-improve-patient-services-in-healthcare</link>
      <pubDate>Wed, 10 May 2017 17:28:46 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=10955</guid>
      <description><![CDATA[There are many ways to improve patient services with technologies today. In this blog post, I will...]]></description>
      <content:encoded><![CDATA[<p><font size="3">There are many ways to improve patient services with technologies today. In this blog post, I will discuss how to build a bot application to provide real-time medication pricing for patients. Applications like this can be used by doctors who may need to let patients know at the point of care how much their prescriptions may cost and furthermore how much their insurance policies may cover, etc. </font></p> <p><font size="3"></font>&nbsp;</p> <p><a><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image162.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb153.png" width="411" height="260"></font></a></a><font size="3">&nbsp;&nbsp;&nbsp; </font><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image163.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb154.png" width="399" height="256"></font></a></p> <p><strong><font size="3"></font></strong>&nbsp;</p> <p><strong><font size="3">Creating the Bot App</font></strong></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">Using Visual Studio, I created a bot app that lists a list of medications for a patient, and for a given medication different prices from pharmacies. To keep it simple, I have two medications, </font><a href="https://www.goodrx.com/lipitor?drug-name=lipitor"><font size="3">Lipitor</font></a><font size="3"> and </font><a href="https://www.goodrx.com/crestor?drug-name=crestor"><font size="3">Crestor</font></a><font size="3">, in the bot app, and use prices publically available at GoodRx from HealthWharehouse, Membership warehouse, Target(CVS), Walmart, Sams Club, CVS Pharmacy, and Walgreens. All data including images is included in the VS solution. So there is no web service call. The source code, tested with Visual Studio 2017, Microsoft Bot Builder SDK, Microsoft Bot Connector, and Bot Framework Channel Emulator, is available at </font><a href="https://github.com/zxue/medpricingbotgithub" target="_blank"><font size="3">github</font></a><font size="3">. To learn how to get started with developing bot applications, check my </font><a href="https://blogs.msdn.microsoft.com/zxue/2017/03/04/integrate-bot-app-with-cognitive-services-luis-and-rest-services/" target="_blank"><font size="3">previous blog</font></a><font size="3">.</font></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">The solution consists of several components as shown below.</font></p> <p><font size="3">Models – Medication and LUISModel. They define data properties. The images are kept in the data folder.</font></p> <p><font size="3">Services - LUISService, MedicationService, PricingService. MedicationService returns list of medications whereas PricingService returns list of prices for a given medication.</font></p> <p><font size="3">Dialogs – MainDialog, ListMedicationDialog, ListPricingDialog. They essentially provide the user interface with the bot app.</font></p> <p><font size="3">MessagesController – The default method (Post). It displays a greeting message, and provides an entry point to the MainDialog.</font></p> <p><font size="3"></font>&nbsp;</p> <p><strong><font size="3">Wire up with Microsoft Cognitive Services – LUIS</font></strong></p> <p><strong><font size="3"></font></strong>&nbsp;</p> <p><font size="3">To help the Bot app understand a user’s input, for example, list medications for a patient, I used LUIS, one of Microsoft Cognitive Services available at luis.ai. I created a LUIS app with two Entities - PatientName, MedicationName, two Intents - ListMedication and GetMedicationPricing, and added a few utterances for each of them. </font></p> <p><font size="3"></font>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image164.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb155.png" width="578" height="214"></font></a><font size="3">&nbsp;</font><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image165.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb156.png" width="407" height="217"></font></a></p> <p><strong><font size="3"></font></strong>&nbsp;</p> <p><font size="3">And then train and publish the app. The endpoint url is added to the web.config file in Visual Studio solution.</font></p> <p><font size="3"></font>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image180.png"><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image181.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb157.png" width="492" height="529"></font></a></a></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">In Visual Studio, I used the GetIntentFromLUIS method to find the matching Intent or action, and then use it to open medication or pricing dialogs from the MainDialog.</font></p> <p><font size="3"></font>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image168.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb158.png" width="475" height="300"></font></a><font size="3">&nbsp;&nbsp; </font><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image169.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb159.png" width="358" height="259"></font></a></p> <p><font size="3"></font>&nbsp;</p> <p><strong><font size="3">Publish the Bot app to Azure App Service and Register it</font></strong></p> <p><strong><font size="3"></font></strong>&nbsp;</p> <p><font size="3">After testing the Bot app with the local emulator, I published it to Azure App Service and registered the app at dev.botframework.com. Make a note of the Bot app ID and password.</font></p> <p><strong><font size="3"></font></strong>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image170.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb160.png" width="449" height="335"></font></a><font size="3">&nbsp; </font><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image171.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb161.png" width="362" height="338"></font></a></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">After the successful publication, I enabled Bot Authentication in the MessagesController file, bot app info in the web.config file, and the image urls in the MedicationService. And re-publish the bot app. You can now test the Bot app with the web chat channel.</font></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">MessageController file</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image172.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb162.png" width="547" height="234"></font></a></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">Web.Config file</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image173.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb163.png" width="529" height="82"></font></a></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">MedicationService file</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image174.png"><font size="3"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb164.png" width="531" height="458"></font></a></p> <p>&nbsp;</p> <p><strong><font size="3">Add the Bot app to Skype</font></strong></p> <p><strong><font size="3"></font></strong>&nbsp;</p> <p><font size="3">Normally you’d add bot apps like this one to channels such <a href="https://skypeappregistration.azurewebsites.net" target="_blank">Skype for Business</a> (available in preview). For testing purposes I used Skype Desktop. </font></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">From my dev.botframework.com account, I clicked the Skype icon to add the app to my Skype desktop app. </font></p> <p><font size="3"></font>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image175.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb165.png" width="475" height="372"></a>&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/2017/05/image176.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb166.png" width="426" height="369"></a></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">The Bot app essentially became a new contact in my Skype desktop app, and I could talk to the Bot just like I would with a real person.</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/05/image177.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/05/image_thumb167.png" width="897" height="615"></a></p> <p>&nbsp;</p> <p><strong><font size="3">Connect the Bot app to Cortana</font></strong></p> <p><strong><font size="3"></font></strong>&nbsp;</p> <p><font size="3">To use Cortana in the Bot app, I needed <a href="https://developer.microsoft.com/en-us/cortana/" target="_blank">Cortana Skill</a>, which is currently in <em>private </em>preview. </font></p> <p><font size="3"></font>&nbsp;</p> <p><a href="https://developer.microsoft.com/en-us/cortana/" target="_blank"><img alt="High level overview of how users interact with Cortana skills" src="https://assets.windowsphone.com/ed083fad-8874-48c4-846f-497fcdafcaae/cortana-skills-kit-XL_InvariantCulture_Default.PNG"></a></p> <p><font size="3"></font>&nbsp;</p> <p><font size="3">From my <em>private</em> preview account, I configured a skill for the bot app. The process was rather simple. All I had to do was to specify the endpoint, which was a combination of “bot” and the registered Bot app name. From there, you could download the Cortana app on supported devices, for example, Android, log in to the app using the same account where the bot app was registered, and talk to Cortana using the invocation phase you configured, something like “Ask Medication Pricing.” If all configurations were done properly, you’d hear the beautiful Cortana voice and your Bot would start on the mobile device.</font></p> <p>&nbsp;</p> <p><font size="3"></font>&nbsp;</p> <p><font size="3"></font>&nbsp;</p> <p><font size="3"></font>&nbsp;</p> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><font size="3"></font></p>]]></content:encoded>
    </item>
    <item>
      <title>Get started with Azure Relay Hybrid Connections – Using Apache Thrift Listener</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/get-started-with-azure-relay-hybrid-connections-using-apache-thrift-listener</link>
      <pubDate>Wed, 05 Apr 2017 20:02:12 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=10655</guid>
      <description><![CDATA[The Azure Relay Hybrid Connections service enables you to securely expose services that reside...]]></description>
      <content:encoded><![CDATA[<p><font size="3">The </font><a href="https://docs.microsoft.com/en-us/azure/service-bus-relay/relay-what-is-it"><font size="3">Azure Relay Hybrid Connections service</font></a><font size="3"> enables you to securely expose services that reside on-prem to the public cloud, without having to open a firewall connection or require intrusive changes to a corporate network infrastructure. </font></p> <p><font size="3">You can follow the steps outlined in the document </font><a href="https://docs.microsoft.com/en-us/azure/service-bus-relay/relay-hybrid-connections-dotnet-get-started" target="_blank"><font size="3">Get started with Relay Hybrid Connections</font></a><font size="3">. </font></p> <p><font size="3">You can find another example at Github, </font><a href="https://github.com/Azure/azure-relay/tree/master/samples/Hybrid%20Connections/DotNet/thrift" target="_blank"><font size="3">Azure Relay Hybrid Connections - Apache Thrift Listener</font></a><font size="3">. When you update or add the reference to “Microsoft.Azure.Relay”, make sure that you use the dll in the net45 folder, not the dll in the netstandard1.3 folder. You can download the <a href="https://github.com/zxue/AzureRelayThrift" target="_blank">branch version at Github</a>.</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/04/image62.png"><font size="3"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/04/image_thumb59.png" width="744" height="371"></font></a></p> <p><font size="3">If you download the </font><a href="https://github.com/azure/azure-relay-dotnet" target="_blank"><font size="3">Azure Relay .NET project from Github</font></a><font size="3">, without using the Microsoft.Azure.Relay package from NuGet Package Manager, make sure that you have the same or newer .Net sdk version in the global.json file. For example, change it from "version": "1.0.0-preview2-0031<strong>2</strong>1" to "version": "1.0.0-preview2-0031<strong>3</strong>1" if you have version “1.0.0-preview2-0031<strong>3</strong>1” installed, which you can find from the control panel, “Programs and Features.”</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/04/image63.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/04/image_thumb60.png" width="748" height="503"></a></p> <p><font size="3">Also, if you create the namespace using the deployment template at the <a href="https://github.com/azure/azure-relay-dotnet" target="_blank">Github</a>, you get two hybrid connections, “Authenticated” which requires authentication on Azure and “Unauthenticated”, which doesn’t require authentication. You will get the default policy, <strong>RootManageSharedAccessKey </strong>for both connections. But you can create one shared access policy for “Authenticated” connection from the portal and choose the right permissions, “Manage”, “Listen” and “Send”.</font></p> <p><font size="2">{<br>&nbsp;&nbsp;&nbsp; "$schema": "</font><a href="http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#&quot;"><font size="2">http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"</font></a><font size="2">,<br>&nbsp;&nbsp;&nbsp; "contentVersion": "1.0.0.0",<br>&nbsp;&nbsp;&nbsp; "parameters": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "namespaceName": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": "string",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "metadata": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "description": "Name of the Azure Relay namespace"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp; "variables": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "location": "[resourceGroup().location]",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "apiVersion": "2016-07-01",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "defaultSASKeyName": "RootManageSharedAccessKey",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "defaultAuthRuleResourceId": "[resourceId('Microsoft.Relay/namespaces/authorizationRules', parameters('namespaceName'), variables('defaultSASKeyName'))]"<br>&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp; "resources": [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "apiVersion": "[variables('apiVersion')]",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "name": "[parameters('namespaceName')]",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": "Microsoft.Relay/Namespaces",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "location": "[variables('location')]",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "kind": "Relay",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "resources": [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "apiVersion": "[variables('apiVersion')]",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "name": "authenticated",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": "HybridConnections",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "dependsOn": [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "[concat('Microsoft.Relay/namespaces/', parameters('namespaceName'))]"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "properties": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "path": "authenticated"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "apiVersion": "[variables('apiVersion')]",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "name": "unauthenticated",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": "HybridConnections",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "dependsOn": [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "[concat('Microsoft.Relay/namespaces/', parameters('namespaceName'))]"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "properties": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "path": "unauthenticated",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "RequiresClientAuthorization": false<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "properties": {}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; ],<br>&nbsp;&nbsp;&nbsp; "outputs": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "NamespaceConnectionString": {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": "string",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "value": "[listkeys(variables('defaultAuthRuleResourceId'), variables('apiVersion')).primaryConnectionString]"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>}</font></p> <p>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/04/image64.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/04/image_thumb61.png" width="758" height="425"></a></p> <p><font size="3">Once that’s all done, you can build the client app (console app) and the server app (console app). Navigate to the folders where the apps, server.exe and client.exe, are located, and run the command lines below, each in its own console environment. The client app uses the calculator service to add, subtract, and divide two numbers, and the server app echo the results.</font></p> <p><strong><font size="3">server zxuerelay1.servicebus.windows.net authenticated policy1 8nawZQXyR3Fx82r+k5iV0wjrdgW2iPVs8/4bTu3Jqbo=</font></strong></p> <p><strong><font size="3">client zxuerelay1.servicebus.windows.net authenticated policy1 8nawZQXyR3Fx82r+k5iV0wjrdgW2iPVs8/4bTu3Jqbo=</font></strong></p> <p>&nbsp;</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/04/image65.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/04/image_thumb62.png" width="748" height="414"></a></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/04/image66.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/04/image_thumb63.png" width="736" height="406"></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Integrate Bot App with Cognitive Services LUIS, RESTful Services and Web APIs</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/integrate-bot-app-with-cognitive-services-luis-and-rest-services</link>
      <pubDate>Sat, 04 Mar 2017 05:17:28 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=10495</guid>
      <description><![CDATA[&nbsp; This post walks through the steps you take to integrate Cognitive Services – LUIS and RESTful...]]></description>
      <content:encoded><![CDATA[<p><font size="3"></font>&nbsp;</p> <p><font size="3">This post walks through the steps you take to integrate Cognitive Services – LUIS and RESTful services and web service APIs. The idea is to use LUIS to get the intent from user activity, and then call a RESTful service or web service API (e.g. Yahoo Finance API or OpenWeatherMap API) to get data for the user. You can find the source code at </font><a href="https://github.com/zxue/MyBotApp" target="_blank"><font size="3">GitHub</font></a><font size="3">.</font></p> <p><font size="3"><strong>Step 1</strong> – Create a Cognitive Service API Account</font></p> <p><font size="3">Go to </font><a href="http://portal.azure.com"><font size="3">http://portal.azure.com</font></a><font size="3">, and follow the steps at “</font><a href="https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account" target="_blank"><font size="3">Create a Cognitive Services APIs account in the Azure Portal</font></a><font size="3">”. Make a copy of Key 1 under Resource Management. You will need the key when you publish your LUIS app at next step.</font></p> <p><font size="3"><strong>Step 2</strong> – Create your LUIS app and Publish it</font></p> <p><font size="3">Go to </font><a title="https://www.luis.ai/applications" href="https://www.luis.ai/applications"><font size="3">https://www.luis.ai/applications</font></a><font size="3"> to create a Cognitive Service LUIS app. Add intents, entities, train and test the app, and publish the app. Use the key you obtained at Step 1 when publishing the app. You can find more detail </font><a href="https://www.microsoft.com/cognitive-services/en-us/LUIS-api/documentation/Add-intents" target="_blank"><font size="3">here</font></a><font size="3">. </font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/03/image32.png"><font size="3"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/03/image_thumb32.png" width="783" height="405"></font></a></p> <p><font size="3"><strong>Step 3</strong> – Create a Bot App using Visual Studio</font></p> <p><font size="3">Follow the steps </font><a href="https://docs.botframework.com/en-us/csharp/builder/sdkreference/gettingstarted.html" target="_blank"><font size="3">here</font></a><font size="3">. </font></p> <p><font size="3">Before Publishing your Bot Application to Microsoft Azure, test the app in the local </font><a href="https://blogs.msdn.microsoft.com/zxue/2017/01/16/use-bot-framework-emulator-correctly-to-test-your-bots/" target="_blank"><font size="3">bot framework emulator</font></a><font size="3">, which I discussed in a previous post.</font></p> <p><font size="3">Modify your Visual Studio project to integrate LUIS, and web service APIs. </font></p> <p><font size="3">a) Update values in the web.config file</font></p> <p><font size="3">b) Add model.cs, stockprice.cs and weatherservice.cs files</font></p> <p><font size="3">c) Update MessageController.cs file by adding three methods – GetIntentFromLUIS, GetStock and GetWeather and modifying the Post method as follows.</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/03/image33.png"><font size="3"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/03/image_thumb33.png" width="780" height="533"></font></a><br></p> <p><font size="3">Test the app in the local bot framework emulator again. Fix any error. You should be able to test it with “show me msft stock” and “show me weather in Seattle”. </font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/03/image31.png"><font size="3"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/03/image_thumb31.png" width="795" height="449"></font></a></p> <p><font size="3">You can now publish the app to Azure. See more detail at the section, “Publishing your Bot Application to Microsoft Azure”.</font></p> <p><font size="3">Also, you can finish the remaining steps.</font></p> <ul> <li><font size="3">Testing the connection to your bot</font></li> <li><font size="3">Registering your Bot with the Microsoft Bot Framework</font></li> <li><font size="3">Configuring Channels</font></li></ul> <p><font size="3"></font></p> <p><font size="3"></font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/03/image34.png"><font size="3"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/03/image_thumb34.png" width="776" height="464"></font></a></p> <p><font size="3"></font></p>]]></content:encoded>
    </item>
    <item>
      <title>Developing and Deploying a Service Fabric Voting App to Azure</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/developing-and-deploying-a-service-fabric-voting-app-to-azure</link>
      <pubDate>Sat, 25 Feb 2017 00:28:48 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=10465</guid>
      <description><![CDATA[While preparing for a partner meeting on Service Fabric, I went through two labs, Part I by the...]]></description>
      <content:encoded><![CDATA[<p><font size="3">While preparing for a partner meeting on Service Fabric, I went through two labs, <a href="https://blogs.msdn.microsoft.com/azureservicefabric/2016/07/06/introduction-to-service-fabric-lab-part-1/" target="_blank">Part I by the Service Fabric team</a> and <a href="http://blog.knor.net/index.php/2016/12/14/fan-sequel-introduction-to-service-fabric-lab-part-2/" target="_blank">Part II by my colleague Max Knor</a>, and created a working Voting app on Windows. </font><font size="3">If you are interested to learn how to develop a Service Fabric app, I highly recommend that you go through the labs. If just want to see how the app works and review the code, you can find the completed project at </font><a href="https://github.com/zxue/ServiceFabricVotingApp/" target="_blank"><font size="3">Github</font></a><font size="3">.</font></p> <p><font size="3">This simple app shows how a stateless service and a stateful service, two separate microservices, work together to accomplish the goal of tallying voting counts by candidate name. The stateless service provides a user interface (single page app) for data entry, and communicates with the stateful service through a remote client service proxy. The stateful service keeps track of voting counts by storing data in the Service Fabric built-in data collection, ReliableDictionary. Each stateful service comes with one Primary replica for read and write requests, and multiple active Secondary replicas for read only requests, to achieve high availability. No database or cache is used in the example. </font></p> <p><font size="3">The diagram below illustrates the high-level architecture of the Service Fabric Voting app. For more detail on Service Fabric, check out the <a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-overview" target="_blank">online</a> documentation or download the live <a href="https://docs.microsoft.com/pdfstore/en-us/Azure.azure-documents/live/service-fabric.pdf" target="_blank">pdf</a> file (about 800 pages).</font></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/image529.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/02/image_thumb476.png" width="782" height="300"></a></p> <p><font size="3">The lab documents provide detail on how to debug, test and upgrade the app and how to publish it to the local Service Fabric cluster in Visual Studio. In the post I will focus on deploying the app to Azure.</font></p> <p><font size="3"><strong>Step 1 – Create a Service Fabric cluster on Azure</strong></font></p> <p><font size="3">You can use the Azure portal or PowerShell scripts. If you want to secure the Service Fabric, you’ll need to create Azure Key Vault. If you don’t have commercially available certificates, you can create and use self-signed certificates. See the detail <a href="https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-creation-via-portal" target="_blank">here</a>.</font></p> <p><font size="3"><strong>Step 2 – Publish the app to the Service Fabric cluster</strong></font></p> <p>You can use Visual Studio to publish the app directly to Azure. Alternatively, you can create a package for the app, and then use PowerShell scripts to publish it to Azure.</p> <p>In Visual Studio, open Cloud.xml in PublishProfies in the app project. Replace &lt;ClusterConnectionParameters ConnectionEndpoint="" /&gt; with something similar to the following. Replace the ServerCertThumbprint value and FindValue with the thumbprint value you obtained at Step #1. Save the changes and go back to the Publish screen, you should be ready to publish the app to the cloud. If you have configured Azure AD for the cluster on Azure, use the ClusterConnectionParameters for Azure AD and make similar changes.<br></p> <p>&lt;ClusterConnectionParameters ConnectionEndpoint="mycluster.westus.cloudapp.azure.com:19000"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X509Credential="true"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServerCertThumbprint="<strong>0123456789012345678901234567890123456789</strong>"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FindType="FindByThumbprint"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FindValue="<strong>9876543210987654321098765432109876543210</strong>"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StoreLocation="CurrentUser"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StoreName="My" /&gt;<br></p> <p>&nbsp;</p> <p>In case you run into an error as shown here, ensure the value in Connection Endpoint is valid.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/image530.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/02/image_thumb477.png" width="772" height="524"></a></p> <p><strong>Step 3 – Launch Service Fabric Explorer</strong></p> <p>Open the browser and navigate to <a href="https://clustername.region.cloudapp.azure.com:19080/Explorer">https://clustername.region.cloudapp.azure.com:19080/Explorer</a> If you use a self-signed certificate, you can ignore the website security certificate warning. On the next screen, choose the same certificate that you uploaded to Azure Key Vault at Step 1.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/image531.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/02/image_thumb478.png" width="780" height="439"></a></p> <p>If you don’t see it on the list, as it happened to me because the certificate disappeared after initial use, open Internet Options in IE and import the pfx file you used at Step 1. Restart the process. </p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/image532.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/02/image_thumb479.png" width="777" height="437"></a></p> <p>You should now be able to see the Service Fabric Explorer, as you have seen the local version.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/image533.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/02/image_thumb480.png" width="777" height="438"></a></p> <p><strong>Step 4 – Configure the cluster load balancer</strong></p> <p>With the local cluster, you can access the user interface as shown above by accessing <a href="http://localhost:34001/api/index.html">http://localhost:34001/api/index.html</a> which you can find from the node of the stateless service. Now that the app is deployed on the Service Fabric cluster on Azure, the services including the single page app are running behind the load balancer. If you use the public IP address of the cluster and the port 20002, e.g. <a href="http://&lt;publicipaddress&gt;:20002/api/index.html">http://&lt;publicipaddress&gt;:20002/api/index.html</a>, which is made up of VMs in VM Scale Set, or the cluster address, <a href="http://clustername.region.cloudapp.azure.com:20002/api/index.html">http://clustername.region.cloudapp.azure.com:20002/api/index.html</a>, you will quickly find that the web app is not accessible. The reason is that either port 80 or port 20002, which you find from Service Fabric Explorer, is not set up for the load balancer.</p> <p>To address the port issue, go back to your Azure account and create two rules, one under Health Probes and one under Load balancing rules. The Health Probes rule uses TCP protocol to check the heath status of the node every 5 seconds. The Load balancing rule forwards the request from port 80 to a backend port 20002 which the stateless service is listening on. Choose LoadBalancerBEAddressPool for Backend pool, the newly created Health Probes rule for Health probe, and keep all default values for other fields. If you choose to enable Floating IP, the front port and backend port much match. </p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/image534.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/02/image_thumb481.png" width="430" height="401"></a><a href="https://msdnshared.blob.core.windows.net/media/2017/02/image535.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/02/image_thumb482.png" width="356" height="405"></a></p> <p>With that, you should be able to see the single page app. It is available via http, not https. You can secure the app using Azure AD.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2017/02/image536.png"><img title="image" style="border-top: 0px;border-right: 0px;border-bottom: 0px;padding-top: 0px;padding-left: 0px;border-left: 0px;margin: 0px;padding-right: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/02/image_thumb483.png" width="781" height="440"></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Use Bot Framework Emulator Correctly to Test Your Bots</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/use-bot-framework-emulator-correctly-to-test-your-bots</link>
      <pubDate>Mon, 16 Jan 2017 04:12:20 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=10275</guid>
      <description><![CDATA[Original Blog Date: January 16, 2017You can use the Bot Framework to build and connect bots to...]]></description>
      <content:encoded><![CDATA[<p>Original Blog Date: January 16, 2017</p><p><font size="3">You can use the Bot Framework to build and connect bots to interact with your users in apps (or communication channels) such as your website, Skype, Facebook Messenger, and Office 365 mail. Before or after deploying and publishing bots, you can use the </font><a href="https://docs.botframework.com/en-us/tools/bot-framework-emulator/" target="_blank"><font size="3">Bot Framework Emulator</font></a><font size="3"> to test them. In the post I will share a few tips on how to use the emulator correctly. </font></p>
<p><strong><font size="3">Install and use the latest version of the emulator</font></strong></p>
<p><font size="3">You can download the latest version (currently 3.5.23) at </font><a href="https://github.com/Microsoft/BotFramework-Emulator/releases" target="_blank"><font size="3">github</font></a><font size="3">. (At the time of writing the post the other download </font><a href="https://emulator.botframework.com/" target="_blank"><font size="3">link</font></a><font size="3"> didn’t seem to be working.) If you have the older version, </font><a href="https://download.botframework.com/botconnector/tools/emulator/publish.htm" target="_blank"><font size="3">1.0.0.73</font></a><font size="3">, on your Windows computer, you should replace it.</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image317.png"><font size="3"><img width="374" height="262" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb256.png" border="0"></font></a><font size="3">&nbsp;&nbsp;&nbsp;&nbsp; </font><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image318.png"><font size="3"><img width="340" height="257" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb257.png" border="0"></font></a></p>
<p><strong><font size="3"></font></strong>&nbsp;</p>
<p><strong><font size="3">Test a Bot Connected to Azure Bot Service in the Emulator</font></strong></p>
<p><font size="3">With an Azure subscription, you can create a bot through the Azure portal by following the instructions </font><a href="https://docs.botframework.com/en-us/azure-bots/build/first-bot/" target="_blank"><font size="3">here</font></a><font size="3">. You can test the bot directly through the portal chat channel as shown below.</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image319.png"><font size="3"><img width="736" height="415" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb258.png" border="0"></font></a></p>
<p><font size="3">To test the same bot in the emulator, you will need to find the end point, application ID and password for the bot service. The Settings tab only provides the partial message endpoint (ending with three dots). Therefore you will need to go to the developer site, </font><a title="https://dev.botframework.com/" href="https://dev.botframework.com/"><font size="3">https://dev.botframework.com/</font></a><font size="3">. Click on the Edit link. You will find the message endpoint there. Copy the entire URL and enter it in the emulator. Also, copy and paste the application ID and password from the bot developer portal.</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image320.png"><font size="3"><img width="324" height="253" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb259.png" border="0"></font></a><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image322.png"><font size="3"><img width="413" height="255" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb260.png" border="0"></font></a></p>
<p><font size="3">You will also need to download free utility, </font><a href="https://github.com/Microsoft/BotFramework-Emulator/wiki/Tunneling-(ngrok)" target="_blank"><font size="3">ngrok</font></a><font size="3">, which creates a tunnel between the bot hosted remotely (in this case on Azure) and your computer behind the firewall. Click App Settings in the emulator. Browse to the location where ngrok.exe is located. Save the setting. The utility will be launched automatically from the emulator. At this point, the emulator is ready. Click “Connect” or the refresh icon. Type something in the input box. You’ll see a response.</font></p>
<p><font size="3"></font>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image323.png"><font size="3"><img width="735" height="416" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb261.png" border="0"></font></a></p>
<p><strong><font size="3"></font></strong>&nbsp;</p>
<p><strong><font size="3">Test a Bot Connected to localhost in the Emulator</font></strong></p>
<p><font size="3">You can use Visual Studio to create a bot using the Bot Framework Connector SDK .NET template. See detailed instructions </font><a href="https://docs.botframework.com/en-us/csharp/builder/sdkreference/gettingstarted.html" target="_blank"><font size="3">here</font></a><font size="3">. </font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image324.png"><font size="3"><img width="728" height="412" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb262.png" border="0"></font></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image325.png"><font size="3"><img width="726" height="338" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb263.png" border="0"></font></a></p>
<p><font size="3">Note that the documentation is a bit outdated. It still shows the old emulator interface. It refers the portal to 3978. Your bot app actually uses port 3979. It says you can leave the application ID and application password blank, but the emulator (version 3.5.23) asks you for application ID and password.</font></p>
<p><font size="3">If you just want to test the bot locally with the emulator, without registering the bot and publishing it to Azure, you can supply the application ID and password in your Visual Studio project code. Interestingly, you have to provide a valid application ID and password, not something random. </font></p>
<p><font size="3">- If you leave the values of MicrosoftAppId and MicrosoftAppPassword blank, you will receive an error: “The bot's MSA appId or passsword is incorrect. Click here to edit your bot's MSA info.”</font></p>
<p><font size="3">- If you set the value of MicrosoftAppId to “MyApp” and MicrosoftAppPassword to “12345”, you will received an errror: “Refresh access token failed with status code: 400”</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image326.png"><font size="3"><img width="357" height="203" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb264.png" border="0"></font></a><font size="3">&nbsp; </font><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image327.png"><font size="3"><img width="355" height="202" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb265.png" border="0"></font></a></p>
<p><font size="3"></font>&nbsp;</p>
<p><font size="3">I used the same application ID and password from the bot I created from the Azure portal. And it worked. Note that ngrok is not required for local message service.</font></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/2017/01/image328.png"><font size="3"><img width="729" height="412" title="image" style="border: 0px currentcolor;padding-top: 0px;padding-right: 0px;padding-left: 0px" alt="image" src="https://msdnshared.blob.core.windows.net/media/2017/01/image_thumb266.png" border="0"></font></a></p>
<p><font size="3"></font>&nbsp;</p>
<p><font size="3"></font>&nbsp;</p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>
<p><font size="3"></font></p>]]></content:encoded>
    </item>
    <item>
      <title>Adding HTTPS Support to Individual Windows Containers Using Self Issued Certificates</title>
      <link>https://docs.microsoft.com/archive/blogs/zxue/adding-https-support-to-individual-windows-containers-using-self-issued-certificates</link>
      <pubDate>Mon, 19 Dec 2016 20:50:27 GMT</pubDate>
      <dc:creator><![CDATA[Benjamin Xue]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/zxue/?p=10045</guid>
      <description><![CDATA[There are two types of Windows Containers you can work with Windows Server Containers and Windows...]]></description>
      <content:encoded><![CDATA[<p><font size="3">There are two types of Windows Containers you can work with <strong>Windows Server Containers and Windows Hyper-V Containers. </strong>While a Windows Server container shares a kernel with the container host and all containers running on the host, the kernel of the container host is not shared with the Hyper-V Containers, which results in expanded benefit of isolation between container host and containers. You can create Windows Containers using docker run, dockerfile and build, and docker compose. You can find more detail at </font><a href="https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_images" target="_blank"><font size="3">Container Images on Windows Server</font></a><font size="3">, and <a href="https://github.com/docker/labs/blob/master/windows/windows-containers/MultiContainerApp.md" target="_blank">Multi-Container Applications</a>, a sample Music Store application with Windows containers. In this post </font><font size="3">I will focus on adding HTTPS support to Windows Containers using self-issued certificates for testing purpose. Note that I used a VM running Windows Server 2016 with Containers on Azure.</font>  <p><font size="3">Note: Docker Compose is supported on Windows Server 2016. You can download the tool at </font><a href="https://docs.docker.com/docker-for-windows/"><font size="3">https://docs.docker.com/docker-for-windows/</font></a><font size="3"> or </font><a href="https://github.com/docker/compose/releases"><font size="3">https://github.com/docker/compose/releases</font></a><font size="3"> and rename it to docker-compose.exe. Also, you can install it by using Invoke-WebRequest. Detail at </font><a href="https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/"><font size="3">https://blog.docker.com/2016/09/build-your-first-docker-windows-server-container/</font></a> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image467.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb415.png" width="781" height="441"></a>  <p><font size="3"></font>&nbsp; <p><font size="3"><strong>Option 1 – use docker run command</strong></font>  <p><strong>docker run -ti --entrypoint cmd -p 80:80 -p 443:443 -h myweb -v c:\demo\appfiles:c:\temp microsoft/aspnet</strong></p> <p>Note that a few options are used in the command line. “-it” option is for an interactive session, “-p” for ports mapping, and “-v” for volume mapping between the local folder on the vm named demo to the container folder named temp. Using ipconfig to find the local ip address of the container, you can access the app hosted at “Default Web Site” via http, but not https. The reason is that no security certificate has been assigned to the web site.  <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image468.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb416.png" width="396" height="225"></a><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image469.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb417.png" width="390" height="221"></a>  <p>Use the following PowerShell script to create a new certificate, add it to the trusted root of the certificate store on the container, bind it to port 443. Note that the <strong>New-SelfSignedCertificate</strong> cmdlet creates a self-signed certificate for testing purposes. It is a successor to the makecert tool. You can find more info on the tool <a href="https://technet.microsoft.com/en-us/library/hh848633.aspx" target="_blank">here</a>.  <p><strong>import-module webadministration<br>#Get-Module -ListAvailable </strong></p> <p><strong>cd cert:<br>$cert = New-SelfSignedCertificate -DnsName&nbsp; myweb -Friendlyname MyCert -CertStoreLocation Cert:\LocalMachine\My<br>$rootStore = New-Object System.Security.Cryptography.X509Certificates.X509Store -ArgumentList Root, LocalMachine<br>$rootStore.Open("MaxAllowed")<br>$rootStore.Add($cert)<br>$rootStore.Close()</strong></p> <p><strong>cd iis:<br>new-item -path IIS:\SslBindings\0.0.0.0!443 -value $cert<br>New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https<br>iisreset</strong></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image470.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb418.png" width="771" height="435"></a></p> <p>Refresh the https web page. It should be assessable now.&nbsp; Note that you may get a security certificate warning even though the certificate has been added to the trusted root. (The same script worked on on my local IIS server and I didn’t get certificate warning or error.) The reason is that it is a self-issued certificate, which, unlike commercially available certificates, is not countersigned by a trusted authority.</p> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image471.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb419.png" width="781" height="441"></a></p> <p><font size="3"><strong></strong></font>&nbsp; <p><font size="3"><strong>Option 2 – Use dockerfile published at <a href="https://github.com/Microsoft/Virtualization-Documentation/blob/live/windows-container-samples/iis-https/Dockerfile" target="_blank">github</a></strong></font>  <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image472.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb420.png" width="779" height="440"></a>  <p>First, create a container using my own docker id named xuedocker.  <p><strong>docker build -t xuedocker/iishttps .\</strong>  <p><strong>docker images</strong>  <p><strong>docker run -it --entrypoint cmd -p 80:80 -p 443:443 -h myweb -v c:\demo\appfiles:c:\temp xuedocker/iishttps</strong>  <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image473.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb421.png" width="782" height="442"></a>  <p>&nbsp; <p>Then, copy a sample htm file from the mapped temp folder to c”\iputnet\wwwroot on the container. The sample app is accessible through http or https.  <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image474.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb422.png" width="363" height="206"></a><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image475.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb423.png" width="369" height="209"></a>  <p>Note the security certificate warning. This is because the certificate is not present in your container’s trusted root certificate authorities. Because containers do not provide your regular Windows user interface, you won’t be able to check if the certificate is in the root certificate folder through certificate manager as shown below.  <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image476.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb424.png" width="726" height="410"></a>  <p>However, you can run PowerShell commands to verify its existence or absence.  <p><strong>import-module webadministration</strong>  <p><strong>cd cert:</strong>  <p><strong>cd localmachine</strong>  <p><strong>cd my</strong>  <p><strong>dir</strong>  <p><strong>cd..</strong>  <p><strong>cd root</strong>  <p><strong>dir</strong>  <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image477.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb425.png" width="728" height="411"></a>  <p>To add the self-signed certificate to the trusted root, use the PowerShell commands by referencing the certificate’s thumbprint  <p><strong>$cert = cert:\localmachine\my\gci EB61F71C77E561B2148F9F207A3468BAF794DF07</strong></p> <p><strong>$rootStore = New-Object System.Security.Cryptography.X509Certificates.X509Store -ArgumentList Root, LocalMachine</strong></p> <p><strong>$rootStore.Open("MaxAllowed")</strong></p> <p><strong>$rootStore.Add($cert)</strong></p> <p><strong>$rootStore.Close()</strong></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image478.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb426.png" width="754" height="426"></a>  <p>The certificate is now added to the trusted root. Note that the certificate was bound to port 443 already, executing commands below returns errors.  <p><strong>cd iis:<br>new-item -path IIS:\SslBindings\0.0.0.0!443 -value $cert<br>New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https<br>iisreset</strong></p> <p><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image479.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb427.png" width="383" height="217"></a><a href="https://msdnshared.blob.core.windows.net/media/2016/12/image480.png"><img title="image" style="border-left-width: 0px;border-right-width: 0px;border-bottom-width: 0px;padding-top: 0px;padding-left: 0px;padding-right: 0px;border-top-width: 0px" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/2016/12/image_thumb428.png" width="374" height="212"></a>  <p>Option 3 – Use import-certificate and import-pfxcertificate methods  <p>If you work with commercially available certificates, you can import certificates to the containers using <a href="https://technet.microsoft.com/en-us/library/hh848630.aspx" target="_blank">import-certificate</a> and <a href="https://technet.microsoft.com/en-us/library/hh848625.aspx" target="_blank">import-pfxcertificate</a> methods. I will provide more detail once I have tested this option.  <p>&nbsp; <p>Lastly, my colleague Patrick Lang, senor program manager on the Windows Container team, mentioned a couple other approaches related to SSL and containers.  <p><strong>SSL Load balancer.</strong> With this option, an SSL load balancer handles decryption of requests and encryption of responses on behalf of the web server or the container.  <p>More info at <a title="https://www.nginx.com/resources/glossary/ssl-load-balancer/" href="https://www.nginx.com/resources/glossary/ssl-load-balancer/">https://www.nginx.com/resources/glossary/ssl-load-balancer/</a> and <a title="https://dzone.com/articles/load-balancing-containers-with-docker-swarm-and-ng" href="https://dzone.com/articles/load-balancing-containers-with-docker-swarm-and-ng">https://dzone.com/articles/load-balancing-containers-with-docker-swarm-and-ng</a>  <p><strong>Secure storage in Docker v1.13.</strong> With this feature, a possible workflow would be something like this.  <ol> <li>Create certificates through whatever existing means you have  <li>Export as PKCS#7 or any other format that can be represented as ascii text  <li>Docker secret create … to store the certificate in the raft  <li>Create a script or EXE to run inside the container that:  <ol> <li>Finds the certificate passed in  <li>Imports it to the Windows certificate store </li></ol> <li>Finishes configuring IIS or other services</li></ol> <p>More info at <a title="https://lostechies.com/gabrielschenker/2016/11/25/docker-and-swarmkit-part-6-new-features-of-v1-13/" href="https://lostechies.com/gabrielschenker/2016/11/25/docker-and-swarmkit-part-6-new-features-of-v1-13/">https://lostechies.com/gabrielschenker/2016/11/25/docker-and-swarmkit-part-6-new-features-of-v1-13/</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>