1

I'm trying to set up a Ubuntu Server on Azure. None of the images do quite what I want, so I was planning on taking a vanilla Ubuntu image and using cloud-init to modify it. I'd like to be able to deploy this to multiple environments using Azure Pipelines and have an ARM Template that is deploying the vanilla instance quite nicely.

The issue I have is how to get the cloud-init script I have into the custom data parameter of the ARM Template. It seems that because ARM Templates have to be JSON the only way to do this is to have the cloud-init script on one very very long line. Either that or host the cloud-init file somewhere and do something hacky like this: https://www.wintellect.com/arm-templates-and-cloud-init/. The ARM Template task I'm using in Azure Pipelines does not seem to have a way to pass a file's contents as a parameter.

I'd like to have both the ARM Template and the cloud-init script as separate files in my private git repository. Currently I'm considering some kind of pre-processing build step to combine the two. Has anyone already done this and have a code example?

Maybe I'm "doing it wrong", what do other people do/what is the best way to do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.