From 00dbaef88e9b54c8316bba89007e4564d25a7358 Mon Sep 17 00:00:00 2001 From: David COPPET Date: Fri, 16 Mar 2018 15:07:24 +0100 Subject: [PATCH 01/11] Adding ARM Template to create Mobile App with code deployment from github Adding Azure Deploy Buttin to README Related Work Items: #78, #79 --- .gitignore | 1 + LUIS-CachingService/LuisCacheCloud.sln | 61 +++++ LUIS-CachingService/README.md | 9 + LUIS-CachingService/azuredeploy.json | 240 ++++++++++++++++++ .../azuredeploy.parameters.json | 28 ++ 5 files changed, 339 insertions(+) create mode 100644 LUIS-CachingService/LuisCacheCloud.sln create mode 100644 LUIS-CachingService/azuredeploy.json create mode 100644 LUIS-CachingService/azuredeploy.parameters.json diff --git a/.gitignore b/.gitignore index 940794e..1e05251 100644 --- a/.gitignore +++ b/.gitignore @@ -286,3 +286,4 @@ __pycache__/ *.btm.cs *.odx.cs *.xsd.cs +/LUIS-CachingService/deployscript.sh diff --git a/LUIS-CachingService/LuisCacheCloud.sln b/LUIS-CachingService/LuisCacheCloud.sln new file mode 100644 index 0000000..b39d29c --- /dev/null +++ b/LUIS-CachingService/LuisCacheCloud.sln @@ -0,0 +1,61 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2010 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuisCacheServer", "LUIS-CachingComponents\LuisCacheServer\LuisCacheServer.csproj", "{1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LuisCacheModel", "LUIS-CachingComponents\LuisCacheModel\LuisCacheModel.csproj", "{74463CA6-3198-4C75-9337-690BCA210D92}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|ARM.ActiveCfg = Debug|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|ARM.Build.0 = Debug|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|x64.ActiveCfg = Debug|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|x64.Build.0 = Debug|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|x86.ActiveCfg = Debug|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|x86.Build.0 = Debug|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|Any CPU.Build.0 = Release|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|ARM.ActiveCfg = Release|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|ARM.Build.0 = Release|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|x64.ActiveCfg = Release|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|x64.Build.0 = Release|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|x86.ActiveCfg = Release|Any CPU + {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|x86.Build.0 = Release|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|Any CPU.Build.0 = Debug|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|ARM.ActiveCfg = Debug|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|ARM.Build.0 = Debug|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|x64.ActiveCfg = Debug|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|x64.Build.0 = Debug|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|x86.ActiveCfg = Debug|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|x86.Build.0 = Debug|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Release|Any CPU.ActiveCfg = Release|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Release|Any CPU.Build.0 = Release|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Release|ARM.ActiveCfg = Release|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Release|ARM.Build.0 = Release|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Release|x64.ActiveCfg = Release|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Release|x64.Build.0 = Release|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Release|x86.ActiveCfg = Release|Any CPU + {74463CA6-3198-4C75-9337-690BCA210D92}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8575CFF4-DB0D-4B19-9FF8-9E5F5F45F6B3} + EndGlobalSection +EndGlobal diff --git a/LUIS-CachingService/README.md b/LUIS-CachingService/README.md index 1c1098c..5289adb 100644 --- a/LUIS-CachingService/README.md +++ b/LUIS-CachingService/README.md @@ -24,3 +24,12 @@ LUIS Caching Service includes the following components: * **LUIS Cache Client**: Test client application for UWP built with XAML & C# used to test & demonstrate the features of the LUIS Caching Service. ![Solution Architecture](LuisCacheServiceDiagram.jpg) + + +## How To: Deploy the Demo + +1. Check to ensure that the bulid is passing + ![VSTS Build]() +1. Fork this repository to your GitHub account +1. Click on the **Deploy to Azure** Button + [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fdacoppet%2Fmixedreality-azure-samples%2Fluis-cachingservice%2Fazuredeploy.json) \ No newline at end of file diff --git a/LUIS-CachingService/azuredeploy.json b/LUIS-CachingService/azuredeploy.json new file mode 100644 index 0000000..46f7c2c --- /dev/null +++ b/LUIS-CachingService/azuredeploy.json @@ -0,0 +1,240 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "appName": { + "type": "string", + "metadata": { + "description": "The name of the mobile app that you wish to create." + } + }, + "hostingPlanSettings": { + "type": "object", + "defaultValue": { + "tier": "Standard", + "skuName": "S1", + "capacity": "0" + }, + "metadata": { + "description": "The settings of the existing hosting plan." + } + }, + "sqlServerAdminLogin": { + "type": "string", + "metadata": { + "description": "The account name to use for the database server administrator." + } + }, + "sqlServerAdminPassword": { + "type": "securestring", + "metadata": { + "description": "The password to use for the database server administrator." + } + }, + "sqlDatabaseEdition": { + "type": "string", + "metadata": { + "description": "The type of database to create." + }, + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "sqlDatabaseCollation": { + "type": "string", + "defaultValue": "SQL_Latin1_General_CP1_CI_AS", + "metadata": { + "description": "The database collation for governing the proper use of characters." + } + }, + "sqlDatabaseMaxSizeBytes": { + "type": "string", + "defaultValue": "1073741824", + "metadata": { + "description": "The maximum size, in bytes, for the database" + } + }, + "repoURL": { + "type": "string", + "metadata": { + "description": "Repo URL" + } + }, + "branch": { + "type": "string", + "defaultValue": "feature/LUIScache", + "metadata": { + "description": "Repo branch" + } + }, + "manualIntegration": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Use 'true' if you are deploying from the base repo, 'false' if you are deploying from your own fork. If you're using 'false', make sure you have admin permissions to the repo. If you get an error, you should add GitHub integration to another web app manually, so that you get a GitHub access token associated with your Azure Subscription." + } + } + }, + "variables": { + "uniqueAppName": "[concat(parameters('appName'), '-', uniqueString(resourceGroup().id))]", + "hostingPlanName": "[concat(variables('uniqueAppName'), '-plan')]", + "databaseServerName": "[concat(variables('uniqueAppName'), '-sqlserver')]", + "databaseName": "[concat(variables('uniqueAppName'), '-sqldb')]", + "notificationHubNamespace": "[concat(variables('uniqueAppName'), '-namespace')]", + "notificationHubName": "[concat(variables('uniqueAppName'), '-hub')]" + }, + "resources": [ + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2015-08-01", + "name": "[variables('hostingPlanName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "[parameters('hostingPlanSettings').skuName]", + "tier": "[parameters('hostingPlanSettings').tier]", + "capacity": "[parameters('hostingPlanSettings').capacity]" + }, + "properties": { + "numberOfWorkers": 1 + } + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "name": "[variables('uniqueAppName')]", + "location": "[resourceGroup().location]", + "kind": "mobileapp", + "properties": { + "name": "[variables('uniqueAppName')]", + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" + }, + "dependsOn": [ + "[variables('hostingPlanName')]" + ], + "resources": [ + { + "apiVersion": "2015-08-01", + "name": "appsettings", + "type": "config", + "dependsOn": [ + "[variables('uniqueAppName')]" + ], + "properties": { + "MS_MobileServiceName": "[variables('uniqueAppName')]", + "MS_NotificationHubName": "[variables('notificationHubName')]" + } + }, + { + "apiVersion": "2015-08-01", + "name": "connectionstrings", + "type": "config", + "dependsOn": [ + "[variables('uniqueAppName')]", + "[variables('notificationHubName')]", + "[variables('databaseName')]" + ], + "properties": { + "MS_TableConnectionString": { + "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('databaseServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', variables('databaseName'), ';User Id=', parameters('sqlServerAdminLogin'), '@', variables('databaseServerName'), ';Password=', parameters('sqlServerAdminPassword'), ';')]", + "type": "SQLServer" + }, + "MS_NotificationHubConnectionString": { + "value": "[listkeys(resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs/authorizationRules', variables('notificationHubNamespace'), variables('notificationHubName'), 'DefaultFullSharedAccessSignature'), '2014-09-01').primaryConnectionString]", + "type": "Custom" + } + } + }, + { + "apiVersion": "2015-01-01", + "type": "providers/links", + "name": "Microsoft.Resources/SiteToHub", + "dependsOn": [ + "[variables('uniqueAppName')]", + "[variables('notificationHubName')]" + ], + "properties": { + "targetId": "[resourceId('Microsoft.NotificationHubs/namespaces/NotificationHubs', variables('notificationHubNamespace'), variables('notificationHubName'))]" + } + }, + { + "apiVersion": "2015-08-01", + "name": "web", + "type": "sourcecontrols", + "dependsOn": [ + "[resourceId('Microsoft.Web/Sites', variables('uniqueAppName'))]", + "[resourceId('Microsoft.Web/Sites/config', variables('uniqueAppName'), 'appsettings')]", + "[resourceId('Microsoft.Web/Sites/config', variables('uniqueAppName'), 'connectionstrings')]" + ], + "properties": { + "RepoUrl": "[parameters('repoUrl')]", + "branch": "[parameters('branch')]", + "IsManualIntegration": "[parameters('manualIntegration')]" + } + } + ] + }, + { + "name": "[variables('databaseServerName')]", + "type": "Microsoft.Sql/servers", + "location": "[resourceGroup().location]", + "apiVersion": "2014-04-01-preview", + "properties": { + "administratorLogin": "[parameters('sqlServerAdminLogin')]", + "administratorLoginPassword": "[parameters('sqlServerAdminPassword')]", + "version": "12.0" + }, + "resources": [ + { + "name": "[variables('databaseName')]", + "type": "databases", + "location": "[resourceGroup().location]", + "apiVersion": "2014-04-01-preview", + "dependsOn": [ + "[variables('databaseServerName')]" + ], + "properties": { + "edition": "[parameters('sqlDatabaseEdition')]", + "collation": "[parameters('sqlDatabaseCollation')]", + "maxSizeBytes": "[parameters('sqlDatabaseMaxSizeBytes')]" + } + }, + { + "type": "firewallrules", + "apiVersion": "2014-04-01-preview", + "dependsOn": [ + "[variables('databaseServerName')]" + ], + "location": "[resourceGroup().location]", + "name": "open", + "properties": { + "endIpAddress": "255.255.255.255", + "startIpAddress": "0.0.0.0" + } + } + ] + }, + { + "apiVersion": "2014-09-01", + "type": "Microsoft.NotificationHubs/namespaces", + "name": "[variables('notificationHubNamespace')]", + "location": "[resourceGroup().location]", + "properties": { + "region": "[resourceGroup().location]", + "namespaceType": "NotificationHub" + } + }, + { + "apiVersion": "2014-09-01", + "name": "[concat(variables('notificationHubNamespace'), '/', variables('uniqueAppName'), '-hub')]", + "type": "Microsoft.NotificationHubs/namespaces/notificationHubs", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[variables('notificationHubNamespace')]" + ], + "properties": {} + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/LUIS-CachingService/azuredeploy.parameters.json b/LUIS-CachingService/azuredeploy.parameters.json new file mode 100644 index 0000000..e27e25c --- /dev/null +++ b/LUIS-CachingService/azuredeploy.parameters.json @@ -0,0 +1,28 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "appName": { + "value": "myapp-luiscache" + }, + "sqlServerAdminLogin": { + "value": "NewAdmin" + }, + "sqlServerAdminPassword": { + "value": "Secure-P@$$w0rd" + }, + "sqlDatabaseEdition": { + "value": "Basic" + }, + + "repoURL": { + "value": "https://github.com/dacoppet/mixedreality-azure-samples" + }, + "branch": { + "value": "feature/LUIScache" + }, + "manualIntegration": { + "value": true + } + } +} \ No newline at end of file From 8ab6e005c5f2d4811c21421e0cb60959ae7ae886 Mon Sep 17 00:00:00 2001 From: David COPPET Date: Fri, 16 Mar 2018 15:40:28 +0100 Subject: [PATCH 02/11] Fix template url for Azure Deploy Button and Code deploy --- .deployment | 2 ++ LUIS-CachingService/README.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .deployment diff --git a/.deployment b/.deployment new file mode 100644 index 0000000..a1691d2 --- /dev/null +++ b/.deployment @@ -0,0 +1,2 @@ +[config] +project = LUIS-CachingService\LUIS-CachingComponents\LuisCacheServer \ No newline at end of file diff --git a/LUIS-CachingService/README.md b/LUIS-CachingService/README.md index 5289adb..63cf8d9 100644 --- a/LUIS-CachingService/README.md +++ b/LUIS-CachingService/README.md @@ -32,4 +32,4 @@ LUIS Caching Service includes the following components: ![VSTS Build]() 1. Fork this repository to your GitHub account 1. Click on the **Deploy to Azure** Button - [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fdacoppet%2Fmixedreality-azure-samples%2Fluis-cachingservice%2Fazuredeploy.json) \ No newline at end of file + [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fdacoppet%2Fmixedreality-azure-samples%2Ffeature%2FLUIScache%2FLUIS-CachingService%2Fazuredeploy.json) \ No newline at end of file From b77c382c48c46fec3dbd03745a7c5e9719d9d6be Mon Sep 17 00:00:00 2001 From: "David COPPET [MSFT]" Date: Mon, 26 Mar 2018 17:26:18 +0200 Subject: [PATCH 03/11] Fix Dependencies issues and update Read me with badge Related Work Items: #82 --- .../LuisCacheServer/LuisCacheServer.csproj | 107 +++++++++--------- .../LuisCacheServer/Web.config | 12 +- .../LuisCacheServer/packages.config | 14 +-- LUIS-CachingService/README.md | 2 +- 4 files changed, 69 insertions(+), 66 deletions(-) diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/LuisCacheServer.csproj b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/LuisCacheServer.csproj index cd9ea58..393b293 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/LuisCacheServer.csproj +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/LuisCacheServer.csproj @@ -1,7 +1,9 @@  + + - + Debug @@ -48,119 +50,116 @@ - ..\packages\AutoMapper.5.2.0\lib\net45\AutoMapper.dll + ..\..\packages\AutoMapper.5.2.0\lib\net45\AutoMapper.dll - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll + ..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll + ..\..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll - ..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.4.0\lib\net45\Microsoft.AI.Agent.Intercept.dll + ..\..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.4.0\lib\net45\Microsoft.AI.Agent.Intercept.dll - - ..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.5.0\lib\net45\Microsoft.AI.DependencyCollector.dll + + ..\..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.5.1\lib\net45\Microsoft.AI.DependencyCollector.dll - - ..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.5.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll + + ..\..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.5.1\lib\net45\Microsoft.AI.PerfCounterCollector.dll - - ..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.5.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll + + ..\..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.5.1\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll - - ..\packages\Microsoft.ApplicationInsights.Web.2.5.0\lib\net45\Microsoft.AI.Web.dll + + ..\..\packages\Microsoft.ApplicationInsights.Web.2.5.1\lib\net45\Microsoft.AI.Web.dll - - ..\packages\Microsoft.ApplicationInsights.WindowsServer.2.5.0\lib\net45\Microsoft.AI.WindowsServer.dll + + ..\..\packages\Microsoft.ApplicationInsights.WindowsServer.2.5.1\lib\net45\Microsoft.AI.WindowsServer.dll - - ..\packages\Microsoft.ApplicationInsights.2.5.0\lib\net46\Microsoft.ApplicationInsights.dll + + ..\..\packages\Microsoft.ApplicationInsights.2.5.1\lib\net46\Microsoft.ApplicationInsights.dll - ..\packages\Microsoft.ApplicationInsights.TraceListener.2.5.0\lib\net45\Microsoft.ApplicationInsights.TraceListener.dll + ..\..\packages\Microsoft.ApplicationInsights.TraceListener.2.5.0\lib\net45\Microsoft.ApplicationInsights.TraceListener.dll - ..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.0\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll + ..\..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.0\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll - ..\packages\Microsoft.Azure.Mobile.Server.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.dll - ..\packages\Microsoft.Azure.Mobile.Server.Authentication.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Authentication.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.Authentication.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Authentication.dll - ..\packages\Microsoft.Azure.Mobile.Server.CrossDomain.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.CrossDomain.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.CrossDomain.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.CrossDomain.dll - ..\packages\Microsoft.Azure.Mobile.Server.Entity.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Entity.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.Entity.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Entity.dll - ..\packages\Microsoft.Azure.Mobile.Server.Home.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Home.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.Home.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Home.dll - ..\packages\Microsoft.Azure.Mobile.Server.Notifications.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Notifications.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.Notifications.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Notifications.dll - ..\packages\Microsoft.Azure.Mobile.Server.Quickstart.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Quickstart.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.Quickstart.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Quickstart.dll - ..\packages\Microsoft.Azure.Mobile.Server.Tables.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Tables.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.Tables.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.Tables.dll - ..\packages\Microsoft.Azure.NotificationHubs.1.0.7\lib\net45-full\Microsoft.Azure.NotificationHubs.dll + ..\..\packages\Microsoft.Azure.NotificationHubs.1.0.7\lib\net45-full\Microsoft.Azure.NotificationHubs.dll - ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + ..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll - ..\packages\Microsoft.Cognitive.LUIS.2.0.2\lib\portable45-net45+win8+wpa81\Microsoft.Cognitive.LUIS.dll + ..\..\packages\Microsoft.Cognitive.LUIS.2.0.2\lib\portable45-net45+win8+wpa81\Microsoft.Cognitive.LUIS.dll - ..\packages\Microsoft.Data.Edm.5.8.1\lib\net40\Microsoft.Data.Edm.dll + ..\..\packages\Microsoft.Data.Edm.5.8.1\lib\net40\Microsoft.Data.Edm.dll - ..\packages\Microsoft.Data.OData.5.8.1\lib\net40\Microsoft.Data.OData.dll + ..\..\packages\Microsoft.Data.OData.5.8.1\lib\net40\Microsoft.Data.OData.dll - ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll + ..\..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll - ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll + ..\..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll - ..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll + ..\..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll - ..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll + ..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\Owin.1.0\lib\net40\Owin.dll + ..\..\packages\Owin.1.0\lib\net40\Owin.dll - ..\packages\System.Diagnostics.DiagnosticSource.4.4.0\lib\net46\System.Diagnostics.DiagnosticSource.dll + ..\..\packages\System.Diagnostics.DiagnosticSource.4.4.0\lib\net46\System.Diagnostics.DiagnosticSource.dll - ..\packages\System.IdentityModel.Tokens.Jwt.4.0.3.308261200\lib\net45\System.IdentityModel.Tokens.Jwt.dll + ..\..\packages\System.IdentityModel.Tokens.Jwt.4.0.3.308261200\lib\net45\System.IdentityModel.Tokens.Jwt.dll - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll + ..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll - ..\packages\System.Spatial.5.8.1\lib\net40\System.Spatial.dll + ..\..\packages\System.Spatial.5.8.1\lib\net40\System.Spatial.dll - ..\packages\Microsoft.AspNet.Cors.5.2.3\lib\net45\System.Web.Cors.dll + ..\..\packages\Microsoft.AspNet.Cors.5.2.3\lib\net45\System.Web.Cors.dll - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll - @@ -171,14 +170,17 @@ + + ..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll + - ..\packages\Microsoft.AspNet.WebApi.Cors.5.2.3\lib\net45\System.Web.Http.Cors.dll + ..\..\packages\Microsoft.AspNet.WebApi.Cors.5.2.3\lib\net45\System.Web.Http.Cors.dll - ..\packages\Microsoft.AspNet.WebApi.OData.5.7.0\lib\net45\System.Web.Http.OData.dll + ..\..\packages\Microsoft.AspNet.WebApi.OData.5.7.0\lib\net45\System.Web.Http.OData.dll - ..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll + ..\..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll @@ -191,9 +193,6 @@ - - ..\packages\AutoMapper.5.2.0\lib\net40\AutoMapper.Net4.dll - @@ -269,7 +268,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Web.config b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Web.config index 446aae0..003fa39 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Web.config +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Web.config @@ -6,7 +6,7 @@
- + @@ -38,13 +38,13 @@ - + + - - + @@ -75,6 +75,10 @@ + + + + diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/packages.config b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/packages.config index 4ceb5a3..ef76718 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/packages.config +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/packages.config @@ -2,14 +2,14 @@ - + - - + + - - - + + + @@ -30,7 +30,7 @@ - + diff --git a/LUIS-CachingService/README.md b/LUIS-CachingService/README.md index 63cf8d9..1458520 100644 --- a/LUIS-CachingService/README.md +++ b/LUIS-CachingService/README.md @@ -29,7 +29,7 @@ LUIS Caching Service includes the following components: ## How To: Deploy the Demo 1. Check to ensure that the bulid is passing - ![VSTS Build]() + ![VSTS Build](https://azureappconsult.visualstudio.com/_apis/public/build/definitions/1d060d9e-a26e-46df-b635-ad9e3c64d8dc/7/badge) 1. Fork this repository to your GitHub account 1. Click on the **Deploy to Azure** Button [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fdacoppet%2Fmixedreality-azure-samples%2Ffeature%2FLUIScache%2FLUIS-CachingService%2Fazuredeploy.json) \ No newline at end of file From 83e24aa2952df270d339efdcf069c67104b4549a Mon Sep 17 00:00:00 2001 From: "David COPPET [MSFT]" Date: Tue, 27 Mar 2018 11:02:46 +0200 Subject: [PATCH 04/11] Fixing Kudu - Deploy --- .deployment | 2 -- .gitignore | 1 + .../{LuisCacheClient.sln => LuisCacheClient.sln.bak} | 0 .../LuisCacheClient/LuisCacheClient.csproj | 2 +- .../LUIS-CachingComponents/LuisCacheLib/LuisCacheLib.csproj | 2 +- LUIS-CachingService/azuredeploy.json | 3 ++- 6 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 .deployment rename LUIS-CachingService/LUIS-CachingComponents/{LuisCacheClient.sln => LuisCacheClient.sln.bak} (100%) diff --git a/.deployment b/.deployment deleted file mode 100644 index a1691d2..0000000 --- a/.deployment +++ /dev/null @@ -1,2 +0,0 @@ -[config] -project = LUIS-CachingService\LUIS-CachingComponents\LuisCacheServer \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1e05251..65b80ef 100644 --- a/.gitignore +++ b/.gitignore @@ -287,3 +287,4 @@ __pycache__/ *.odx.cs *.xsd.cs /LUIS-CachingService/deployscript.sh +LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln.bak similarity index 100% rename from LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln rename to LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln.bak diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient/LuisCacheClient.csproj b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient/LuisCacheClient.csproj index bc63183..7f93140 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient/LuisCacheClient.csproj +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient/LuisCacheClient.csproj @@ -11,7 +11,7 @@ LuisCacheClient en-US UAP - 10.0.14393.0 + 10.0.16299.0 10.0.14393.0 14 512 diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/LuisCacheLib.csproj b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/LuisCacheLib.csproj index 9ffa491..7ef67fc 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/LuisCacheLib.csproj +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/LuisCacheLib.csproj @@ -11,7 +11,7 @@ LuisCacheLib en-US UAP - 10.0.14393.0 + 10.0.16299.0 10.0.14393.0 14 512 diff --git a/LUIS-CachingService/azuredeploy.json b/LUIS-CachingService/azuredeploy.json index 46f7c2c..83da553 100644 --- a/LUIS-CachingService/azuredeploy.json +++ b/LUIS-CachingService/azuredeploy.json @@ -123,7 +123,8 @@ ], "properties": { "MS_MobileServiceName": "[variables('uniqueAppName')]", - "MS_NotificationHubName": "[variables('notificationHubName')]" + "MS_NotificationHubName": "[variables('notificationHubName')]", + "PROJECT": "LUIS-CachingService\\LUIS-CachingComponents\\LuisCacheServer\\LuisCacheServer.csproj" } }, { From 8f0630d2c7db69abd9efe1d50b3217dd089e31ef Mon Sep 17 00:00:00 2001 From: "David COPPET [MSFT]" Date: Thu, 19 Apr 2018 20:28:37 +0200 Subject: [PATCH 05/11] Cleaning and refactoring Server Adding Luis Cache Functions Working on ARL --- .../LuisCacheClient.sln.bak | 101 ------- .../LuisCacheFunctions/.gitignore | 264 ++++++++++++++++++ .../LuisCacheFunctions.csproj | 20 ++ .../LuisCacheFunctions/LuisGetVersion.cs | 30 ++ .../LuisCacheFunctions/LuisListApps.cs | 52 ++++ .../LuisCacheFunctions/LuisProcessIntent.cs | 37 +++ .../LuisCacheFunctions/LuisRetrainModel.cs | 58 ++++ .../LuisCacheFunctions/host.json | 2 + .../LuisCacheLib/TextProcessor.cs | 3 + .../Controllers/IntentController.cs | 39 ++- .../Controllers/ValuesController.cs | 23 -- .../LuisCacheServer/LuisCacheServer.csproj | 20 +- .../LuisCacheServer/Web.config | 13 +- .../LuisCacheServer/packages.config | 4 +- LUIS-CachingService/LuisCacheCloud.sln | 18 ++ LUIS-CachingService/README.md | 2 + LUIS-CachingService/azuredeploy.json | 122 +++++++- 17 files changed, 672 insertions(+), 136 deletions(-) delete mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln.bak create mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/.gitignore create mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisCacheFunctions.csproj create mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisGetVersion.cs create mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisListApps.cs create mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisProcessIntent.cs create mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisRetrainModel.cs create mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/host.json delete mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/ValuesController.cs diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln.bak b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln.bak deleted file mode 100644 index 8a9420e..0000000 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient.sln.bak +++ /dev/null @@ -1,101 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuisCacheClient", "LuisCacheClient\LuisCacheClient.csproj", "{C6BE25A8-AD26-448E-8D83-6D5686A009EA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuisCacheLib", "LuisCacheLib\LuisCacheLib.csproj", "{7BD9D85D-8AF8-4503-892D-741BD53C89EE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuisCacheServer", "LuisCacheServer\LuisCacheServer.csproj", "{1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuisCacheModel", "LuisCacheModel\LuisCacheModel.csproj", "{74463CA6-3198-4C75-9337-690BCA210D92}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|Any CPU.ActiveCfg = Debug|x86 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|ARM.ActiveCfg = Debug|ARM - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|ARM.Build.0 = Debug|ARM - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|ARM.Deploy.0 = Debug|ARM - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|x64.ActiveCfg = Debug|x64 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|x64.Build.0 = Debug|x64 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|x64.Deploy.0 = Debug|x64 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|x86.ActiveCfg = Debug|x86 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|x86.Build.0 = Debug|x86 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Debug|x86.Deploy.0 = Debug|x86 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|Any CPU.ActiveCfg = Release|x86 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|ARM.ActiveCfg = Release|ARM - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|ARM.Build.0 = Release|ARM - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|ARM.Deploy.0 = Release|ARM - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|x64.ActiveCfg = Release|x64 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|x64.Build.0 = Release|x64 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|x64.Deploy.0 = Release|x64 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|x86.ActiveCfg = Release|x86 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|x86.Build.0 = Release|x86 - {C6BE25A8-AD26-448E-8D83-6D5686A009EA}.Release|x86.Deploy.0 = Release|x86 - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Debug|ARM.ActiveCfg = Debug|ARM - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Debug|ARM.Build.0 = Debug|ARM - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Debug|x64.ActiveCfg = Debug|x64 - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Debug|x64.Build.0 = Debug|x64 - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Debug|x86.ActiveCfg = Debug|x86 - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Debug|x86.Build.0 = Debug|x86 - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Release|Any CPU.Build.0 = Release|Any CPU - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Release|ARM.ActiveCfg = Release|ARM - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Release|ARM.Build.0 = Release|ARM - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Release|x64.ActiveCfg = Release|x64 - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Release|x64.Build.0 = Release|x64 - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Release|x86.ActiveCfg = Release|x86 - {7BD9D85D-8AF8-4503-892D-741BD53C89EE}.Release|x86.Build.0 = Release|x86 - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|ARM.ActiveCfg = Debug|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|ARM.Build.0 = Debug|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|x64.ActiveCfg = Debug|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|x64.Build.0 = Debug|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|x86.ActiveCfg = Debug|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Debug|x86.Build.0 = Debug|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|Any CPU.Build.0 = Release|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|ARM.ActiveCfg = Release|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|ARM.Build.0 = Release|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|x64.ActiveCfg = Release|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|x64.Build.0 = Release|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|x86.ActiveCfg = Release|Any CPU - {1DB3BDC6-0761-40F6-9783-9C9CCCB4D01C}.Release|x86.Build.0 = Release|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|Any CPU.Build.0 = Debug|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|ARM.ActiveCfg = Debug|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|ARM.Build.0 = Debug|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|x64.ActiveCfg = Debug|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|x64.Build.0 = Debug|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|x86.ActiveCfg = Debug|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Debug|x86.Build.0 = Debug|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Release|Any CPU.ActiveCfg = Release|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Release|Any CPU.Build.0 = Release|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Release|ARM.ActiveCfg = Release|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Release|ARM.Build.0 = Release|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Release|x64.ActiveCfg = Release|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Release|x64.Build.0 = Release|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Release|x86.ActiveCfg = Release|Any CPU - {74463CA6-3198-4C75-9337-690BCA210D92}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8575CFF4-DB0D-4B19-9FF8-9E5F5F45F6B3} - EndGlobalSection -EndGlobal diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/.gitignore b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/.gitignore new file mode 100644 index 0000000..ff5b00c --- /dev/null +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/.gitignore @@ -0,0 +1,264 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# Azure Functions localsettings file +local.settings.json + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisCacheFunctions.csproj b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisCacheFunctions.csproj new file mode 100644 index 0000000..b2907bb --- /dev/null +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisCacheFunctions.csproj @@ -0,0 +1,20 @@ + + + netstandard2.0 + v2 + + + + + + + + + PreserveNewest + + + PreserveNewest + Never + + + \ No newline at end of file diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisGetVersion.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisGetVersion.cs new file mode 100644 index 0000000..6400fd2 --- /dev/null +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisGetVersion.cs @@ -0,0 +1,30 @@ + +using System.IO; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Extensions.Http; +using Microsoft.AspNetCore.Http; +using Microsoft.Azure.WebJobs.Host; +using Newtonsoft.Json; + +namespace LuisCacheFunctions +{ + public static class LuisGetVersion + { + [FunctionName("GetVersion")] + public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, TraceWriter log) + { + log.Info("C# HTTP trigger function processed a request."); + + string name = req.Query["name"]; + + string requestBody = new StreamReader(req.Body).ReadToEnd(); + dynamic data = JsonConvert.DeserializeObject(requestBody); + name = name ?? data?.name; + + return name != null + ? (ActionResult)new OkObjectResult($"Hello, {name}") + : new BadRequestObjectResult("Please pass a name on the query string or in the request body"); + } + } +} diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisListApps.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisListApps.cs new file mode 100644 index 0000000..bb4fddf --- /dev/null +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisListApps.cs @@ -0,0 +1,52 @@ +using System; +using System.Net.Http; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Extensions.Http; +using Microsoft.Azure.WebJobs.Host; + +namespace LuisCacheFunctions +{ + public static class LuisListApps + { + [FunctionName("ListApps")] + public static async System.Threading.Tasks.Task RunAsync([HttpTrigger(AuthorizationLevel.Anonymous, "get")]HttpRequest req, TraceWriter log) + { + // check if there is untrained + log.Info($"C# Timer trigger function executed at: {DateTime.Now}"); + //var uri = "https://{location}.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/versions/{versionId}/train?" + queryString; + // https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/?skip=0&take=100 + //"https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/?skip=0&take=100" + var versionId = Environment.GetEnvironmentVariable("LuisAppId"); + var appId = Environment.GetEnvironmentVariable("LuisAppId"); + var subscriptionKey = Environment.GetEnvironmentVariable("LuisSubscriptionKey"); + var LUISendpoint = Environment.GetEnvironmentVariable("LuisEndpoint"); + var request = $"{LUISendpoint}/apps/?skip=0&take=100"; + var query = ""; + + // Final LUIS Query + + log.Info("LUIS query:" + request); + var httpClient = new HttpClient(); + + // LUIS HTTP CALL + httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey); + // Can add the query at the end + var response = await httpClient.GetAsync(request); + + // If LUIS error, return 204 - YOU SHOULD CHANGE THIS!!! + if (!response.IsSuccessStatusCode) + { + // Log (HttpStatusCode.NoContent); + log.Info($"HttpStatusCode.NoContent - status : {response.StatusCode} - reason : {response.ReasonPhrase}"); + } + + var apiResult = await response.Content.ReadAsStringAsync(); + + log.Info($"Response {apiResult}"); + + return new OkObjectResult(apiResult); + } + } +} diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisProcessIntent.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisProcessIntent.cs new file mode 100644 index 0000000..42ea8a0 --- /dev/null +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisProcessIntent.cs @@ -0,0 +1,37 @@ +using System; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Host; +using System.Net.Http; +using Microsoft.Cognitive.LUIS; +using Newtonsoft.Json.Linq; + +using System.Net.Http.Headers; + +namespace LuisCacheFunctions +{ + public static class LuisProcessIntent + { + static HttpClient httpClient = new HttpClient(); + + [FunctionName("LuisProcessIntent")] + public static async System.Threading.Tasks.Task RunAsync([QueueTrigger("luisToProcess", Connection = "")]string intentId, + [MobileTable(ApiKeySetting = "LuisCacheMobileAppKey", TableName = "MyTable", + MobileAppUriSetting = "LuisCacheMobileAppUri", Id = "{queueTrigger}")]JObject item, + TraceWriter log) + { + log.Info($"C# Processing Intent ID : {intentId}"); + + var appId = Environment.GetEnvironmentVariable("LuisAppId"); + var subscriptionKey = Environment.GetEnvironmentVariable("LuisSubscriptionKey"); + var LUISendpoint = $"{Environment.GetEnvironmentVariable("LuisEndpoint")}/apps/"; + bool isPreview = true; + + var client = new LuisClient(appId, subscriptionKey, isPreview); + + LuisResult res = await client.Predict(item["Utterance"].Value()); + + log.Info($"Luis result : {res.DialogResponse}"); + + } + } +} diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisRetrainModel.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisRetrainModel.cs new file mode 100644 index 0000000..e44392a --- /dev/null +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisRetrainModel.cs @@ -0,0 +1,58 @@ +using System; +using System.Net.Http; +using Microsoft.Azure.WebJobs; +using Microsoft.Azure.WebJobs.Host; + +namespace LuisCacheFunctions +{ + public static class LuisRetrainModel + { + [FunctionName("RetrainModel")] + public static async System.Threading.Tasks.Task RunAsync([TimerTrigger("0 * * */1 * *")]TimerInfo myTimer, TraceWriter log) + + { + // check if there is untrained + log.Info($"C# Timer trigger function executed at: {DateTime.Now}"); + //var uri = "https://{location}.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/versions/{versionId}/train?" + queryString; + + var versionId = Environment.GetEnvironmentVariable("LuisAppVersion"); + var appId = Environment.GetEnvironmentVariable("LuisAppId"); + var subscriptionKey = Environment.GetEnvironmentVariable("LuisSubscriptionKey"); + var LUISendpoint = Environment.GetEnvironmentVariable("LuisEndpoint"); + var request = $"{LUISendpoint}/apps/{appId}/versions/{versionId}/train/?verbose=true&q="; + + // Final LUIS Query + + log.Info("LUIS query:" + request); + var httpClient = new HttpClient(); + + + // Check if model need to be updated + + + // LUIS HTTP CALL + httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey); + // Can add the query at the end + var response = await httpClient.PostAsync(request, null); + + // If LUIS error, return 204 - YOU SHOULD CHANGE THIS!!! + if (!response.IsSuccessStatusCode) + { + // Log (HttpStatusCode.NoContent); + log.Info($"HttpStatusCode.NoContent - status : {response.StatusCode} - reason : {response.ReasonPhrase}"); + } + + var apiResult = await response.Content.ReadAsStringAsync(); + + log.Info($"Response {apiResult}"); + + // Publish to prod + // { + // "versionId": "0.1", + // "isStaging": false, + // "region": "westus" + //} + // POST https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/publish + } + } +} diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/host.json b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/host.json new file mode 100644 index 0000000..7a73a41 --- /dev/null +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/host.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/TextProcessor.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/TextProcessor.cs index 9881610..99eb238 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/TextProcessor.cs +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/TextProcessor.cs @@ -19,6 +19,7 @@ namespace LuisCacheLib { public class TextProcessor { + // TODO: Refactor to get from App Settings public static MobileServiceClient MobileService = new MobileServiceClient("https://insertappservicename.azurewebsites.net"); private IMobileServiceSyncTable intentTable = MobileService.GetSyncTable(); // offline sync private MobileServiceCollection items; @@ -38,7 +39,9 @@ private TextProcessor() }); t.Wait(); + // TODO: Refactor to get from App Settings string appId = "APP_ID"; + // TODO: Refactor to get from App Settings string subscriptionKey = "SUBSCRIPTION_KEY"; bool preview = true; diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/IntentController.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/IntentController.cs index 52f44cb..4838b08 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/IntentController.cs +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/IntentController.cs @@ -10,6 +10,10 @@ using LuisCacheModel; using System.Collections.Generic; using Newtonsoft.Json; +using System; +using Microsoft.WindowsAzure.Storage; +using Microsoft.WindowsAzure.Storage.Queue; +using Microsoft.Azure; namespace KsparkAPI.Controllers { @@ -50,8 +54,12 @@ public async Task PostIntentItem(IntentItem item) System.Diagnostics.Trace.TraceInformation("Positing new intent: " + item.Utterance); IntentItem current; + bool proceessInQueue = false; + + if (!item.IsProcessed) { + proceessInQueue = true; current = await CreateIntentItem(item); current.IsProcessed = true; } @@ -61,13 +69,38 @@ public async Task PostIntentItem(IntentItem item) } current = await InsertAsync(current); - return CreatedAtRoute("Tables", new { id = current.Id }, current); + + if (proceessInQueue) + { + // Get storage queue connection string + var queueConStr = CloudConfigurationManager.GetSetting("StorageQueueConnectionString"); + // Get queue name + var queueName = CloudConfigurationManager.GetSetting("StorageQueueName"); + + // Parse the connection string and return a reference to the storage account. + CloudStorageAccount storageAccount = CloudStorageAccount.Parse(queueConStr); + + // Create the queue client. + CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); + + // Retrieve a reference to a queue. + CloudQueue queue = queueClient.GetQueueReference(queueName); + + // Create the queue if it doesn't already exist. + queue.CreateIfNotExists(); + + // Create a message and add it to the queue. + CloudQueueMessage message = new CloudQueueMessage(current.Id); + queue.AddMessage(message); + } + + return CreatedAtRoute("Tables", new { id = current.Id }, current); } private async Task CreateIntentItem(IntentItem item) { - string appId = "9f25daaa-3d94-4988-b201-f10a2d41a6a5"; - string subscriptionKey = "07f77f9e723140aeb54b4ed346752851"; + string appId = Environment.GetEnvironmentVariable("LuisAppId"); + string subscriptionKey = Environment.GetEnvironmentVariable("LuisSubscriptionKey"); bool preview = true; var client = new LuisClient(appId, subscriptionKey, preview); diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/ValuesController.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/ValuesController.cs deleted file mode 100644 index 4f9237e..0000000 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/ValuesController.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Web.Http; -using Microsoft.Azure.Mobile.Server.Config; - -namespace KsparkAPI.Controllers -{ - // Use the MobileAppController attribute for each ApiController you want to use - // from your mobile clients - [MobileAppController] - public class ValuesController : ApiController - { - // GET api/values - public string Get() - { - return "Hello World!"; - } - - // POST api/values - public string Post() - { - return "Hello World!"; - } - } -} diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/LuisCacheServer.csproj b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/LuisCacheServer.csproj index 393b293..dc91296 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/LuisCacheServer.csproj +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/LuisCacheServer.csproj @@ -85,6 +85,9 @@ ..\..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.0\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll + + ..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + ..\..\packages\Microsoft.Azure.Mobile.Server.2.0.0\lib\net46\Microsoft.Azure.Mobile.Server.dll @@ -136,8 +139,11 @@ ..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll - - ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + ..\..\packages\WindowsAzure.Storage.9.1.1\lib\net45\Microsoft.WindowsAzure.Storage.dll + + + ..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll ..\..\packages\Owin.1.0\lib\net40\Owin.dll @@ -200,7 +206,6 @@ - @@ -208,7 +213,9 @@ - + + Designer + Web.config @@ -224,8 +231,11 @@ PreserveNewest - + + Designer + + diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Web.config b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Web.config index 003fa39..225b440 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Web.config +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Web.config @@ -10,9 +10,18 @@ - + + + + + + + + + + - + + From 4d1d5fc7a73a27ed84033b3b439a9c12adb65b5d Mon Sep 17 00:00:00 2001 From: "David COPPET [MSFT]" Date: Sat, 21 Apr 2018 01:25:33 +0200 Subject: [PATCH 07/11] Refactoring Moving LUIS post processing to Azure Function --- .../LuisCacheClient/MainPage.xaml.cs | 16 ++- .../LuisCacheFunctions.csproj | 6 ++ .../LuisCacheFunctions/LuisGetVersion.cs | 30 ------ .../LuisCacheFunctions/LuisListApps.cs | 6 +- .../LuisCacheFunctions/LuisProcessIntent.cs | 93 ++++++++++------ .../LuisCacheFunctions/LuisRetrainModel.cs | 11 +- .../LuisCacheLib/TextProcessor.cs | 101 ++++++++++++------ .../Controllers/IntentController.cs | 49 ++------- LUIS-CachingService/README.md | 3 +- 9 files changed, 166 insertions(+), 149 deletions(-) delete mode 100644 LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisGetVersion.cs diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient/MainPage.xaml.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient/MainPage.xaml.cs index 121c704..b53306c 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient/MainPage.xaml.cs +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheClient/MainPage.xaml.cs @@ -22,13 +22,17 @@ namespace LuisCacheClient /// public sealed partial class MainPage : Page { - TextProcessor _processor; + static TextProcessor _processor; public MainPage() { this.InitializeComponent(); + var luisSubscriptionKey = "LUIS_KEY"; + var luisAppId = "LUIS_APP_ID"; + var mobileAppUri = "http://XXXXXXXXX.azurewebsites.net/"; - _processor = TextProcessor.Instance; + _processor = new TextProcessor(luisAppId, luisSubscriptionKey, mobileAppUri); + } private async void submitButton_Click(object sender, RoutedEventArgs e) @@ -36,11 +40,13 @@ private async void submitButton_Click(object sender, RoutedEventArgs e) ResultLabel.Text = String.Empty; FromCacheLabel.Text = String.Empty; - _processor = TextProcessor.Instance; - var result = await _processor.Predict(txtInput.Text); - if (result == null) { return; } + if (result == null) + { + ResultLabel.Text = "No results - Error or Offline - "+DateTime.Now.ToString(); + return; + } var resultLabel = result.Intent; diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisCacheFunctions.csproj b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisCacheFunctions.csproj index b2907bb..a23b3aa 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisCacheFunctions.csproj +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisCacheFunctions.csproj @@ -4,10 +4,16 @@ v2 + + + + true + + PreserveNewest diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisGetVersion.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisGetVersion.cs deleted file mode 100644 index 6400fd2..0000000 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisGetVersion.cs +++ /dev/null @@ -1,30 +0,0 @@ - -using System.IO; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Azure.WebJobs; -using Microsoft.Azure.WebJobs.Extensions.Http; -using Microsoft.AspNetCore.Http; -using Microsoft.Azure.WebJobs.Host; -using Newtonsoft.Json; - -namespace LuisCacheFunctions -{ - public static class LuisGetVersion - { - [FunctionName("GetVersion")] - public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req, TraceWriter log) - { - log.Info("C# HTTP trigger function processed a request."); - - string name = req.Query["name"]; - - string requestBody = new StreamReader(req.Body).ReadToEnd(); - dynamic data = JsonConvert.DeserializeObject(requestBody); - name = name ?? data?.name; - - return name != null - ? (ActionResult)new OkObjectResult($"Hello, {name}") - : new BadRequestObjectResult("Please pass a name on the query string or in the request body"); - } - } -} diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisListApps.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisListApps.cs index ff7268a..64efc5d 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisListApps.cs +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisListApps.cs @@ -15,9 +15,6 @@ public static async System.Threading.Tasks.Task RunAsync([HttpTri { // check if there is untrained log.Info($"C# Timer trigger function executed at: {DateTime.Now}"); - //var uri = "https://{location}.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/versions/{versionId}/train?" + queryString; - // https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/?skip=0&take=100 - //"https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/?skip=0&take=100" var versionId = Environment.GetEnvironmentVariable("LuisAppId"); var appId = Environment.GetEnvironmentVariable("LuisAppId"); var subscriptionKey = Environment.GetEnvironmentVariable("LuisSubscriptionKey"); @@ -25,7 +22,6 @@ public static async System.Threading.Tasks.Task RunAsync([HttpTri var request = $"{LUISendpoint}/apps/?skip=0&take=100"; // Final LUIS Query - log.Info("LUIS query:" + request); var httpClient = new HttpClient(); @@ -34,7 +30,7 @@ public static async System.Threading.Tasks.Task RunAsync([HttpTri // Can add the query at the end var response = await httpClient.GetAsync(request); - // If LUIS error, return 204 - YOU SHOULD CHANGE THIS!!! + // if (!response.IsSuccessStatusCode) { // Log (HttpStatusCode.NoContent); diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisProcessIntent.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisProcessIntent.cs index 0f9ad57..086d8de 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisProcessIntent.cs +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisProcessIntent.cs @@ -7,6 +7,10 @@ using System.Net.Http.Headers; using System.Collections.Generic; +using Microsoft.WindowsAzure.MobileServices; +using LuisCacheModel.DataModel; +using LuisCacheModel; +using Newtonsoft.Json; //using LuisCacheModel; namespace LuisCacheFunctions @@ -14,56 +18,75 @@ namespace LuisCacheFunctions public static class LuisProcessIntent { static HttpClient httpClient = new HttpClient(); + static MobileServiceClient MobileService = new MobileServiceClient(Environment.GetEnvironmentVariable("LuisCacheMobileAppUri")); + static IMobileServiceTable intentTable = MobileService.GetTable(); [FunctionName("LuisProcessIntent")] - public static async System.Threading.Tasks.Task RunAsync([QueueTrigger("luistoprocess", Connection = "")]string intentId, - [MobileTable(TableName = "IntentItems", - MobileAppUriSetting = "LuisCacheMobileAppUri", Id = "{queueTrigger}")]JObject item, + public static async System.Threading.Tasks.Task RunAsync([TimerTrigger("* */1 * * * *")]TimerInfo myTimer, TraceWriter log) { - log.Info($"C# Processing Intent ID : {intentId}"); + IList items = null; - // Erro handling - if (item == null) + try { - - log.Info($"No itent item retrieved (null) - {intentId}"); - return; + // Retrieve all non processed items + items = await intentTable.Where(i => i.IsProcessed == false).ToListAsync(); } - - // Ensure item require procesing otherwise skip it - var isProcessed = (bool) item["IsProcessed"]; - if ( isProcessed == true) + catch(Exception ex) { - log.Info($" ItemItemd with if {intentId} has already been processed {isProcessed} - will be skipped"); - return; + log.Error($"Error while Retrieving all IntentItems : {ex}"); + throw ex; } - var appId = Environment.GetEnvironmentVariable("LuisAppId"); - var subscriptionKey = Environment.GetEnvironmentVariable("LuisSubscriptionKey"); - bool isPreview = true; + log.Info($"Total items to process = {items.Count}"); + + foreach (var item in items) + { + var intentId = item.Id; + + log.Info($"C# Processing Intent ID : {intentId}"); - var client = new LuisClient(appId, subscriptionKey, isPreview); - //LuisResult res = await client.Predict(item["Utterance"].Value()); - //log.Info($"Luis result : {res.DialogResponse}"); - //var processingResult = new ProcessingResult(); + // Erro handling + if (item == null) + { + log.Info($"No itent item retrieved (null) - {intentId}"); + return; + } - List entitiesNames = new List(); - //var entities = res.GetAllEntities(); - //foreach (Entity entity in entities) - //{ - // processingResult.Entities.Add(entity.Name, entity.Value); - //} + // Ensure item require procesing otherwise skip it + if (item.IsProcessed == true) + { + log.Info($" ItemItemd with if {intentId} has already been processed {item.IsProcessed} - will be skipped"); + return; + } - //processingResult.Confidence = res.TopScoringIntent.Score; - //processingResult.Intent = res.TopScoringIntent.Name; - //processingResult.IsFromCache = false; + // Calling Luis + var appId = Environment.GetEnvironmentVariable("LuisAppId"); + var subscriptionKey = Environment.GetEnvironmentVariable("LuisSubscriptionKey"); + bool isPreview = true; - //item["Intent"] = processingResult.Intent; - //item["JsonEntities"] = JsonConvert.SerializeObject(processingResult.Entities); - item["Intent"] = "Demo Intent"; - item["JsonEntities"] = "Demo entities"; + var client = new LuisClient(appId, subscriptionKey, isPreview); + LuisResult res = await client.Predict(item.Utterance); + log.Info($"Luis result : {res.DialogResponse}"); + var processingResult = new ProcessingResult(); + List entitiesNames = new List(); + var entities = res.GetAllEntities(); + foreach (Entity entity in entities) + { + processingResult.Entities.Add(entity.Name, entity.Value); + } + + processingResult.Confidence = res.TopScoringIntent.Score; + processingResult.Intent = res.TopScoringIntent.Name; + processingResult.IsFromCache = false; + + item.Intent = processingResult.Intent; + item.JsonEntities = JsonConvert.SerializeObject(processingResult.Entities); + item.IsProcessed = true; + + await intentTable.UpdateAsync(item); + } } } } diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisRetrainModel.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisRetrainModel.cs index 9f0a05b..7be8fcb 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisRetrainModel.cs +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheFunctions/LuisRetrainModel.cs @@ -46,13 +46,22 @@ public static async System.Threading.Tasks.Task RunAsync([TimerTrigger("0 * * */ log.Info($"Response {apiResult}"); - // Publish to prod + #region auto publish + // Model is trained above but not automatically published as this operation can cause unexpected behaviors and + // you might want to test it befor publishing + + // Uncomment the code below to enable the feature (send a post request with the following settings) + + // Body to post // { // "versionId": "0.1", // "isStaging": false, // "region": "westus" //} + // POST https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/{appId}/publish + #endregion + } } } diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/TextProcessor.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/TextProcessor.cs index d4e0ba5..0092f00 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/TextProcessor.cs +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheLib/TextProcessor.cs @@ -20,46 +20,70 @@ namespace LuisCacheLib public class TextProcessor { // TODO: Refactor to get from App Settings - public static MobileServiceClient MobileService = new MobileServiceClient("http://myapp-luiscache-4wie64ucspon6.azurewebsites.net/"); - private IMobileServiceSyncTable intentTable = MobileService.GetSyncTable(); // offline sync + string luisAppId = null; + // TODO: Refactor to get from App Settings + string luisSubscriptionKey = null; + // TODO: Refactor to get from App Settings + string mobileAppUri = null; + public MobileServiceClient MobileService { get; set; } + + private IMobileServiceSyncTable intentTable = null; // offline sync private MobileServiceCollection items; - private IMobileServiceSyncTable telemetryTable = MobileService.GetSyncTable(); + private IMobileServiceSyncTable telemetryTable = null; private MobileServiceCollection telemetryItems; private LuisClient _client; - private static TextProcessor instance = null; + //private static TextProcessor instance = null; - private TextProcessor() + public TextProcessor(string luisAppId, string luisSubscriptionKey, string mobileAppUri) //:base() { - var t = Task.Run(async () => - { - await InitLocalStoreAsync(); - }); - t.Wait(); - - // TODO: Refactor to get from App Settings - string appId = "APP_ID"; - // TODO: Refactor to get from App Settings - string subscriptionKey = "SUBSCRIPTION_KEY"; - bool preview = true; + this.mobileAppUri = mobileAppUri; + this.luisAppId = luisAppId; + this.luisSubscriptionKey = luisSubscriptionKey; - _client = new LuisClient(appId, subscriptionKey, preview); - } + MobileService = new MobileServiceClient(mobileAppUri); + intentTable = MobileService.GetSyncTable(); + telemetryTable = MobileService.GetSyncTable(); - public static TextProcessor Instance - { - get + try { - if (instance == null) + var t = Task.Run(async () => { - instance = new TextProcessor(); - } - return instance; + await InitLocalStoreAsync(); + }); + t.Wait(); } + // Case of offline start + // TODO imporve error handling + catch(Exception ex) + { + Debug.WriteLine(ex); + } + + bool preview = true; + + _client = new LuisClient(luisAppId, luisSubscriptionKey, preview); + } + //private TextProcessor() + //{ + //} + + //public static TextProcessor Instance + //{ + // get + // { + // if (instance == null) + // { + // instance = new TextProcessor(); + // } + // return instance; + // } + //} + public async Task Predict(string textToPredict) { textToPredict = textToPredict.Trim(); @@ -94,7 +118,10 @@ public async Task Predict(string textToPredict) catch (MobileServiceInvalidOperationException e) { exception = e; + Debug.WriteLine(e); + throw e; } + await Track(TelemetryEvents.CACHE_MISS, textToPredict); @@ -112,7 +139,7 @@ public async Task Predict(string textToPredict) var intentItem = new IntentItem(); intentItem.Intent = temp.Intent; intentItem.Utterance = textToPredict; - + intentItem.IsProcessed = true; intentItem.JsonEntities = JsonConvert.SerializeObject(temp.Entities); // Insert into database @@ -121,11 +148,22 @@ public async Task Predict(string textToPredict) return intent; } + catch (MobileServicePushFailedException push) + { + // + Debug.WriteLine(push); + throw push; + } + // TODO: Refactor to have a better error handling catch (System.Exception e) { + // Check App ID, Luis Key , Luis URL + // Trace error Debug.WriteLine(e.Message); + Debug.WriteLine(e); } + // Save offline var offlineIntent = new IntentItem(); offlineIntent.Utterance = textToPredict; offlineIntent.IsProcessed = false; @@ -202,7 +240,7 @@ private async Task InsertIntentItem(IntentItem IntentItem) private async Task InitLocalStoreAsync() { - string databaseFilename = "localstore1.db"; + string databaseFilename = "localstoreluis.db"; if (!MobileService.SyncContext.IsInitialized) { @@ -215,7 +253,7 @@ private async Task InitLocalStoreAsync() } catch (FileNotFoundException e) { - + Debug.WriteLine("DB does not exit - " + e); } var store = new MobileServiceSQLiteStore(databaseFilename); @@ -233,12 +271,15 @@ private async Task SyncAsync() try { await MobileService.SyncContext.PushAsync(); - await intentTable.PullAsync("IntentItems", intentTable.CreateQuery()); - await telemetryTable.PullAsync("TelemetryItems", telemetryTable.CreateQuery().Take(1)); + await intentTable.PullAsync("IntentItems", intentTable.Where(i => i.IsProcessed == true )); + //await intentTable.PullAsync(null, intentTable.Where(i => i.IsProcessed == true)); + await telemetryTable.PullAsync("Telemetry", telemetryTable.Where(t => t.UserId == "1")); } + // TODO: improve error handling catch (Exception ex) { Debug.WriteLine(ex); + throw ex; } } #endregion diff --git a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/IntentController.cs b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/IntentController.cs index 4838b08..752caf5 100644 --- a/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/IntentController.cs +++ b/LUIS-CachingService/LUIS-CachingComponents/LuisCacheServer/Controllers/IntentController.cs @@ -14,11 +14,15 @@ using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Queue; using Microsoft.Azure; +using Microsoft.ApplicationInsights; namespace KsparkAPI.Controllers { public class IntentItemController : TableController { + + TelemetryClient ai = new TelemetryClient(); + protected override void Initialize(HttpControllerContext controllerContext) { base.Initialize(controllerContext); @@ -52,49 +56,10 @@ public Task PatchIntentItem(string id, Delta patch) public async Task PostIntentItem(IntentItem item) { System.Diagnostics.Trace.TraceInformation("Positing new intent: " + item.Utterance); + + var current = await InsertAsync(item); - IntentItem current; - bool proceessInQueue = false; - - - if (!item.IsProcessed) - { - proceessInQueue = true; - current = await CreateIntentItem(item); - current.IsProcessed = true; - } - else - { - current = item; - } - - current = await InsertAsync(current); - - if (proceessInQueue) - { - // Get storage queue connection string - var queueConStr = CloudConfigurationManager.GetSetting("StorageQueueConnectionString"); - // Get queue name - var queueName = CloudConfigurationManager.GetSetting("StorageQueueName"); - - // Parse the connection string and return a reference to the storage account. - CloudStorageAccount storageAccount = CloudStorageAccount.Parse(queueConStr); - - // Create the queue client. - CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); - - // Retrieve a reference to a queue. - CloudQueue queue = queueClient.GetQueueReference(queueName); - - // Create the queue if it doesn't already exist. - queue.CreateIfNotExists(); - - // Create a message and add it to the queue. - CloudQueueMessage message = new CloudQueueMessage(current.Id); - queue.AddMessage(message); - } - - return CreatedAtRoute("Tables", new { id = current.Id }, current); + return CreatedAtRoute("Tables", new { id = current.Id }, current); } private async Task CreateIntentItem(IntentItem item) diff --git a/LUIS-CachingService/README.md b/LUIS-CachingService/README.md index 33368b8..b943ab0 100644 --- a/LUIS-CachingService/README.md +++ b/LUIS-CachingService/README.md @@ -34,4 +34,5 @@ LUIS Caching Service includes the following components: 1. Fork this repository to your GitHub account 1. Click on the **Deploy to Azure** Button - [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fdacoppet%2Fmixedreality-azure-samples%2Ffeature%2FLUIScache%2FLUIS-CachingService%2Fazuredeploy.json) \ No newline at end of file + [![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fdacoppet%2Fmixedreality-azure-samples%2Ffeature%2FLUIScache%2FLUIS-CachingService%2Fazuredeploy.json) +1. Open the solution (LuisCacheClient.sln) and publish the project LuisCacheServer to the Azure Mobile App \ No newline at end of file From 133ac17d3c5ff8338e3073f9d10608a9a923b420 Mon Sep 17 00:00:00 2001 From: "David COPPET [MSFT]" Date: Sat, 21 Apr 2018 01:42:51 +0200 Subject: [PATCH 08/11] Updating arm template - adding luis, funtions and storage --- LUIS-CachingService/azuredeploy.json | 76 ++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/LUIS-CachingService/azuredeploy.json b/LUIS-CachingService/azuredeploy.json index 13499e5..861ef6c 100644 --- a/LUIS-CachingService/azuredeploy.json +++ b/LUIS-CachingService/azuredeploy.json @@ -88,7 +88,46 @@ "S4" ], "metadata": { - "description": "SKU for Speech API" + "description": "SKU for LUIS API" + } + }, + + "sku": { + "type": "string", + "allowedValues": [ + "Free", + "Shared", + "Basic", + "Standard" + ], + "defaultValue": "Standard", + "metadata": { + "description": "The pricing tier for the hosting plan." + } + }, + "workerSize": { + "type": "string", + "allowedValues": [ + "0", + "1", + "2" + ], + "defaultValue": "0", + "metadata": { + "description": "The instance size of the hosting plan (small, medium, or large)." + } + }, + "storageAccountType": { + "type": "string", + "defaultValue": "Standard_LRS", + "allowedValues": [ + "Standard_LRS", + "Standard_GRS", + "Standard_ZRS", + "Premium_LRS" + ], + "metadata": { + "description": "Storage Account type" } } @@ -99,7 +138,11 @@ "databaseServerName": "[concat(variables('uniqueAppName'), '-sqlserver')]", "databaseName": "[concat(variables('uniqueAppName'), '-sqldb')]", "notificationHubNamespace": "[concat(variables('uniqueAppName'), '-namespace')]", - "notificationHubName": "[concat(variables('uniqueAppName'), '-hub')]" + "notificationHubName": "[concat(variables('uniqueAppName'), '-hub')]", + "storageAccountName": "[concat(variables('uniqueAppName'), 'functions')]", + "luisAccountsName": "[concat(variables('uniqueAppName'),'luis')]", + "functionAppName": "[concat(variables('uniqueAppName'),parameters('appName'))]" + }, "resources": [ { @@ -135,7 +178,8 @@ "name": "appsettings", "type": "config", "dependsOn": [ - "[variables('uniqueAppName')]" + "[variables('uniqueAppName')]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" ], "properties": { "MS_MobileServiceName": "[variables('uniqueAppName')]", @@ -160,6 +204,10 @@ "MS_NotificationHubConnectionString": { "value": "[listkeys(resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs/authorizationRules', variables('notificationHubNamespace'), variables('notificationHubName'), 'DefaultFullSharedAccessSignature'), '2014-09-01').primaryConnectionString]", "type": "Custom" + }, + "StorageQueueConnectionString": { + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]", + "type": "Custom" } } }, @@ -312,16 +360,24 @@ "value": "~1" }, { - "name": "SpeechLocale", - "value": "ja-jp" + "name": "LuisApiEndpoint", + "value": "https://westus.api.cognitive.microsoft.com/luis/api/v2.0" }, { - "name": "SpeechSubscriptionKey", - "value": "[listkeys(resourceId('Microsoft.CognitiveServices/accounts', variables('speechAccountsName')), '2016-02-01-preview').key1]" + "name": "LuisEndpoint", + "value": "https://westus.api.cognitive.microsoft.com/luis/v2.0" }, { - "name": "SpeechStorage", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]" + "name": "LuisAppId", + "value": "8ab015c6-a3f1-44f6-a6bb-e7d1c46ab80a" + }, + { + "name": "LuisAppVersion", + "value": "0.1" + }, + { + "name": "LuisSubscriptionKey", + "value": "[listkeys(resourceId('Microsoft.CognitiveServices/accounts', variables('luisAccountsName')), '2016-02-01-preview').key1]" }, { "name": "AzureWebJobsStorage", @@ -337,7 +393,7 @@ "dependsOn": [ "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]", - "[resourceId('Microsoft.CognitiveServices/accounts', variables('speechAccountsName'))]" + "[resourceId('Microsoft.CognitiveServices/accounts', variables('luisAccountsName'))]" ], "resources": [ { From ec9bb50eed8e2610ea962fa3e674837c9f2e7716 Mon Sep 17 00:00:00 2001 From: "David COPPET [MSFT]" Date: Thu, 26 Apr 2018 11:40:40 +0200 Subject: [PATCH 09/11] Fixing ARM Template : - adding Luis, Function App - adding app settings for functions and git continous deploy --- LUIS-CachingService/azuredeploy.json | 770 +++++++++++++-------------- 1 file changed, 377 insertions(+), 393 deletions(-) diff --git a/LUIS-CachingService/azuredeploy.json b/LUIS-CachingService/azuredeploy.json index 861ef6c..2a5d76e 100644 --- a/LUIS-CachingService/azuredeploy.json +++ b/LUIS-CachingService/azuredeploy.json @@ -1,417 +1,401 @@ { - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "appName": { - "type": "string", - "metadata": { - "description": "The name of the mobile app that you wish to create." - } - }, - "hostingPlanSettings": { - "type": "object", - "defaultValue": { - "tier": "Standard", - "skuName": "S1", - "capacity": "0" - }, - "metadata": { - "description": "The settings of the existing hosting plan." - } - }, - "sqlServerAdminLogin": { - "type": "string", - "metadata": { - "description": "The account name to use for the database server administrator." - } - }, - "sqlServerAdminPassword": { - "type": "securestring", - "metadata": { - "description": "The password to use for the database server administrator." - } - }, - "sqlDatabaseEdition": { - "type": "string", - "metadata": { - "description": "The type of database to create." - }, - "allowedValues": [ - "Basic", - "Standard", - "Premium" - ] - }, - "sqlDatabaseCollation": { - "type": "string", - "defaultValue": "SQL_Latin1_General_CP1_CI_AS", - "metadata": { - "description": "The database collation for governing the proper use of characters." - } - }, - "sqlDatabaseMaxSizeBytes": { - "type": "string", - "defaultValue": "1073741824", - "metadata": { - "description": "The maximum size, in bytes, for the database" - } - }, - "repoURL": { - "type": "string", - "metadata": { - "description": "Repo URL" - } - }, - "branch": { - "type": "string", - "defaultValue": "feature/LUIScache", - "metadata": { - "description": "Repo branch" - } - }, - "manualIntegration": { - "type": "bool", - "defaultValue": true, - "metadata": { - "description": "Use 'true' if you are deploying from the base repo, 'false' if you are deploying from your own fork. If you're using 'false', make sure you have admin permissions to the repo. If you get an error, you should add GitHub integration to another web app manually, so that you get a GitHub access token associated with your Azure Subscription." - } - }, - "luisSku": { - "type": "string", - "defaultValue": "F0", - "allowedValues": [ - "F0", - "S0", - "S1", - "S2", - "S3", - "S4" - ], - "metadata": { - "description": "SKU for LUIS API" - } - }, - - "sku": { - "type": "string", - "allowedValues": [ - "Free", - "Shared", - "Basic", - "Standard" - ], - "defaultValue": "Standard", - "metadata": { - "description": "The pricing tier for the hosting plan." - } - }, - "workerSize": { - "type": "string", - "allowedValues": [ - "0", - "1", - "2" - ], - "defaultValue": "0", - "metadata": { - "description": "The instance size of the hosting plan (small, medium, or large)." - } - }, - "storageAccountType": { - "type": "string", - "defaultValue": "Standard_LRS", - "allowedValues": [ - "Standard_LRS", - "Standard_GRS", - "Standard_ZRS", - "Premium_LRS" - ], - "metadata": { - "description": "Storage Account type" - } - } - + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "appName": { + "type": "string", + "metadata": { + "description": "The name of the mobile app that you wish to create." + } + }, + "hostingPlanSettings": { + "type": "object", + "defaultValue": { + "tier": "Standard", + "skuName": "S1", + "capacity": "0" + }, + "metadata": { + "description": "The settings of the existing hosting plan." + } + }, + "sqlServerAdminLogin": { + "type": "string", + "metadata": { + "description": "The account name to use for the database server administrator." + } + }, + "sqlServerAdminPassword": { + "type": "securestring", + "metadata": { + "description": "The password to use for the database server administrator." + } + }, + "sqlDatabaseEdition": { + "type": "string", + "metadata": { + "description": "The type of database to create." + }, + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "sqlDatabaseCollation": { + "type": "string", + "defaultValue": "SQL_Latin1_General_CP1_CI_AS", + "metadata": { + "description": "The database collation for governing the proper use of characters." + } + }, + "sqlDatabaseMaxSizeBytes": { + "type": "string", + "defaultValue": "1073741824", + "metadata": { + "description": "The maximum size, in bytes, for the database" + } + }, + "repoURL": { + "type": "string", + "metadata": { + "description": "Repo URL" + } }, - "variables": { - "uniqueAppName": "[concat(parameters('appName'), '-', uniqueString(resourceGroup().id))]", - "hostingPlanName": "[concat(variables('uniqueAppName'), '-plan')]", - "databaseServerName": "[concat(variables('uniqueAppName'), '-sqlserver')]", - "databaseName": "[concat(variables('uniqueAppName'), '-sqldb')]", - "notificationHubNamespace": "[concat(variables('uniqueAppName'), '-namespace')]", - "notificationHubName": "[concat(variables('uniqueAppName'), '-hub')]", - "storageAccountName": "[concat(variables('uniqueAppName'), 'functions')]", - "luisAccountsName": "[concat(variables('uniqueAppName'),'luis')]", - "functionAppName": "[concat(variables('uniqueAppName'),parameters('appName'))]" - + "branch": { + "type": "string", + "defaultValue": "feature/LUIScache", + "metadata": { + "description": "Repo branch" + } }, - "resources": [ + "manualIntegration": { + "type": "bool", + "defaultValue": true, + "metadata": { + "description": "Use 'true' if you are deploying from the base repo, 'false' if you are deploying from your own fork. If you're using 'false', make sure you have admin permissions to the repo. If you get an error, you should add GitHub integration to another web app manually, so that you get a GitHub access token associated with your Azure Subscription." + } + }, + "luisSku": { + "type": "string", + "defaultValue": "S0", + "allowedValues": [ + "F0", + "S0", + "S1", + "S2", + "S3", + "S4" + ], + "metadata": { + "description": "SKU for LUIS API" + } + }, + + "sku": { + "type": "string", + "allowedValues": [ + "Free", + "Shared", + "Basic", + "Standard" + ], + "defaultValue": "Standard", + "metadata": { + "description": "The pricing tier for the hosting plan." + } + }, + "workerSize": { + "type": "string", + "allowedValues": [ + "0", + "1", + "2" + ], + "defaultValue": "0", + "metadata": { + "description": "The instance size of the hosting plan (small, medium, or large)." + } + }, + "storageAccountType": { + "type": "string", + "defaultValue": "Standard_LRS", + "allowedValues": [ + "Standard_LRS", + "Standard_GRS", + "Standard_ZRS", + "Premium_LRS" + ], + "metadata": { + "description": "Storage Account type" + } + } + + }, + "variables": { + "uniqueName": "[uniqueString(resourceGroup().id)]", + "uniqueAppName": "[concat(parameters('appName'),variables('uniqueName'))]", + "hostingPlanName": "[concat(variables('uniqueAppName'), '-plan')]", + "databaseServerName": "[concat(variables('uniqueAppName'), '-sqlserver')]", + "databaseName": "[concat(variables('uniqueAppName'), '-sqldb')]", + "notificationHubNamespace": "[concat(variables('uniqueAppName'), '-namespace')]", + "notificationHubName": "[concat(variables('uniqueAppName'), '-hub')]", + "storageAccountName": "[concat(variables('uniqueName'), 'storage')]", + "luisAccountsName": "[concat(variables('uniqueAppName'),'luis')]", + "functionAppName": "[concat(variables('uniqueAppName'),'func')]" + }, + "resources": [ + { + "type": "Microsoft.Web/serverfarms", + "apiVersion": "2015-08-01", + "name": "[variables('hostingPlanName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "[parameters('hostingPlanSettings').skuName]", + "tier": "[parameters('hostingPlanSettings').tier]", + "capacity": "[parameters('hostingPlanSettings').capacity]" + }, + "properties": { + "numberOfWorkers": 1 + } + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "name": "[variables('uniqueAppName')]", + "location": "[resourceGroup().location]", + "kind": "mobileapp", + "properties": { + "name": "[variables('uniqueAppName')]", + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" + }, + "dependsOn": [ + "[variables('hostingPlanName')]" + ], + "resources": [ { - "type": "Microsoft.Web/serverfarms", - "apiVersion": "2015-08-01", - "name": "[variables('hostingPlanName')]", - "location": "[resourceGroup().location]", - "sku": { - "name": "[parameters('hostingPlanSettings').skuName]", - "tier": "[parameters('hostingPlanSettings').tier]", - "capacity": "[parameters('hostingPlanSettings').capacity]" - }, - "properties": { - "numberOfWorkers": 1 - } - }, - { - "apiVersion": "2015-08-01", - "type": "Microsoft.Web/sites", - "name": "[variables('uniqueAppName')]", - "location": "[resourceGroup().location]", - "kind": "mobileapp", - "properties": { - "name": "[variables('uniqueAppName')]", - "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" + "apiVersion": "2015-08-01", + "name": "appsettings", + "type": "config", + "dependsOn": [ + "[variables('uniqueAppName')]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" + ], + "properties": { + "MS_MobileServiceName": "[variables('uniqueAppName')]", + "MS_NotificationHubName": "[variables('notificationHubName')]", + "PROJECT": "LUIS-CachingService\\LUIS-CachingComponents\\LuisCacheServer\\LuisCacheServer.csproj" + } + }, + { + "apiVersion": "2015-08-01", + "name": "connectionstrings", + "type": "config", + "dependsOn": [ + "[variables('uniqueAppName')]", + "[variables('notificationHubName')]", + "[variables('databaseName')]" + ], + "properties": { + "MS_TableConnectionString": { + "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('databaseServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', variables('databaseName'), ';User Id=', parameters('sqlServerAdminLogin'), '@', variables('databaseServerName'), ';Password=', parameters('sqlServerAdminPassword'), ';')]", + "type": "SQLServer" }, - "dependsOn": [ - "[variables('hostingPlanName')]" - ], - "resources": [ - { - "apiVersion": "2015-08-01", - "name": "appsettings", - "type": "config", - "dependsOn": [ - "[variables('uniqueAppName')]", - "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" - ], - "properties": { - "MS_MobileServiceName": "[variables('uniqueAppName')]", - "MS_NotificationHubName": "[variables('notificationHubName')]", - "PROJECT": "LUIS-CachingService\\LUIS-CachingComponents\\LuisCacheServer\\LuisCacheServer.csproj" - } - }, - { - "apiVersion": "2015-08-01", - "name": "connectionstrings", - "type": "config", - "dependsOn": [ - "[variables('uniqueAppName')]", - "[variables('notificationHubName')]", - "[variables('databaseName')]" - ], - "properties": { - "MS_TableConnectionString": { - "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', variables('databaseServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', variables('databaseName'), ';User Id=', parameters('sqlServerAdminLogin'), '@', variables('databaseServerName'), ';Password=', parameters('sqlServerAdminPassword'), ';')]", - "type": "SQLServer" - }, - "MS_NotificationHubConnectionString": { - "value": "[listkeys(resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs/authorizationRules', variables('notificationHubNamespace'), variables('notificationHubName'), 'DefaultFullSharedAccessSignature'), '2014-09-01').primaryConnectionString]", - "type": "Custom" - }, - "StorageQueueConnectionString": { - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]", - "type": "Custom" - } - } - }, - { - "apiVersion": "2015-01-01", - "type": "providers/links", - "name": "Microsoft.Resources/SiteToHub", - "dependsOn": [ - "[variables('uniqueAppName')]", - "[variables('notificationHubName')]" - ], - "properties": { - "targetId": "[resourceId('Microsoft.NotificationHubs/namespaces/NotificationHubs', variables('notificationHubNamespace'), variables('notificationHubName'))]" - } - }, - { - "apiVersion": "2015-08-01", - "name": "web", - "type": "sourcecontrols", - "dependsOn": [ - "[resourceId('Microsoft.Web/Sites', variables('uniqueAppName'))]", - "[resourceId('Microsoft.Web/Sites/config', variables('uniqueAppName'), 'appsettings')]", - "[resourceId('Microsoft.Web/Sites/config', variables('uniqueAppName'), 'connectionstrings')]" - ], - "properties": { - "RepoUrl": "[parameters('repoUrl')]", - "branch": "[parameters('branch')]", - "IsManualIntegration": "[parameters('manualIntegration')]" - } - } - ] - }, - { - "name": "[variables('databaseServerName')]", - "type": "Microsoft.Sql/servers", - "location": "[resourceGroup().location]", - "apiVersion": "2014-04-01-preview", - "properties": { - "administratorLogin": "[parameters('sqlServerAdminLogin')]", - "administratorLoginPassword": "[parameters('sqlServerAdminPassword')]", - "version": "12.0" + "MS_NotificationHubConnectionString": { + "value": "[listkeys(resourceId('Microsoft.NotificationHubs/namespaces/notificationHubs/authorizationRules', variables('notificationHubNamespace'), variables('notificationHubName'), 'DefaultFullSharedAccessSignature'), '2014-09-01').primaryConnectionString]", + "type": "Custom" }, - "resources": [ - { - "name": "[variables('databaseName')]", - "type": "databases", - "location": "[resourceGroup().location]", - "apiVersion": "2014-04-01-preview", - "dependsOn": [ - "[variables('databaseServerName')]" - ], - "properties": { - "edition": "[parameters('sqlDatabaseEdition')]", - "collation": "[parameters('sqlDatabaseCollation')]", - "maxSizeBytes": "[parameters('sqlDatabaseMaxSizeBytes')]" - } - }, - { - "type": "firewallrules", - "apiVersion": "2014-04-01-preview", - "dependsOn": [ - "[variables('databaseServerName')]" - ], - "location": "[resourceGroup().location]", - "name": "open", - "properties": { - "endIpAddress": "255.255.255.255", - "startIpAddress": "0.0.0.0" - } - } - ] - }, - { - "apiVersion": "2014-09-01", - "type": "Microsoft.NotificationHubs/namespaces", - "name": "[variables('notificationHubNamespace')]", - "location": "[resourceGroup().location]", - "properties": { - "region": "[resourceGroup().location]", - "namespaceType": "NotificationHub" + "StorageQueueConnectionString": { + "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]", + "type": "Custom" } - }, - { - "apiVersion": "2014-09-01", - "name": "[concat(variables('notificationHubNamespace'), '/', variables('uniqueAppName'), '-hub')]", - "type": "Microsoft.NotificationHubs/namespaces/notificationHubs", - "location": "[resourceGroup().location]", - "dependsOn": [ - "[variables('notificationHubNamespace')]" - ], - "properties": {} - }, - { - "comments": "Luis ", - "type": "Microsoft.CognitiveServices/accounts", - "sku": { - "name": "[parameters('luisSku')]" - }, - "kind": "LUIS", - "name": "[variables('uniqueAppName')]", - "apiVersion": "2016-02-01-preview", - "location": "[resourceGroup().location]", - "scale": null, - "properties": {}, - "dependsOn": [] + } }, { - "type": "Microsoft.Storage/storageAccounts", - "name": "[variables('storageAccountName')]", - "apiVersion": "2015-06-15", - "location": "[resourceGroup().location]", + "apiVersion": "2015-01-01", + "type": "providers/links", + "name": "Microsoft.Resources/SiteToHub", + "dependsOn": [ + "[variables('uniqueAppName')]", + "[variables('notificationHubName')]" + ], "properties": { - "accountType": "[parameters('storageAccountType')]" + "targetId": "[resourceId('Microsoft.NotificationHubs/namespaces/NotificationHubs', variables('notificationHubNamespace'), variables('notificationHubName'))]" } }, { - "type": "Microsoft.Web/serverfarms", - "apiVersion": "2015-04-01", - "name": "[variables('hostingPlanName')]", - "location": "[resourceGroup().location]", + "apiVersion": "2015-08-01", + "name": "web", + "type": "sourcecontrols", + "dependsOn": [ + "[resourceId('Microsoft.Web/Sites', variables('uniqueAppName'))]", + "[resourceId('Microsoft.Web/Sites/config', variables('uniqueAppName'), 'appsettings')]", + "[resourceId('Microsoft.Web/Sites/config', variables('uniqueAppName'), 'connectionstrings')]" + ], + "properties": { + "RepoUrl": "[parameters('repoUrl')]", + "branch": "[parameters('branch')]", + "IsManualIntegration": "[parameters('manualIntegration')]" + } + } + ] + }, + { + "apiVersion": "2015-08-01", + "type": "Microsoft.Web/sites", + "name": "[variables('functionAppName')]", + "location": "[resourceGroup().location]", + "kind": "functionapp", + "properties": { + "name": "[variables('functionAppName')]", + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", + "hostingEnvironment": "", + "clientAffinityEnabled": false, + "siteConfig": { + "alwaysOn": true, + "cors": { + "allowedOrigins": [ + "*" + ] + } + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]", + "[resourceId('Microsoft.CognitiveServices/accounts', variables('luisAccountsName'))]" + ], + "resources": [ + { + "apiVersion": "2015-08-01", + "name": "appsettings", + "type": "config", + "dependsOn": [ + "[resourceId('Microsoft.Web/Sites', variables('functionAppName'))]", + "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]", + "[resourceId('Microsoft.CognitiveServices/accounts', variables('luisAccountsName'))]" + ], "properties": { - "name": "[variables('hostingPlanName')]", - "sku": "[parameters('sku')]", - "workerSize": "[parameters('workerSize')]", - "hostingEnvironment": "", - "numberOfWorkers": 1 + "PROJECT": "LUIS-CachingService\\LUIS-CachingComponents\\LuisCacheFunctions\\LuisCacheFunctions.csproj", + "FUNCTIONS_EXTENSION_VERSION": "~1", + "LuisApiEndpoint": "https://westus.api.cognitive.microsoft.com/luis/api/v2.0", + "LuisEndpoint": "https://westus.api.cognitive.microsoft.com/luis/v2.0", + "LuisAppId": "8ab015c6-a3f1-44f6-a6bb-e7d1c46ab80a", + "LuisAppVersion": "0.1", + "LuisSubscriptionKey": "[listkeys(resourceId('Microsoft.CognitiveServices/accounts', variables('luisAccountsName')), '2016-02-01-preview').key1]", + "AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]", + "AzureWebJobsDashboard": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]" } }, { "apiVersion": "2015-08-01", - "type": "Microsoft.Web/sites", - "name": "[variables('functionAppName')]", + "name": "web", + "type": "sourcecontrols", + "dependsOn": [ + "[resourceId('Microsoft.Web/Sites', variables('functionAppName'))]" + ], + "properties": { + "RepoUrl": "[parameters('repoURL')]", + "branch": "[parameters('branch')]", + "IsManualIntegration": true + } + } + ] + }, + { + "name": "[variables('databaseServerName')]", + "type": "Microsoft.Sql/servers", + "location": "[resourceGroup().location]", + "apiVersion": "2014-04-01-preview", + "properties": { + "administratorLogin": "[parameters('sqlServerAdminLogin')]", + "administratorLoginPassword": "[parameters('sqlServerAdminPassword')]", + "version": "12.0" + }, + "resources": [ + { + "name": "[variables('databaseName')]", + "type": "databases", "location": "[resourceGroup().location]", - "kind": "functionapp", + "apiVersion": "2014-04-01-preview", + "dependsOn": [ + "[variables('databaseServerName')]" + ], "properties": { - "name": "[variables('functionAppName')]", - "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", - "hostingEnvironment": "", - "clientAffinityEnabled": false, - "siteConfig": { - "alwaysOn": true, - "cors": { - "allowedOrigins": [ - "*" - ] - }, - "appSettings": [ - { - "name": "FUNCTIONS_EXTENSION_VERSION", - "value": "~1" - }, - { - "name": "LuisApiEndpoint", - "value": "https://westus.api.cognitive.microsoft.com/luis/api/v2.0" - }, - { - "name": "LuisEndpoint", - "value": "https://westus.api.cognitive.microsoft.com/luis/v2.0" - }, - { - "name": "LuisAppId", - "value": "8ab015c6-a3f1-44f6-a6bb-e7d1c46ab80a" - }, - { - "name": "LuisAppVersion", - "value": "0.1" - }, - { - "name": "LuisSubscriptionKey", - "value": "[listkeys(resourceId('Microsoft.CognitiveServices/accounts', variables('luisAccountsName')), '2016-02-01-preview').key1]" - }, - { - "name": "AzureWebJobsStorage", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]" - }, - { - "name": "AzureWebJobsDashboard", - "value": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',listkeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2015-05-01-preview').key1,';')]" - } - ] - } - }, + "edition": "[parameters('sqlDatabaseEdition')]", + "collation": "[parameters('sqlDatabaseCollation')]", + "maxSizeBytes": "[parameters('sqlDatabaseMaxSizeBytes')]" + } + }, + { + "type": "firewallrules", + "apiVersion": "2014-04-01-preview", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", - "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]", - "[resourceId('Microsoft.CognitiveServices/accounts', variables('luisAccountsName'))]" + "[variables('databaseServerName')]" ], - "resources": [ - { - "apiVersion": "2015-08-01", - "name": "web", - "type": "sourcecontrols", - "dependsOn": [ - "[resourceId('Microsoft.Web/Sites', variables('functionAppName'))]" - ], - "properties": { - "RepoUrl": "[parameters('repoURL')]", - "branch": "[parameters('branch')]", - "IsManualIntegration": true - } - } - ] + "location": "[resourceGroup().location]", + "name": "open", + "properties": { + "endIpAddress": "255.255.255.255", + "startIpAddress": "0.0.0.0" + } } - - ], - "outputs": {} + ] + }, + { + "apiVersion": "2014-09-01", + "type": "Microsoft.NotificationHubs/namespaces", + "name": "[variables('notificationHubNamespace')]", + "location": "[resourceGroup().location]", + "properties": { + "region": "[resourceGroup().location]", + "namespaceType": "NotificationHub" + } + }, + { + "apiVersion": "2014-09-01", + "name": "[concat(variables('notificationHubNamespace'), '/', variables('uniqueAppName'), '-hub')]", + "type": "Microsoft.NotificationHubs/namespaces/notificationHubs", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[variables('notificationHubNamespace')]" + ], + "properties": {} + }, + { + "comments": "Luis ", + "type": "Microsoft.CognitiveServices/accounts", + "sku": { + "name": "[parameters('luisSku')]" + }, + "kind": "LUIS", + "name": "[variables('uniqueAppName')]", + "apiVersion": "2016-02-01-preview", + "location": "[resourceGroup().location]", + "scale": null, + "properties": {}, + "dependsOn": [] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[variables('storageAccountName')]", + "apiVersion": "2015-06-15", + "location": "[resourceGroup().location]", + "properties": { + "accountType": "[parameters('storageAccountType')]" + } + }, + { + "type": "Microsoft.CognitiveServices/accounts", + "sku": { + "name": "[parameters('luisSku')]" + }, + "kind": "LUIS", + "name": "[variables('luisAccountsName')]", + "apiVersion": "2016-02-01-preview", + "location": "westus", + "properties": {} + } + ], + "outputs": {} } \ No newline at end of file From c8303a19b7dfb306cd7b09a8eeff785a94342937 Mon Sep 17 00:00:00 2001 From: "David COPPET [MSFT]" Date: Thu, 26 Apr 2018 11:59:54 +0200 Subject: [PATCH 10/11] Add default value to improve UX --- LUIS-CachingService/azuredeploy.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LUIS-CachingService/azuredeploy.json b/LUIS-CachingService/azuredeploy.json index 2a5d76e..f137d0a 100644 --- a/LUIS-CachingService/azuredeploy.json +++ b/LUIS-CachingService/azuredeploy.json @@ -33,6 +33,7 @@ }, "sqlDatabaseEdition": { "type": "string", + "defaultValue" : "Basic", "metadata": { "description": "The type of database to create." }, @@ -58,6 +59,7 @@ }, "repoURL": { "type": "string", + "defaultValue": "https://github.com/dacoppet/mixedreality-azure-samples", "metadata": { "description": "Repo URL" } From 054e4fae358d7bff2728901fa2aca184ff9a33d8 Mon Sep 17 00:00:00 2001 From: "David COPPET [MSFT]" Date: Thu, 26 Apr 2018 12:22:02 +0200 Subject: [PATCH 11/11] Adding default settings Fixing function autodeploy function --- LUIS-CachingService/azuredeploy.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/LUIS-CachingService/azuredeploy.json b/LUIS-CachingService/azuredeploy.json index f137d0a..11905ad 100644 --- a/LUIS-CachingService/azuredeploy.json +++ b/LUIS-CachingService/azuredeploy.json @@ -4,6 +4,7 @@ "parameters": { "appName": { "type": "string", + "defaultValue": "luiscache", "metadata": { "description": "The name of the mobile app that you wish to create." } @@ -294,12 +295,13 @@ "name": "web", "type": "sourcecontrols", "dependsOn": [ - "[resourceId('Microsoft.Web/Sites', variables('functionAppName'))]" + "[resourceId('Microsoft.Web/Sites', variables('functionAppName'))]", + "[resourceId('Microsoft.Web/Sites/config', variables('functionAppName'), 'appsettings')]" ], "properties": { - "RepoUrl": "[parameters('repoURL')]", + "RepoUrl": "[parameters('repoUrl')]", "branch": "[parameters('branch')]", - "IsManualIntegration": true + "IsManualIntegration": "[parameters('manualIntegration')]" } } ]