Unable to install Custom extension on Azure linux VM

Khandu Shinde 110 Reputation points
2024-09-18T15:25:00.73+00:00

Hi All

I am running a script inside Azure virtual machine extension in Linux virtual machine. Currently this script's parameters length become more than 256 kb. I have checked blog on custom script extension on github which shows this length becomes limitation. To avoid this, it gives one option to use gzip as per below

User's image My question is: How to use gzip below script which is creating on the fly inside below resource?

resource "azurerm_virtual_machine_extension" "linux-vm-setup" {
  depends_on           = [
   
  virtual_machine_id   = azurerm_linux_virtual_machine.cicd-vm.id

  name                 = "setup-vm"
  publisher            = "Microsoft.Azure.Extensions"
  type                 = "CustomScript"
  type_handler_version = "2.0"

  protected_settings = jsonencode({
    script = base64encode(<<SCRIPT
#!/bin/bash
set -e

SCRIPT
    )
  })

}
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,870 questions
{count} votes

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.