Hi Everyone, I've been tasked to add an additional...
# azure
Hi Everyone, I've been tasked to add an additional Azure VM extension (agent) to our Pulumi Iac build. I'm having issues passing variables to the extension once its deployed. I'm deploying the "team service agent" on to a windows 2019 server in Azure. The extension deploys ok, but has soon as I try and pass any variables to the agent it logs an error. Error in Agent Logs The Extension failed to execute: Cannot convert value "VSTSAccountName" to type "System.Int32". Error: "Input string was not in a correct format.". c# // Install the Azure Pipelines Agent as a VM extension var extension = new Pulumi.AzureNative.Compute.VirtualMachineExtension("VMExtension", new Pulumi.AzureNative.Compute.VirtualMachineExtensionArgs { ResourceGroupName = resourceGroup.Name, VmName = virtualMachine.Name, AutoUpgradeMinorVersion = true, EnableAutomaticUpgrade = false, InstanceView = { }, Location = location, ProtectedSettings= @" { 'PATTOKEN': 'mypattokengoeshere', }", ProtectedSettingsFromKeyVault = { }, Publisher = "Microsoft.VisualStudio.Services", Settings = @" { 'VSTSAccountName': 'https://dev.azure.com/projectname', 'TeamProject': 'Project', 'DeploymentGroup': 'Pulumi-Deploy', 'AgentName': 'vm1', 'Tags': 'Customer1' }", SuppressFailures = true, Type = "TeamServicesAgent", TypeHandlerVersion = "1.2", VmExtensionName = "azure-pipelines-agent", }); ```
That error message strikes me as very strange. What business does the Extension have trying to convert
to an int? That should always be a string
Hello Willem, Yes my thoughts exactly. I've managed to create and run a powershell script and this method works. The stranger part to the c# class above is, if I don't pass any values { } in the settings parameter it still complains with the same error message. I think there might be a bug in the VirtualMachineExtension.