I am wanting to execute a PowerShell file stored on Azure storage account from terraform both from locally and from azure.
I included provisioner on my terraform script to execute the PowerShell file
resource "azurerm_automation_account" "my_acc" {
name = "AUT-ACCOUNT-586"
location = "${azurerm_resource_group.rg_obj.location}"
resource_group_name = "${azurerm_resource_group.rg_obj.name}"
sku_name = "Basic"
provisioner "local-exec" {
command = "http://${azurerm_storage_account.storageaccount.name}.blob.core.windows.net/${azurerm_storage_container.blobstorage.name}/Import-PowerShell-Modules.ps1"
interpreter = ["PowerShell","-Command"]
}
}
I expect the PowerShell file to get executed.
The output is The term 'http://MyStorage.blob.core.windows.net/scripts/Import-PowerShell-Modules.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + http://MyStorage.blob.core.windows.net/scripts/Import-PowerShell ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (http://MyStorage...ell-Modules.ps1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException. Getting an error.