How to configure windows ado agent using powershell script in a terraform module

OYETI, ISHAU 5 Reputation points
2024-09-06T22:35:41.0433333+00:00

I am using terraform to provision a vm and using a powershell script to install and configure ado agent on the vm upon creation. I have the powershell script both in azure blob storage and in my github repo. However the vm is still unable to route to both the github repo and blob storage to download the script. I keep getting the following error:

Error: Code="VMExtensionProvisioningError" Message="VM has reported a failure when processing extension 'ConfigureADOAgent' (publisher 'Microsoft.Compute' and type 'CustomScriptExtension'). Error message: 'File download failure'. More information on troubleshooting is available at https://aka.ms/VMExtensionCSEWindowsTroubleshoot. "

│ with azurerm_virtual_machine_extension.extension[0],

│ on resource.tf line 87, in resource "azurerm_virtual_machine_extension" "extension":

│ 87: resource "azurerm_virtual_machine_extension" "extension" {

Here is a snippet of the block of code in the terraform config that creates the custom script extension;

resource "azurerm_virtual_machine_extension" "extension" {

count = var.no_of_vm

name = "ConfigureADOAgent"

virtual_machine_id = azurerm_windows_virtual_machine.ado_agent[count.index].id

publisher = "Microsoft.Compute"

type = "CustomScriptExtension"

type_handler_version = "1.10"

settings = <<SETTINGS

{

    "fileUris": ["https://winadoblob.blob.core.windows.net/newcontainer/userdata.ps1"],

    "commandToExecute": "powershell -ExecutionPolicy Unrestricted -File userdata.ps1"

}

SETTINGS

}

Windows for business | Windows Client for IT Pros | Devices and deployment | Set up, install, or upgrade
Windows for business | Windows 365 Business
Windows for business | Windows Server | User experience | Other
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Shipra Shah 6 Reputation points
    2024-10-29T18:06:00.3933333+00:00

    I have the same situation. can someone please advise?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.