mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Resolves #31049 A few changes were needed here: 1. Upgrade jsdom to >= 19 in the JS sample, similar to https://github.com/Azure/azure-sdk-for-js/issues/20934 which fixed the TS sample 2. Update the sample to use a SAS URL so that it can be runnable 3. Remove usage of env vars, instead using the string directly and recommending passing a SAS URL from the server in production
99 lines
3.1 KiB
JSON
99 lines
3.1 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"baseName": {
|
|
"type": "string",
|
|
"defaultValue": "[resourceGroup().name]",
|
|
"metadata": {
|
|
"description": "The base resource name."
|
|
}
|
|
},
|
|
"origin": {
|
|
"type": "string",
|
|
"defaultValue": "http://localhost:1234",
|
|
"metadata": {
|
|
"description": "The application origin for configuring CORS policies. By default it'll be set to http://localhost:1234 locally."
|
|
}
|
|
},
|
|
"baseTime": {
|
|
"type": "string",
|
|
"defaultValue": "[utcNow('u')]",
|
|
"metadata": {
|
|
"description": "The base time to add 2 hours to for SAS token expiration. The default is the current time."
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"storageAccountName": "[concat(replace(parameters('baseName'), '-', ''), 'storage')]",
|
|
"storageContainerName": "blobs",
|
|
"location": "[resourceGroup().location]",
|
|
"accountSasProperties": {
|
|
"signedServices": "b",
|
|
"signedPermission": "rwdlacu",
|
|
"signedProtocol": "https",
|
|
"signedExpiry": "[dateTimeAdd(parameters('baseTime'), 'PT2H')]",
|
|
"signedResourceTypes": "sco",
|
|
"keyToSign": "key1"
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts",
|
|
"apiVersion": "2019-06-01",
|
|
"name": "[variables('storageAccountName')]",
|
|
"location": "[variables('location')]",
|
|
"sku": {
|
|
"name": "Standard_LRS",
|
|
"tier": "Standard"
|
|
},
|
|
"kind": "StorageV2",
|
|
"properties": {
|
|
"accessTier": "Hot"
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "blobServices",
|
|
"apiVersion": "2019-06-01",
|
|
"name": "default",
|
|
"dependsOn": ["[variables('storageAccountName')]"],
|
|
"properties": {
|
|
"cors": {
|
|
"corsRules": [
|
|
{
|
|
"allowedOrigins": ["[parameters('origin')]"],
|
|
"allowedMethods": ["GET", "OPTIONS", "PUT", "POST"],
|
|
"maxAgeInSeconds": 0,
|
|
"exposedHeaders": ["*"],
|
|
"allowedHeaders": ["*"]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "containers",
|
|
"apiVersion": "2019-06-01",
|
|
"name": "[variables('storageContainerName')]",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', variables('storageAccountName'), 'default')]",
|
|
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"outputs": {
|
|
"azure_storage_blob_sas_url": {
|
|
"type": "string",
|
|
"value": "[concat('https://',variables('storageAccountName'),'.blob.core.windows.net/','blobs','?', listAccountSas(variables('storageAccountName'), '2019-06-01', variables('accountSasProperties')).accountSasToken)]"
|
|
},
|
|
"azure_storage_blob_container_name": {
|
|
"type": "string",
|
|
"value": "[concat('default/', variables('storageContainerName'))]"
|
|
}
|
|
}
|
|
}
|