-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.ps1
More file actions
56 lines (40 loc) · 2.09 KB
/
Copy pathdeploy.ps1
File metadata and controls
56 lines (40 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
param (
[Parameter(Mandatory = $True)]
[string]
$resourceGroup,
[Parameter(Mandatory = $True)]
[string]
$location,
[Parameter(Mandatory = $True)]
[string]
$translationAcct,
[Parameter(Mandatory = $True)]
[string]
$storageAcct
)
$error.Clear()
$ErrorActionPreference = 'Stop'
Write-Host -ForegroundColor Green "Creating resource group $resourceGroup and required resources in $location"
$result = az deployment sub create --location $location --template-file .\infra\main.bicep --parameters resourceGroupName=$resourceGroup storageAccountName=$storageAcct translateAccountName=$translationAcct location=$location | ConvertFrom-Json
Write-Host -ForegroundColor Green "Deployment Result"
Write-Host -ForegroundColor Yellow ($result.properties.outputs | ConvertTo-Json)
if(!$?){ exit }
Write-Host -ForegroundColor Green "Getting translation account account key"
$translatorKey = az cognitiveservices account keys list --resource-group $resourceGroup --name $translationAcct -o tsv --query key1
$localsettings = @{
"SOURCE_BLOB_SAS" = $result.properties.outputs.incoming_url.value
"TARGET_BLOB_SAS" = $result.properties.outputs.translated_url.value
"TRANSLATOR_TEXT_SUBSCRIPTION_KEY" = $translatorKey
"TRANSLATOR_DOCUMENT_ENDPOINT" = $result.properties.outputs.translatorDocEndpoint.value
"TRANSLATOR_TEXT_ENDPOINT" = "https://api.cognitive.microsofttranslator.com/" #$result.properties.outputs.translatorEndpoint.value
"TRANSLATOR_SERVICE_REGION" = $result.properties.outputs.location.value
"CUSTOM_TRANSLATOR_CATEGORY_ID" = ""
"CUSTOM_TRANSLATOR_TO_LANGUAGE" = ""
"TEXT_TRANSLATION_LANGUAGES" = @("en", "es", "fr", "de", "it", "ja", "is", "hi", "zh-Hans")
}
Write-Host -ForegroundColor Green "Creating local.settings.json"
$localsettingsJson = ConvertTo-Json $localsettings -Depth 100
$localsettingsJson | Out-File -FilePath ".\local.settings.json"
Write-Host -ForegroundColor Green "Running app..."
dotnet build --no-incremental .\translator_demo.csproj -o .\bin\demo
.\bin\demo\translator_demo.exe