389 строки
18 KiB
JSON
389 строки
18 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"baseName": {
|
|
"type": "string",
|
|
"defaultValue": "[resourceGroup().name]",
|
|
"metadata": {
|
|
"description": "The base resource name."
|
|
}
|
|
},
|
|
"location": {
|
|
"type": "string",
|
|
"defaultValue": "[resourceGroup().location]",
|
|
"metadata": {
|
|
"metadata": {
|
|
"description": "The location of the resource. By default, this is the same as the resource group."
|
|
}
|
|
}
|
|
},
|
|
"testApplicationOid": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The principal to assign the role to. This is application object id."
|
|
}
|
|
},
|
|
"tenantId": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The tenant id to which the application and resources belong."
|
|
}
|
|
},
|
|
"testApplicationId": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The application client id used to run tests."
|
|
}
|
|
},
|
|
"testApplicationSecret": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The application client secret used to run tests."
|
|
}
|
|
},
|
|
"cognitiveServicesEndpointSuffix": {
|
|
"defaultValue": ".cognitiveservices.azure.com/",
|
|
"type": "string"
|
|
},
|
|
"useStaticStorageResource": {
|
|
"type": "bool",
|
|
"defaultValue": false,
|
|
"metadata": {
|
|
"description": "A static storage resource is used for Dogfood env."
|
|
}
|
|
},
|
|
"staticStorageName": {
|
|
"defaultValue": "pythontranslationstorage",
|
|
"type": "string"
|
|
},
|
|
"blobStorageAccount": {
|
|
"type": "string",
|
|
"defaultValue": "[if(parameters('useStaticStorageResource'), parameters('staticStorageName'), parameters('baseName'))]"
|
|
},
|
|
"storageAccResourceId": {
|
|
"type": "string",
|
|
"defaultValue": "[resourceId('Microsoft.Storage/storageAccounts', parameters('blobStorageAccount'))]"
|
|
},
|
|
"targetContainerName_1": {
|
|
"type": "string",
|
|
"defaultValue": "testingcontainer1"
|
|
},
|
|
"targetContainerSasProperties_1": {
|
|
"type": "object",
|
|
"defaultValue": {
|
|
"canonicalizedResource": "[concat('/blob/', parameters('blobStorageAccount'), '/', parameters('targetContainerName_1'))]",
|
|
"signedExpiry": "[dateTimeAdd(utcNow('u'), 'PT3H')]",
|
|
"signedPermission": "wl",
|
|
"signedResource": "c"
|
|
}
|
|
},
|
|
"targetContainerName_2": {
|
|
"type": "string",
|
|
"defaultValue": "testingcontainer2"
|
|
},
|
|
"targetContainerSasProperties_2": {
|
|
"type": "object",
|
|
"defaultValue": {
|
|
"canonicalizedResource": "[concat('/blob/', parameters('blobStorageAccount'), '/', parameters('targetContainerName_2'))]",
|
|
"signedExpiry": "[dateTimeAdd(utcNow('u'), 'PT3H')]",
|
|
"signedPermission": "wl",
|
|
"signedResource": "c"
|
|
}
|
|
},
|
|
"targetContainerName_3": {
|
|
"type": "string",
|
|
"defaultValue": "testingcontainer3"
|
|
},
|
|
"targetContainerSasProperties_3": {
|
|
"type": "object",
|
|
"defaultValue": {
|
|
"canonicalizedResource": "[concat('/blob/', parameters('blobStorageAccount'), '/', parameters('targetContainerName_3'))]",
|
|
"signedExpiry": "[dateTimeAdd(utcNow('u'), 'PT3H')]",
|
|
"signedPermission": "wl",
|
|
"signedResource": "c"
|
|
}
|
|
},
|
|
"targetContainerName_4": {
|
|
"type": "string",
|
|
"defaultValue": "testingcontainer4"
|
|
},
|
|
"targetContainerSasProperties_4": {
|
|
"type": "object",
|
|
"defaultValue": {
|
|
"canonicalizedResource": "[concat('/blob/', parameters('blobStorageAccount'), '/', parameters('targetContainerName_4'))]",
|
|
"signedExpiry": "[dateTimeAdd(utcNow('u'), 'PT3H')]",
|
|
"signedPermission": "wl",
|
|
"signedResource": "c"
|
|
}
|
|
},
|
|
"sourceContainerName": {
|
|
"type": "string",
|
|
"defaultValue": "sourcecontainer"
|
|
},
|
|
"sourceContainerSasProperties": {
|
|
"type": "object",
|
|
"defaultValue": {
|
|
"canonicalizedResource": "[concat('/blob/', parameters('blobStorageAccount'), '/', parameters('sourceContainerName'))]",
|
|
"signedExpiry": "[dateTimeAdd(utcNow('u'), 'PT3H')]",
|
|
"signedPermission": "rl",
|
|
"signedResource": "c"
|
|
}
|
|
},
|
|
"glossaryFileName": {
|
|
"type": "string",
|
|
"defaultValue": "glosario.tsv"
|
|
}
|
|
},
|
|
"variables": {
|
|
"txtUniqueSubDomainName": "[concat('text', parameters('baseName'))]",
|
|
"txtEndpointValue": "[format('https://api.cognitive.microsofttranslator.com')]",
|
|
"txtCustomEndpointValue": "[format('https://{0}.cognitiveservices.azure.com', parameters('baseName'))]",
|
|
"txtRegionValue": "[format('{0}', parameters('location'))]",
|
|
"authorizationApiVersion": "2018-09-01-preview",
|
|
"docTranslationBaseName": "[parameters('baseName')]",
|
|
"docTranslationApiVersion": "2017-04-18",
|
|
"storageMgmtApiVersion": "2017-10-01",
|
|
"storageAccountName": "[parameters('blobStorageAccount')]",
|
|
"location": "[resourceGroup().location]",
|
|
"azureDocTranslationUrl": "[if(parameters('useStaticStorageResource'), concat('https://', variables('docTranslationBaseName'), '.ppe', parameters('cognitiveServicesEndpointSuffix')), concat('https://', variables('docTranslationBaseName'), parameters('cognitiveServicesEndpointSuffix')))]",
|
|
"azureStorageEndpoint": "[concat('https://', parameters('blobStorageAccount'), '.blob.core.windows.net/')]",
|
|
"cognitiveServiceUserRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/a97b65f3-24c7-4388-baec-2e87135dc908')]",
|
|
"txtAadResourceIdValue": "[parameters('text_translation_aadResourceId')]",
|
|
"encryption": {
|
|
"services": {
|
|
"blob": {
|
|
"enabled": true
|
|
}
|
|
},
|
|
"keySource": "Microsoft.Storage"
|
|
},
|
|
"networkAcls": {
|
|
"bypass": "AzureServices",
|
|
"virtualNetworkRules": [],
|
|
"ipRules": [],
|
|
"defaultAction": "Allow"
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.CognitiveServices/accounts",
|
|
"apiVersion": "2017-04-18",
|
|
"name": "[variables('txtUniqueSubDomainName')]",
|
|
"location": "[parameters('location')]",
|
|
"sku": {
|
|
"name": "S1"
|
|
},
|
|
"kind": "TextTranslation",
|
|
"properties": {
|
|
"customSubDomainName": "[variables('txtUniqueSubDomainName')]"
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Authorization/roleAssignments",
|
|
"apiVersion": "[variables('authorizationApiVersion')]",
|
|
"name": "[guid(concat(variables('cognitiveServiceUserRoleId'), variables('docTranslationBaseName')))]",
|
|
"dependsOn": [
|
|
"[variables('docTranslationBaseName')]"
|
|
],
|
|
"properties": {
|
|
"principalId": "[parameters('testApplicationOid')]",
|
|
"roleDefinitionId": "[variables('cognitiveServiceUserRoleId')]"
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.CognitiveServices/accounts",
|
|
"name": "[variables('docTranslationBaseName')]",
|
|
"apiVersion": "[variables('docTranslationApiVersion')]",
|
|
"sku": {
|
|
"name": "S1"
|
|
},
|
|
"kind": "TextTranslation",
|
|
"location": "[parameters('location')]",
|
|
"properties": {
|
|
"customSubDomainName": "[variables('docTranslationBaseName')]"
|
|
}
|
|
},
|
|
{
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "Microsoft.Storage/storageAccounts",
|
|
"apiVersion": "[variables('storageMgmtApiVersion')]",
|
|
"name": "[variables('storageAccountName')]",
|
|
"location": "[variables('location')]",
|
|
"sku": {
|
|
"name": "Standard_RAGRS",
|
|
"tier": "Standard"
|
|
},
|
|
"kind": "StorageV2",
|
|
"properties": {
|
|
"networkAcls": "[variables('networkAcls')]",
|
|
"supportsHttpsTrafficOnly": true,
|
|
"encryption": "[variables('encryption')]",
|
|
"accessTier": "Cool"
|
|
},
|
|
"resources": [
|
|
{
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "blobServices/containers",
|
|
"apiVersion": "[variables('storageMgmtApiVersion')]",
|
|
"name": "[concat('default/', parameters('targetContainerName_1'))]",
|
|
"dependsOn": [
|
|
"[parameters('blobStorageAccount')]"
|
|
]
|
|
},
|
|
{
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "blobServices/containers",
|
|
"apiVersion": "[variables('storageMgmtApiVersion')]",
|
|
"name": "[concat('default/', parameters('targetContainerName_2'))]",
|
|
"dependsOn": [
|
|
"[parameters('blobStorageAccount')]"
|
|
]
|
|
},
|
|
{
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "blobServices/containers",
|
|
"apiVersion": "[variables('storageMgmtApiVersion')]",
|
|
"name": "[concat('default/', parameters('targetContainerName_3'))]",
|
|
"dependsOn": [
|
|
"[parameters('blobStorageAccount')]"
|
|
]
|
|
},
|
|
{
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "blobServices/containers",
|
|
"apiVersion": "[variables('storageMgmtApiVersion')]",
|
|
"name": "[concat('default/', parameters('targetContainerName_4'))]",
|
|
"dependsOn": [
|
|
"[parameters('blobStorageAccount')]"
|
|
]
|
|
},
|
|
{
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "blobServices/containers",
|
|
"apiVersion": "[variables('storageMgmtApiVersion')]",
|
|
"name": "[concat('default/', parameters('sourceContainerName'))]",
|
|
"dependsOn": [
|
|
"[parameters('blobStorageAccount')]"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"outputs": {
|
|
"AZURE_TENANT_ID": {
|
|
"type": "string",
|
|
"value": "[parameters('tenantId')]"
|
|
},
|
|
"AZURE_CLIENT_ID": {
|
|
"type": "string",
|
|
"value": "[parameters('testApplicationId')]"
|
|
},
|
|
"AZURE_CLIENT_SECRET": {
|
|
"type": "string",
|
|
"value": "[parameters('testApplicationSecret')]"
|
|
},
|
|
"TRANSLATION_DOCUMENT_NAME": {
|
|
"type": "string",
|
|
"value": "[variables('docTranslationBaseName')]"
|
|
},
|
|
"TRANSLATION_DOCUMENT_TEST_API_KEY": {
|
|
"type": "string",
|
|
"value": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', variables('docTranslationBaseName')), variables('docTranslationApiVersion')).key1]"
|
|
},
|
|
"TRANSLATION_DOCUMENT_TEST_ENDPOINT": {
|
|
"type": "string",
|
|
"value": "[variables('azureDocTranslationUrl')]"
|
|
},
|
|
"TRANSLATION_DOCUMENT_STORAGE_NAME": {
|
|
"type": "string",
|
|
"value": "[parameters('blobStorageAccount')]"
|
|
},
|
|
"TRANSLATION_DOCUMENT_STORAGE_KEY": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), variables('storageMgmtApiVersion')).keys[0].value]"
|
|
},
|
|
"AZURE_DOCUMENT_TRANSLATION_KEY": {
|
|
"type": "string",
|
|
"value": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', variables('docTranslationBaseName')), variables('docTranslationApiVersion')).key1]"
|
|
},
|
|
"AZURE_DOCUMENT_TRANSLATION_ENDPOINT": {
|
|
"type": "string",
|
|
"value": "[variables('azureDocTranslationUrl')]"
|
|
},
|
|
"AZURE_STORAGE_ACCOUNT_NAME": {
|
|
"type": "string",
|
|
"value": "[parameters('blobStorageAccount')]"
|
|
},
|
|
"AZURE_STORAGE_SOURCE_KEY": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), variables('storageMgmtApiVersion')).keys[0].value]"
|
|
},
|
|
"AZURE_STORAGE_SOURCE_ENDPOINT": {
|
|
"type": "string",
|
|
"value": "[variables('azureStorageEndpoint')]"
|
|
},
|
|
"AZURE_SOURCE_CONTAINER_URL": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[concat(reference(parameters('storageAccResourceId'), '2019-06-01').primaryEndpoints.blob, parameters('sourceContainerName'), '?', listServiceSas(parameters('storageAccResourceId'), '2019-06-01', parameters('sourceContainerSasProperties')).serviceSasToken)]"
|
|
},
|
|
"AZURE_SOURCE_CONTAINER_URL_1": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[concat(reference(parameters('storageAccResourceId'), '2019-06-01').primaryEndpoints.blob, parameters('sourceContainerName'), '?', listServiceSas(parameters('storageAccResourceId'), '2019-06-01', parameters('sourceContainerSasProperties')).serviceSasToken)]"
|
|
},
|
|
"AZURE_SOURCE_CONTAINER_URL_2": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[concat(reference(parameters('storageAccResourceId'), '2019-06-01').primaryEndpoints.blob, parameters('sourceContainerName'), '?', listServiceSas(parameters('storageAccResourceId'), '2019-06-01', parameters('sourceContainerSasProperties')).serviceSasToken)]"
|
|
},
|
|
"AZURE_TRANSLATION_GLOSSARY_URL": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[concat(reference(parameters('storageAccResourceId'), '2019-06-01').primaryEndpoints.blob, parameters('sourceContainerName'), '/', parameters('glossaryFileName'), '?', listServiceSas(parameters('storageAccResourceId'), '2019-06-01', parameters('sourceContainerSasProperties')).serviceSasToken)]"
|
|
},
|
|
"AZURE_TARGET_CONTAINER_URL": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[concat(reference(parameters('storageAccResourceId'), '2019-06-01').primaryEndpoints.blob, parameters('targetContainerName_1'), '?', listServiceSas(parameters('storageAccResourceId'), '2019-06-01', parameters('targetContainerSasProperties_1')).serviceSasToken)]"
|
|
},
|
|
"AZURE_TARGET_CONTAINER_URL_FR": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[concat(reference(parameters('storageAccResourceId'), '2019-06-01').primaryEndpoints.blob, parameters('targetContainerName_2'), '?', listServiceSas(parameters('storageAccResourceId'), '2019-06-01', parameters('targetContainerSasProperties_2')).serviceSasToken)]"
|
|
},
|
|
"AZURE_TARGET_CONTAINER_URL_AR": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[concat(reference(parameters('storageAccResourceId'), '2019-06-01').primaryEndpoints.blob, parameters('targetContainerName_3'), '?', listServiceSas(parameters('storageAccResourceId'), '2019-06-01', parameters('targetContainerSasProperties_3')).serviceSasToken)]"
|
|
},
|
|
"AZURE_TARGET_CONTAINER_URL_ES": {
|
|
"condition": "[not(parameters('useStaticStorageResource'))]",
|
|
"type": "string",
|
|
"value": "[concat(reference(parameters('storageAccResourceId'), '2019-06-01').primaryEndpoints.blob, parameters('targetContainerName_4'), '?', listServiceSas(parameters('storageAccResourceId'), '2019-06-01', parameters('targetContainerSasProperties_4')).serviceSasToken)]"
|
|
},
|
|
"TEXT_TRANSLATION_APIKEY": {
|
|
"type": "string",
|
|
"value": "[listKeys(resourceId('Microsoft.CognitiveServices/accounts', variables('txtUniqueSubDomainName')), '2017-04-18').key1]"
|
|
},
|
|
"TEXT_TRANSLATION_ENDPOINT": {
|
|
"type": "string",
|
|
"value": "[variables('txtEndpointValue')]"
|
|
},
|
|
"TEXT_TRANSLATION_CUSTOM_ENDPOINT": {
|
|
"type": "string",
|
|
"value": "[variables('txtCustomEndpointValue')]"
|
|
},
|
|
"TEXT_TRANSLATION_REGION": {
|
|
"type": "string",
|
|
"value": "[variables('txtRegionValue')]"
|
|
},
|
|
"TEXT_TRANSLATION_AAD_RESOURCE_ID": {
|
|
"type": "string",
|
|
"value": "[variables('txtAadResourceIdValue')]"
|
|
}
|
|
}
|
|
} |