From 9f00c4d9da4ccc1b8c481613029b21aeb82bfcc9 Mon Sep 17 00:00:00 2001 From: "Brian Moore (AZURE RESOURCE MANAGER)" Date: Mon, 25 Jan 2021 12:40:33 -0600 Subject: [PATCH] changes to support queryString property --- VMCSEInstallFileBash/azuredeploy.json | 20 ++++---------------- VMCSEInstallFileBash/copyfilefromazure.sh | 2 +- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/VMCSEInstallFileBash/azuredeploy.json b/VMCSEInstallFileBash/azuredeploy.json index 1ed4529..9efc8de 100644 --- a/VMCSEInstallFileBash/azuredeploy.json +++ b/VMCSEInstallFileBash/azuredeploy.json @@ -15,20 +15,6 @@ "description": "Password for the Virtual Machine." } }, - "_artifactsLocation": { - "type": "string", - "defaultValue": "[deployment().properties.templateLink.uri]", - "metadata": { - "description": "Auto-generated container in staging storage account to receive post-build staging folder upload" - } - }, - "_artifactsLocationSasToken": { - "type": "securestring", - "defaultValue": "", - "metadata": { - "description": "Auto-generated token to access _artifactsLocation" - } - }, "vmSize": { "type":"string", "defaultValue": "Standard_A2", @@ -45,6 +31,8 @@ } }, "variables": { + "_artifactsLocation": "[deployment().properties.templateLink.uri]", + "_artifactsLocationSasToken": "[if(contains(deployment().properties.templateLink, 'queryString'), deployment().properties.templateLink.queryString, '')]", "imagePublisher": "Canonical", "imageOffer": "UbuntuServer", "OSVersion": "16.04.0-LTS", @@ -61,7 +49,7 @@ "fileToBeCopied": "FileToBeCopied.txt", "scriptFolder": ".", "scriptFileName": "copyfilefromazure.sh", - "scriptArgs": "[concat('-a ', parameters('_artifactsLocation'), ' -t \"', parameters('_artifactsLocationSasToken'), '\" -p ', variables('scriptFolder'), ' -f ', variables('fileToBeCopied'))]" + "scriptArgs": "[concat('-a ', variables('_artifactsLocation'), ' -t \"', variables('_artifactsLocationSasToken'), '\" -p ', variables('scriptFolder'), ' -f ', variables('fileToBeCopied'))]" }, "resources": [ { @@ -192,7 +180,7 @@ "forceUpdateTag": "changeThisToEnsureScriptRuns-maxlength=50", "settings": { "fileUris": [ - "[uri(parameters('_artifactsLocation'), concat(variables('scriptFileName'), parameters('_artifactsLocationSasToken')))]" + "[uri(variables('_artifactsLocation'), concat(variables('scriptFileName'), '?', variables('_artifactsLocationSasToken')))]" ], "commandToExecute": "[concat('bash ', variables('scriptFileName'), ' ', variables('scriptArgs'))]" } diff --git a/VMCSEInstallFileBash/copyfilefromazure.sh b/VMCSEInstallFileBash/copyfilefromazure.sh index 6e4e867..b91a0bc 100644 --- a/VMCSEInstallFileBash/copyfilefromazure.sh +++ b/VMCSEInstallFileBash/copyfilefromazure.sh @@ -16,7 +16,7 @@ while getopts "a:t:p:f:" opt; do esac done -fileUrl="$artifactsLocation/$pathToFile/$fileToInstall$token" +fileUrl="$artifactsLocation/$pathToFile/$fileToInstall?${token#\?}" stagingDir="/staging" mkdir -v "$stagingDir"