diff --git a/Samples/CommsSamples.sln b/Samples/CommsSamples.sln index 6c78be4d..fee10c38 100644 --- a/Samples/CommsSamples.sln +++ b/Samples/CommsSamples.sln @@ -49,6 +49,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E5ADF206-0845-436D-8A70-826DE8082A8C}" ProjectSection(SolutionItems) = preProject ..\changelog.md = ..\changelog.md + configure_cloud.ps1 = configure_cloud.ps1 ..\LICENSE = ..\LICENSE ..\README.md = ..\README.md EndProjectSection @@ -57,7 +58,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "V1.0Samples", "V1.0Samples" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LocalMediaSamples", "LocalMediaSamples", "{A6303F54-64FF-4FFC-921C-3F383D26F807}" ProjectSection(SolutionItems) = preProject - V1.0Samples\LocalMediaSamples\configure_cloud.ps1 = V1.0Samples\LocalMediaSamples\configure_cloud.ps1 V1.0Samples\LocalMediaSamples\E-SDK Samples.postman_collection.json = V1.0Samples\LocalMediaSamples\E-SDK Samples.postman_collection.json V1.0Samples\LocalMediaSamples\README.md = V1.0Samples\LocalMediaSamples\README.md EndProjectSection diff --git a/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/WorkerRole/app.config b/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/WorkerRole/app.config index aa8b46e3..2867158f 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/WorkerRole/app.config +++ b/Samples/V1.0Samples/LocalMediaSamples/AudioVideoPlaybackBot/WorkerRole/app.config @@ -75,7 +75,7 @@ - + diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/ARM_Deployment/AzureDeploy.Parameters.json b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/ARM_Deployment/AzureDeploy.Parameters.json index 7e3e5e1b..234ea3ae 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/ARM_Deployment/AzureDeploy.Parameters.json +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/ARM_Deployment/AzureDeploy.Parameters.json @@ -6,7 +6,7 @@ "value": "westus" }, "clusterName": { - "value": "huebotsf02" + "value": "%BotNameLower%" }, "adminUserName": { "value": "huebot" @@ -63,4 +63,4 @@ "value": "Standard_D2_V2" } } -} \ No newline at end of file +} diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/ARM_Deployment/AzureDeploy.json b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/ARM_Deployment/AzureDeploy.json index 2c91966b..71bdb425 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/ARM_Deployment/AzureDeploy.json +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/ARM_Deployment/AzureDeploy.json @@ -445,8 +445,8 @@ "frontendIPConfiguration": { "id": "[variables('lbIPConfig0')]" }, - "frontendPortRangeEnd": "8100", - "frontendPortRangeStart": "8000", + "frontendPortRangeEnd": "8545", + "frontendPortRangeStart": "8445", "protocol": "tcp" } }, diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/Bot/Bot.cs b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/Bot/Bot.cs index 22e13a11..c83b7737 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/Bot/Bot.cs +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/Bot/Bot.cs @@ -338,7 +338,7 @@ private MediaPlatformSettings MediaInit(BotOptions options, StatefulServiceConte { CertificateThumbprint = options.Certificate, InstanceInternalPort = serviceContext.CodePackageActivationContext.GetEndpoint("MediaPort").Port, - InstancePublicIPAddress = new IPAddress(0x0), //// instanceAddresses[0], + InstancePublicIPAddress = instanceAddresses[0], InstancePublicPort = publicMediaUrl.Port + instanceNumber, ServiceFqdn = publicMediaUrl.Host, }, diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/PackageRoot/ServiceManifest.xml b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/PackageRoot/ServiceManifest.xml index 97e8ca49..d63c639f 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/PackageRoot/ServiceManifest.xml +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/PackageRoot/ServiceManifest.xml @@ -15,7 +15,7 @@ Startup.cmd - + 8445 ABC0000000000000000000000000000000000CBA CodePackage @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/appsettings.json b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/appsettings.json index 736c4141..50b233a0 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/appsettings.json +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBot/appsettings.json @@ -10,8 +10,8 @@ "Bot": { "AppId": "%AppId%", "AppSecret": "%AppSecret%", - "BotBaseUrl": "https://huebotsxxxxx.xxxx.cloudapp.azure.com:9444/api/calls", - "BotMediaProcessorUrl": "net.tcp://huebotsxxxxx.xxxx.cloudapp.azure.com:8445", + "BotBaseUrl": "https://%CName%:9444/api/calls", + "BotMediaProcessorUrl": "net.tcp://%ServiceDns%:8445", "Certificate": "ABC0000000000000000000000000000000000CBA", "PlaceCallEndpointUrl": "https://graph.microsoft.com/beta" } diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/ApplicationPackageRoot/ApplicationManifest.xml b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/ApplicationPackageRoot/ApplicationManifest.xml index 0126f81e..bb064365 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/ApplicationPackageRoot/ApplicationManifest.xml +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/ApplicationPackageRoot/ApplicationManifest.xml @@ -59,4 +59,4 @@ - \ No newline at end of file + diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/ApplicationParameters/Cloud.xml b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/ApplicationParameters/Cloud.xml index 58b60f1b..91066421 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/ApplicationParameters/Cloud.xml +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/ApplicationParameters/Cloud.xml @@ -1,8 +1,8 @@ - + - \ No newline at end of file + diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/PublishProfiles/Cloud.xml b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/PublishProfiles/Cloud.xml index c3b3d09c..46ca5e5f 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/PublishProfiles/Cloud.xml +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/HueBotSF/PublishProfiles/Cloud.xml @@ -20,10 +20,10 @@ AzureActiveDirectory="true" ServerCertThumbprint="0123456789012345678901234567890123456789" /> --> - + - \ No newline at end of file + diff --git a/Samples/V1.0Samples/LocalMediaSamples/HueBot/README.md b/Samples/V1.0Samples/LocalMediaSamples/HueBot/README.md index d8fc30a8..4a282103 100644 --- a/Samples/V1.0Samples/LocalMediaSamples/HueBot/README.md +++ b/Samples/V1.0Samples/LocalMediaSamples/HueBot/README.md @@ -38,10 +38,13 @@ For running locally, we need to use a tunneling mechanism to route traffic to yo * Create a wildcard certificate. For instance, if your bot is hosted at `bot.contoso.com`, create the certificate for `*.contoso.com`. 1. [Azure] Upload the certificate to your key-vault instance. + ![ConfigureCert1](Images/ConfigureCert1.png) + ![ConfigureCert1](Images/ConfigureCert2.png) 1. [Azure] Copy the Secret Identifier to be used later. + ![ConfigureCert1](Images/ConfigureCert3.png) 1. Install the certificate to the LocalMachine/My certificate folder on your dev machine, including the private keys. Save the thumbprint for later. @@ -62,6 +65,7 @@ For running locally, we need to use a tunneling mechanism to route traffic to yo ``` 1. Start ngrok: `ngrok.exe start -all -config %replace_with_path_to_your_ngrok.yml%`. You will see an output like this: + ![ngrokScreenshot](Images/ngrokScreenshot.png) 1. From **your** output, note the 3 values in the places marked in red above. From now on, we will call them by these names: @@ -73,11 +77,29 @@ For running locally, we need to use a tunneling mechanism to route traffic to yo ### Code +* Run the `configure_cloud.ps1` script to configure your application. + * Open a powershell session and navigate to the `/Samples` folder. + * Run the following command + + ```Powershell + .\configure_cloud.ps1 -p .\V1.0Samples\LocalMediaSamples\HueBot ` + -dns {full cluster name: huebotxxxxx.xxxx.cloudapp.azure.com} ` + -cn {full cluster name: huebotxxxxx.xxxx.cloudapp.azure.com} ` + -thumb ABC0000000000000000000000000000000000CBA ` + -bid {bot/cluster name: HueBotxxxxx} ` + -aid {application id created during registration} ` + -as {application secret created during registration} + ``` + +Alternatively, you can configure your solution manually. + * Open the `HueBot.sln` in Visual Studio 2017 and search/replace these values: * `%AppId%` and `%AppSecret%` that you obtained during application registration. - * Replace all `huebotsxxxxx.xxxx.cloudapp.azure.com` with your full cluster name. + * `%BotNameLower%` with your desired service fabric cluser name. + * Replace all `%ServiceDns%` with your full cluster name (I.E. huebotxxxxx.xxxx.cloudapp.azure.com). + * Replace all `%CName%` with your full cluster name (I.E. huebotxxxxx.xxxx.cloudapp.azure.com). * Replace all certificate thumbprint `ABC0000000000000000000000000000000000CBA` with your certificate. - * in HueBot/PackageRoot/ServiceManifest.xml file, for Startup.cmd, add `8445 your certificate thumbprint` for \. For example \`8445 ABC0000000000000000000000000000000000CBA`\ + ### Deploy #### [Azure] deployment @@ -129,12 +151,11 @@ Click `Start` on the top toolbar to deploy the sample to the local cluster. ##### Request ```json - POST https://huebotsxxxxx.xxxx.cloudapp.azure.com:9441/joinCall + POST https://huebotxxxxx.xxxx.cloudapp.azure.com:9441/joinCall Content-Type: application/json { - "JoinURL": "https://teams.microsoft.com/l/meetup-join/...", - "TenantId": "72f988bf-..." + "JoinURL": "https://teams.microsoft.com/l/meetup-join/..." } ``` @@ -145,11 +166,11 @@ Click `Start` on the top toolbar to deploy the sample to the local cluster. Content-Type: application/json { - "callURL": "https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663/", - "callSnapshotURL": "https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663/scr", - "callHueURL": "https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663/hue", - "callsURL": "https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/calls/", - "serviceLogsURL": "https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/logs/" + "callURL": "https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663/", + "callSnapshotURL": "https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663/scr", + "callHueURL": "https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663/hue", + "callsURL": "https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/calls/", + "serviceLogsURL": "https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/logs/" } ``` @@ -157,20 +178,20 @@ Click `Start` on the top toolbar to deploy the sample to the local cluster. ##### Request ```json - PUT https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663/hue + PUT https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663/hue Content-Type: application/json "green" ``` 1. Get diagnostics data from the bot. Open the links in a browser for auto-refresh. Replace the call id 321a0b00-84de-415b-a31b-bdd1b0abe663 below with your call id from the first response. - Call logs: https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/logs/321a0b00-84de-415b-a31b-bdd1b0abe663/ - Active calls: https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/calls - Service logs: https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/logs + Call logs: https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/logs/321a0b00-84de-415b-a31b-bdd1b0abe663/ + Active calls: https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/calls + Service logs: https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/logs 1. Terminating the call through `DELETE`. Replace the call id 321a0b00-84de-415b-a31b-bdd1b0abe663 below with your call id from the first response. ##### Request ```json - DELETE https://huebotsxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663 + DELETE https://huebotxxxxx.xxxx.cloudapp.azure.com:9445/calls/321a0b00-84de-415b-a31b-bdd1b0abe663 ``` diff --git a/Samples/configure_cloud.ps1 b/Samples/configure_cloud.ps1 index 5c8508c3..f4509a76 100644 --- a/Samples/configure_cloud.ps1 +++ b/Samples/configure_cloud.ps1 @@ -56,7 +56,7 @@ param( Write-Output 'Microsoft BotBuilder Enterprise SDK - Azure Cloud Configurator' -$Files = "ServiceConfiguration.Cloud.cscfg", "ServiceConfiguration.Local.cscfg", "app.config", "appsettings.json" +$Files = "ServiceConfiguration.Cloud.cscfg", "ServiceConfiguration.Local.cscfg", "app.config", "appsettings.json", "cloud.xml", "ServiceManifest.xml", "ApplicationManifest.xml", "AzureDeploy.Parameters.json" [System.Collections.ArrayList]$FilesToReplace = @() foreach($file in $Files) @@ -143,7 +143,8 @@ foreach($file in $FilesToReplace) ReplaceInFile $file "%ServiceDns%" $ServiceDns ReplaceInFile $file "%CName%" $CName ReplaceInFile $file "ABC0000000000000000000000000000000000CBA" $CertThumbprint - ReplaceInFile $file "%BotId%" $BotName + ReplaceInFile $file "%BotName%" $BotName + ReplaceInFile $file "%BotNameLower%" $BotName.ToLower() ReplaceInFile $file "%AppId%" $AppId ReplaceInFile $file "%AppSecret%" $AppSecret }