Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
Updated News deployment scripts (#1815)
Browse files Browse the repository at this point in the history
* updated news skill deployment scripts

* updated capitalization

* updated arm template

* Rename news.lu to News.lu

* Rename general.lu to General.lu
  • Loading branch information
lauren-mills committed Jul 11, 2019
1 parent 0cc7642 commit 63e7879
Show file tree
Hide file tree
Showing 19 changed files with 418 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -561,4 +561,4 @@ $PREBUILT:ordinal

> # List entities

> # RegEx entities
> # RegEx entities
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@
> # Entity definitions

$topic:simple
$site:simple
$site:simple
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,17 @@
}
],
"outputs": {
"botWebAppName": {
"type": "string",
"value": "[parameters('botWebAppName')]"
},
"ApplicationInsights": {
"type": "object",
"value": {
"InstrumentationKey": "[reference(resourceId('Microsoft.Insights/components', parameters('appInsightsName'))).InstrumentationKey]"
}
},
"storage": {
"blobStorage": {
"type": "object",
"value": {
"connectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('cleanStorageAccountName'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('cleanStorageAccountName')), '2018-07-01').keys[0].value, ';EndpointSuffix=core.windows.net')]",
Expand All @@ -236,22 +240,23 @@
"type": "object",
"value": {
"cosmosDBEndpoint": "[reference(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbName'))).documentEndpoint]",
"authkey": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbName')), '2015-04-08').primaryMasterKey]",
"authKey": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDbName')), '2015-04-08').primaryMasterKey]",
"databaseId": "botstate-db",
"collectionId": "botstate-collection"
}
},
"luis": {
"type": "object",
"value": {
"accountName": "[parameters('luisServiceName')]",
"key": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', parameters('luisServiceName')),'2017-04-18').key1]"
}
},
"bingSearch": {
"BingNewsKey": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', parameters('bingServiceName')),'2017-04-18').key1]"
},
"azureMaps": {
"AzureMapsKey": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.Maps/accounts', parameters('azureMapsServiceName')),'2018-05-01').primaryKey]"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ if ($parametersFile) {
--parameters name=$name microsoftAppId=$appId microsoftAppPassword="`"$($appPassword)`""

if ($validation) {
$validation >> $logFile
$validation = $validation | ConvertFrom-Json

if (-not $validation.error) {
Expand All @@ -125,8 +126,9 @@ if ($parametersFile) {
--parameters name=$name microsoftAppId=$appId microsoftAppPassword="`"$($appPassword)`""
}
else {
Write-Host "! Template is not valid with provided parameters." -ForegroundColor DarkRed
Write-Host "! Template is not valid with provided parameters. Review the log for more information." -ForegroundColor DarkRed
Write-Host "! Error: $($validation.error.message)" -ForegroundColor DarkRed
Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed
Write-Host "+ To delete this resource group, run 'az group delete -g $($resourceGroup) --no-wait'" -ForegroundColor Magenta
Break
}
Expand All @@ -140,6 +142,7 @@ else {
--parameters name=$name microsoftAppId=$appId microsoftAppPassword="`"$($appPassword)`""

if ($validation) {
$validation >> $logFile
$validation = $validation | ConvertFrom-Json

if (-not $validation.error) {
Expand All @@ -151,8 +154,9 @@ else {
--parameters name=$name microsoftAppId=$appId microsoftAppPassword="`"$($appPassword)`""
}
else {
Write-Host "! Template is not valid with provided parameters." -ForegroundColor DarkRed
Write-Host "! Error: $($validation.error.message)" -ForegroundColor DarkRed
Write-Host "! Template is not valid with provided parameters. Review the log for more information." -ForegroundColor DarkRed
Write-Host "! Error: $($validation.error.message)" -ForegroundColor DarkRed
Write-Host "! Log: $($logFile)" -ForegroundColor DarkRed
Write-Host "+ To delete this resource group, run 'az group delete -g $($resourceGroup) --no-wait'" -ForegroundColor Magenta
Break
}
Expand All @@ -171,6 +175,8 @@ if ($outputs)
# Log and convert to JSON
$outputs >> $logFile
$outputs = $outputs | ConvertFrom-Json
$outputMap = @{}
$outputs.PSObject.Properties | Foreach-Object { $outputMap[$_.Name] = $_.Value }

# Update appsettings.json
Write-Host "> Updating appsettings.json ..."
Expand All @@ -183,21 +189,19 @@ if ($outputs)

$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppId' -Value $appId
$settings | Add-Member -Type NoteProperty -Force -Name 'microsoftAppPassword' -Value $appPassword
if ($outputs.ApplicationInsights) { $settings | Add-Member -Type NoteProperty -Force -Name 'ApplicationInsights' -Value $outputs.ApplicationInsights.value }
if ($outputs.storage) { $settings | Add-Member -Type NoteProperty -Force -Name 'blobStorage' -Value $outputs.storage.value }
if ($outputs.cosmosDb) { $settings | Add-Member -Type NoteProperty -Force -Name 'cosmosDb' -Value $outputs.cosmosDb.value }
if ($outputs.contentModerator) { $settings | Add-Member -Type NoteProperty -Force -Name 'contentModerator' -Value $outputs.contentModerator.value }

foreach ($key in $outputMap.Keys) { $settings | Add-Member -Type NoteProperty -Force -Name $key -Value $outputMap[$key].value }
$settings | ConvertTo-Json -depth 100 | Out-File $(Join-Path $projDir appsettings.json)

if ($outputs.qnaMaker.value.key) { $qnaSubscriptionKey = $outputs.qnaMaker.value.key }

# Delay to let QnA Maker finish setting up
Start-Sleep -s 30

# Deploy cognitive models
Invoke-Expression "$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1') -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -outFolder `"$($projDir)`" -languages `"$($languages)`""
Invoke-Expression "& '$(Join-Path $PSScriptRoot 'deploy_cognitive_models.ps1')' -name $($name) -luisAuthoringRegion $($luisAuthoringRegion) -luisAuthoringKey $($luisAuthoringKey) -luisAccountName $($outputs.luis.value.accountName) -luisSubscriptionKey $($outputs.luis.value.key) -resourceGroup $($resourceGroup) -qnaSubscriptionKey '$($qnaSubscriptionKey)' -outFolder '$($projDir)' -languages '$($languages)'"

# Publish bot
Invoke-Expression "$(Join-Path $PSScriptRoot 'publish.ps1') -name $($name) -resourceGroup $($resourceGroup) -projFolder `"$($projDir)`""
Invoke-Expression "& '$(Join-Path $PSScriptRoot 'publish.ps1')' -name $($outputs.botWebAppName.value) -resourceGroup $($resourceGroup) -projFolder '$($projDir)'"

Write-Host "> Done."
}
Expand Down Expand Up @@ -232,4 +236,4 @@ else

Write-Host "+ To delete this resource group, run 'az group delete -g $($resourceGroup) --no-wait'" -ForegroundColor Magenta
Break
}
}
Loading

0 comments on commit 63e7879

Please sign in to comment.