Ensure the script is sourced
. .\variables.ps1
Create destination directory
if (!(Test-Path -Path $destinationPath)) {
New-Item -Path $destinationPath -ItemType Directory -Force
}
Download the ZIP file from Azure Blob Storage
Write-Output “Downloading bundle from $blob_sas_url to $destinationPath\Test-bundle.zip”
Invoke-WebRequest -Uri $blob_sas_url -OutFile “destinationPath\Test-bundle.zip"
file is not getting downloaded when executed from teraform
"https://{var.storage_account_name}.blob.core.windows.net/{var.storage_container_name}/{var.script_blob_name}?{var.sas_token}",
"https://{var.storage_account_name}.blob.core.windows.net/{var.storage_container_name}/{var.variable_file_blob_name}?{var.sas_token}",
"https://{var.storage_account_name}.blob.core.windows.net/{var.storage_container_name}/{var.installation_bundle_blob_name}?${var.sas_token}”
],
“commandToExecute”: “powershell -ExecutionPolicy Unrestricted -File script.ps1”
but after loginging into the vm was able to download running the same script